From 1cba822390c0a6e2c2d8f3f9e101215a1abc22cc Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 31 Jul 2024 19:00:13 +0000 Subject: [PATCH 001/397] feat: various codegen changes --- .release-please-manifest.json | 2 +- .stats.yml | 4 +- CHANGELOG.md | 25 +++ api.md | 12 ++ examples/schedule_for_stop.py | 16 ++ examples/stop_ids_for_agency.py | 2 +- pyproject.toml | 2 +- src/onebusaway/_client.py | 8 + src/onebusaway/_version.py | 2 +- src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/schedule_for_stop.py | 167 ++++++++++++++++++ .../resources/stops_for_location.py | 4 - src/onebusaway/resources/trip_for_vehicle.py | 4 +- src/onebusaway/types/__init__.py | 2 + ...gencies_with_coverage_retrieve_response.py | 6 +- .../types/agency_retrieve_response.py | 6 +- .../arrival_and_departure_list_response.py | 8 +- ...arrival_and_departure_retrieve_response.py | 4 +- .../types/config_retrieve_response.py | 4 +- .../types/current_time_retrieve_response.py | 4 +- .../types/route_retrieve_response.py | 4 +- .../schedule_for_stop_retrieve_params.py | 19 ++ .../schedule_for_stop_retrieve_response.py | 89 ++++++++++ .../stop_ids_for_agency_list_response.py | 6 +- .../types/stop_retrieve_response.py | 4 +- .../stops_for_location_retrieve_params.py | 4 +- .../stops_for_location_retrieve_response.py | 6 +- .../types/stops_for_route_list_response.py | 2 +- .../types/trip_detail_retrieve_response.py | 4 +- .../trip_for_vehicle_retrieve_response.py | 4 +- .../types/trip_retrieve_response.py | 4 +- .../trips_for_location_retrieve_response.py | 8 +- tests/api_resources/test_schedule_for_stop.py | 115 ++++++++++++ .../api_resources/test_stops_for_location.py | 26 +-- 34 files changed, 519 insertions(+), 72 deletions(-) create mode 100644 examples/schedule_for_stop.py create mode 100644 src/onebusaway/resources/schedule_for_stop.py create mode 100644 src/onebusaway/types/schedule_for_stop_retrieve_params.py create mode 100644 src/onebusaway/types/schedule_for_stop_retrieve_response.py create mode 100644 tests/api_resources/test_schedule_for_stop.py diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b5db7ce..3b005e5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.7" + ".": "0.1.0-alpha.10" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fa549e7..cce1cfa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-7a71bec90a568b0dbefc3d81206069d9759259460cffa0543b162f6835be1e9a.yml +configured_endpoints: 17 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-261df351536029839245955df4df7341de315fe2b1d1d6aeb063eaef62bcddc9.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index fdbe776..f2fcfe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 0.1.0-alpha.10 (2024-07-31) + +Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#37](https://github.com/OneBusAway/python-sdk/issues/37)) ([cc7611d](https://github.com/OneBusAway/python-sdk/commit/cc7611d6984efe9cce70b1388c8bdfd14ed814d3)) +* **api:** OpenAPI spec update via Stainless API ([#39](https://github.com/OneBusAway/python-sdk/issues/39)) ([45dc9fe](https://github.com/OneBusAway/python-sdk/commit/45dc9fe6b89ab5224d6f60d97d10ab85326e08fd)) + +## 0.1.0-alpha.9 (2024-07-31) + +Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#34](https://github.com/OneBusAway/python-sdk/issues/34)) ([d60f5d7](https://github.com/OneBusAway/python-sdk/commit/d60f5d72bed809667875d4548bc4909d5125a6d5)) + +## 0.1.0-alpha.8 (2024-07-30) + +Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#31](https://github.com/OneBusAway/python-sdk/issues/31)) ([891cdf5](https://github.com/OneBusAway/python-sdk/commit/891cdf59961594e7bfb21fc25e8615b3c536dc8e)) + ## 0.1.0-alpha.7 (2024-07-29) Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7) diff --git a/api.md b/api.md index ac324dd..8404d9c 100644 --- a/api.md +++ b/api.md @@ -112,6 +112,18 @@ Methods: - client.stop_ids_for_agency.list(agency_id) -> StopIDsForAgencyListResponse +# ScheduleForStop + +Types: + +```python +from onebusaway.types import ScheduleForStopRetrieveResponse +``` + +Methods: + +- client.schedule_for_stop.retrieve(stop_id, \*\*params) -> ScheduleForStopRetrieveResponse + # Route Types: diff --git a/examples/schedule_for_stop.py b/examples/schedule_for_stop.py new file mode 100644 index 0000000..05eaf2f --- /dev/null +++ b/examples/schedule_for_stop.py @@ -0,0 +1,16 @@ +import onebusaway + + +def main_sync() -> None: + client = onebusaway.OnebusawaySDK(api_key="TEST") + stop_id = "1_75403" + schedule_for_stop = client.schedule_for_stop.retrieve(stop_id) + + if schedule_for_stop.data and schedule_for_stop.data.entry: + print(schedule_for_stop.data.entry) + else: + print("schedule data or entry is None.") + + +if __name__ == "__main__": + main_sync() diff --git a/examples/stop_ids_for_agency.py b/examples/stop_ids_for_agency.py index 1d2e5d6..59b8d77 100644 --- a/examples/stop_ids_for_agency.py +++ b/examples/stop_ids_for_agency.py @@ -18,4 +18,4 @@ stop_ids = oba.stop_ids_for_agency.list(agency_id) if stop_ids.data and stop_ids.data.list: for stop_id in stop_ids.data.list: - print(stop_id) \ No newline at end of file + print(stop_id) diff --git a/pyproject.toml b/pyproject.toml index 63a507b..6db0b9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.7" +version = "0.1.0-alpha.10" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index de1458c..4d0abe9 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -55,6 +55,7 @@ class OnebusawaySDK(SyncAPIClient): stops_for_route: resources.StopsForRouteResource stop: resources.StopResource stop_ids_for_agency: resources.StopIDsForAgencyResource + schedule_for_stop: resources.ScheduleForStopResource route: resources.RouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource @@ -127,6 +128,7 @@ def __init__( self.stops_for_route = resources.StopsForRouteResource(self) self.stop = resources.StopResource(self) self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self) + self.schedule_for_stop = resources.ScheduleForStopResource(self) self.route = resources.RouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) @@ -259,6 +261,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): stops_for_route: resources.AsyncStopsForRouteResource stop: resources.AsyncStopResource stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource + schedule_for_stop: resources.AsyncScheduleForStopResource route: resources.AsyncRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource @@ -331,6 +334,7 @@ def __init__( self.stops_for_route = resources.AsyncStopsForRouteResource(self) self.stop = resources.AsyncStopResource(self) self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self) + self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) self.route = resources.AsyncRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) @@ -466,6 +470,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route) self.stop = resources.StopResourceWithRawResponse(client.stop) self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) + self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) @@ -487,6 +492,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) self.stop = resources.AsyncStopResourceWithRawResponse(client.stop) self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) + self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure @@ -510,6 +516,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) self.stop = resources.StopResourceWithStreamingResponse(client.stop) self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) + self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure @@ -539,6 +546,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse( client.stop_ids_for_agency ) + self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index faf8c10..ffc4f0c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.7" # x-release-please-version +__version__ = "0.1.0-alpha.10" # x-release-please-version diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 041cf0a..48fb9f8 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -72,6 +72,14 @@ TripForVehicleResourceWithStreamingResponse, AsyncTripForVehicleResourceWithStreamingResponse, ) +from .schedule_for_stop import ( + ScheduleForStopResource, + AsyncScheduleForStopResource, + ScheduleForStopResourceWithRawResponse, + AsyncScheduleForStopResourceWithRawResponse, + ScheduleForStopResourceWithStreamingResponse, + AsyncScheduleForStopResourceWithStreamingResponse, +) from .stops_for_location import ( StopsForLocationResource, AsyncStopsForLocationResource, @@ -176,6 +184,12 @@ "AsyncStopIDsForAgencyResourceWithRawResponse", "StopIDsForAgencyResourceWithStreamingResponse", "AsyncStopIDsForAgencyResourceWithStreamingResponse", + "ScheduleForStopResource", + "AsyncScheduleForStopResource", + "ScheduleForStopResourceWithRawResponse", + "AsyncScheduleForStopResourceWithRawResponse", + "ScheduleForStopResourceWithStreamingResponse", + "AsyncScheduleForStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py new file mode 100644 index 0000000..9b44909 --- /dev/null +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -0,0 +1,167 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date + +import httpx + +from ..types import schedule_for_stop_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse + +__all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] + + +class ScheduleForStopResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: + return ScheduleForStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingResponse: + return ScheduleForStopResourceWithStreamingResponse(self) + + def retrieve( + self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForStopRetrieveResponse: + """ + Get schedule for a specific stop + + Args: + date: The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to the current date) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not stop_id: + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + return self._get( + f"/api/where/schedule-for-stop/{stop_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams), + ), + cast_to=ScheduleForStopRetrieveResponse, + ) + + +class AsyncScheduleForStopResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: + return AsyncScheduleForStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingResponse: + return AsyncScheduleForStopResourceWithStreamingResponse(self) + + async def retrieve( + self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForStopRetrieveResponse: + """ + Get schedule for a specific stop + + Args: + date: The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to the current date) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not stop_id: + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + return await self._get( + f"/api/where/schedule-for-stop/{stop_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams + ), + ), + cast_to=ScheduleForStopRetrieveResponse, + ) + + +class ScheduleForStopResourceWithRawResponse: + def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: + self._schedule_for_stop = schedule_for_stop + + self.retrieve = to_raw_response_wrapper( + schedule_for_stop.retrieve, + ) + + +class AsyncScheduleForStopResourceWithRawResponse: + def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: + self._schedule_for_stop = schedule_for_stop + + self.retrieve = async_to_raw_response_wrapper( + schedule_for_stop.retrieve, + ) + + +class ScheduleForStopResourceWithStreamingResponse: + def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: + self._schedule_for_stop = schedule_for_stop + + self.retrieve = to_streamed_response_wrapper( + schedule_for_stop.retrieve, + ) + + +class AsyncScheduleForStopResourceWithStreamingResponse: + def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: + self._schedule_for_stop = schedule_for_stop + + self.retrieve = async_to_streamed_response_wrapper( + schedule_for_stop.retrieve, + ) diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index c7c654f..dd64b27 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -36,7 +36,6 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon def retrieve( self, *, - key: str, lat: float | NotGiven = NOT_GIVEN, lon: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -67,7 +66,6 @@ def retrieve( timeout=timeout, query=maybe_transform( { - "key": key, "lat": lat, "lon": lon, }, @@ -90,7 +88,6 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR async def retrieve( self, *, - key: str, lat: float | NotGiven = NOT_GIVEN, lon: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -121,7 +118,6 @@ async def retrieve( timeout=timeout, query=await async_maybe_transform( { - "key": key, "lat": lat, "lon": lon, }, diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index f0091cd..b98c3ed 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -74,7 +74,7 @@ def retrieve( if not vehicle_id: raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return self._get( - f"/api/where/trip-for-vehicle/vehicleID.json", + f"/api/where/trip-for-vehicle/{vehicle_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -144,7 +144,7 @@ async def retrieve( if not vehicle_id: raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return await self._get( - f"/api/where/trip-for-vehicle/vehicleID.json", + f"/api/where/trip-for-vehicle/{vehicle_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index e9da12e..87b7d0c 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -16,12 +16,14 @@ from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse +from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse from .arrival_and_departure_retrieve_params import ( diff --git a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py index 43df6e7..6a54093 100644 --- a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py +++ b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py @@ -28,11 +28,11 @@ class AgenciesWithCoverageRetrieveResponseDataList(BaseModel): class AgenciesWithCoverageRetrieveResponseData(BaseModel): - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + list: List[AgenciesWithCoverageRetrieveResponseDataList] - list: Optional[List[AgenciesWithCoverageRetrieveResponseDataList]] = None + references: References - references: Optional[References] = None + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) class AgenciesWithCoverageRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index f1fdd43..bec686c 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -34,11 +34,11 @@ class AgencyRetrieveResponseDataEntry(BaseModel): class AgencyRetrieveResponseData(BaseModel): - entry: Optional[AgencyRetrieveResponseDataEntry] = None + entry: AgencyRetrieveResponseDataEntry - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + references: References - references: Optional[References] = None + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) class AgencyRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 2b13670..84eb767 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -266,15 +266,15 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): class ArrivalAndDepartureListResponseDataEntry(BaseModel): - arrivals_and_departures: Optional[List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture]] = FieldInfo( - alias="arrivalsAndDepartures", default=None + arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( + alias="arrivalsAndDepartures" ) class ArrivalAndDepartureListResponseData(BaseModel): - entry: Optional[ArrivalAndDepartureListResponseDataEntry] = None + entry: ArrivalAndDepartureListResponseDataEntry - references: Optional[References] = None + references: References class ArrivalAndDepartureListResponse(ResponseWrapper): diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index aa6c77a..723eec7 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -265,9 +265,9 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): class ArrivalAndDepartureRetrieveResponseData(BaseModel): - entry: Optional[ArrivalAndDepartureRetrieveResponseDataEntry] = None + entry: ArrivalAndDepartureRetrieveResponseDataEntry - references: Optional[References] = None + references: References class ArrivalAndDepartureRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index d814f25..fb24ae4 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -73,9 +73,9 @@ class ConfigRetrieveResponseDataEntry(BaseModel): class ConfigRetrieveResponseData(BaseModel): - entry: Optional[ConfigRetrieveResponseDataEntry] = None + entry: ConfigRetrieveResponseDataEntry - references: Optional[References] = None + references: References class ConfigRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 7459360..0f0ad3b 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -18,9 +18,9 @@ class CurrentTimeRetrieveResponseDataEntry(BaseModel): class CurrentTimeRetrieveResponseData(BaseModel): - entry: Optional[CurrentTimeRetrieveResponseDataEntry] = None + entry: CurrentTimeRetrieveResponseDataEntry - references: Optional[References] = None + references: References class CurrentTimeRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index 640416a..cf07d4a 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -32,9 +32,9 @@ class RouteRetrieveResponseDataEntry(BaseModel): class RouteRetrieveResponseData(BaseModel): - entry: Optional[RouteRetrieveResponseDataEntry] = None + entry: RouteRetrieveResponseDataEntry - references: Optional[References] = None + references: References class RouteRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py new file mode 100644 index 0000000..99b89f7 --- /dev/null +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import datetime +from typing import Union +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ScheduleForStopRetrieveParams"] + + +class ScheduleForStopRetrieveParams(TypedDict, total=False): + date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + """ + The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to the current date) + """ diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py new file mode 100644 index 0000000..5170464 --- /dev/null +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "ScheduleForStopRetrieveResponse", + "ScheduleForStopRetrieveResponseData", + "ScheduleForStopRetrieveResponseDataEntry", + "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency", +] + + +class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime(BaseModel): + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + + arrival_time: int = FieldInfo(alias="arrivalTime") + + departure_enabled: bool = FieldInfo(alias="departureEnabled") + + departure_time: int = FieldInfo(alias="departureTime") + + service_id: str = FieldInfo(alias="serviceId") + + trip_id: str = FieldInfo(alias="tripId") + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + +class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency(BaseModel): + end_time: int = FieldInfo(alias="endTime") + + headway: int + + service_date: int = FieldInfo(alias="serviceDate") + + service_id: str = FieldInfo(alias="serviceId") + + start_time: int = FieldInfo(alias="startTime") + + trip_id: str = FieldInfo(alias="tripId") + + +class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule(BaseModel): + schedule_stop_times: List[ + ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime + ] = FieldInfo(alias="scheduleStopTimes") + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + + schedule_frequencies: Optional[ + List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency] + ] = FieldInfo(alias="scheduleFrequencies", default=None) + + +class ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule(BaseModel): + route_id: str = FieldInfo(alias="routeId") + + stop_route_direction_schedules: List[ + ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule + ] = FieldInfo(alias="stopRouteDirectionSchedules") + + +class ScheduleForStopRetrieveResponseDataEntry(BaseModel): + date: int + + stop_id: str = FieldInfo(alias="stopId") + + stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo( + alias="stopRouteSchedules" + ) + + +class ScheduleForStopRetrieveResponseData(BaseModel): + entry: ScheduleForStopRetrieveResponseDataEntry + + references: References + + +class ScheduleForStopRetrieveResponse(ResponseWrapper): + data: Optional[ScheduleForStopRetrieveResponseData] = None diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index 6120be8..bf3927c 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -12,11 +12,11 @@ class StopIDsForAgencyListResponseData(BaseModel): - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + list: List[str] - list: Optional[List[str]] = None + references: References - references: Optional[References] = None + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) class StopIDsForAgencyListResponse(ResponseWrapper): diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index abb6779..8d71183 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -36,9 +36,9 @@ class StopRetrieveResponseDataEntry(BaseModel): class StopRetrieveResponseData(BaseModel): - entry: Optional[StopRetrieveResponseDataEntry] = None + entry: StopRetrieveResponseDataEntry - references: Optional[References] = None + references: References class StopRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/stops_for_location_retrieve_params.py b/src/onebusaway/types/stops_for_location_retrieve_params.py index aaf2936..b5c1ba6 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_params.py +++ b/src/onebusaway/types/stops_for_location_retrieve_params.py @@ -2,14 +2,12 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict __all__ = ["StopsForLocationRetrieveParams"] class StopsForLocationRetrieveParams(TypedDict, total=False): - key: Required[str] - lat: float lon: float diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_retrieve_response.py index a505f4a..3612168 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_retrieve_response.py @@ -40,11 +40,11 @@ class StopsForLocationRetrieveResponseDataList(BaseModel): class StopsForLocationRetrieveResponseData(BaseModel): - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + list: List[StopsForLocationRetrieveResponseDataList] - list: Optional[List[StopsForLocationRetrieveResponseDataList]] = None + references: References - references: Optional[References] = None + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) class StopsForLocationRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index d0703a0..2aa1644 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -72,4 +72,4 @@ class StopsForRouteListResponseData(BaseModel): class StopsForRouteListResponse(ResponseWrapper): - data: Optional[StopsForRouteListResponseData] = None + data: StopsForRouteListResponseData diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index e88b30c..24f2152 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -179,9 +179,9 @@ class TripDetailRetrieveResponseDataEntry(BaseModel): class TripDetailRetrieveResponseData(BaseModel): - entry: Optional[TripDetailRetrieveResponseDataEntry] = None + entry: TripDetailRetrieveResponseDataEntry - references: Optional[References] = None + references: References class TripDetailRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index fdebda9..90a6ff8 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -179,9 +179,9 @@ class TripForVehicleRetrieveResponseDataEntry(BaseModel): class TripForVehicleRetrieveResponseData(BaseModel): - entry: Optional[TripForVehicleRetrieveResponseDataEntry] = None + entry: TripForVehicleRetrieveResponseDataEntry - references: Optional[References] = None + references: References class TripForVehicleRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 58a3a34..92c8546 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -36,9 +36,9 @@ class TripRetrieveResponseDataEntry(BaseModel): class TripRetrieveResponseData(BaseModel): - entry: Optional[TripRetrieveResponseDataEntry] = None + entry: TripRetrieveResponseDataEntry - references: Optional[References] = None + references: References class TripRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 2c69d10..237c30c 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -26,16 +26,16 @@ class TripsForLocationRetrieveResponseDataList(BaseModel): class TripsForLocationRetrieveResponseData(BaseModel): + list: List[TripsForLocationRetrieveResponseDataList] + + references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) """Indicates if the limit of trips has been exceeded""" - list: Optional[List[TripsForLocationRetrieveResponseDataList]] = None - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) """Indicates if the search location is out of range""" - references: Optional[References] = None - class TripsForLocationRetrieveResponse(ResponseWrapper): data: Optional[TripsForLocationRetrieveResponseData] = None diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py new file mode 100644 index 0000000..0154e44 --- /dev/null +++ b/tests/api_resources/test_schedule_for_stop.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import ScheduleForStopRetrieveResponse +from onebusaway._utils import parse_date + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestScheduleForStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + schedule_for_stop = client.schedule_for_stop.retrieve( + stop_id="stopID", + ) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + schedule_for_stop = client.schedule_for_stop.retrieve( + stop_id="stopID", + date=parse_date("2019-12-27"), + ) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_stop.with_raw_response.retrieve( + stop_id="stopID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schedule_for_stop = response.parse() + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.schedule_for_stop.with_streaming_response.retrieve( + stop_id="stopID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schedule_for_stop = response.parse() + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): + client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) + + +class TestAsyncScheduleForStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + schedule_for_stop = await async_client.schedule_for_stop.retrieve( + stop_id="stopID", + ) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + schedule_for_stop = await async_client.schedule_for_stop.retrieve( + stop_id="stopID", + date=parse_date("2019-12-27"), + ) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_stop.with_raw_response.retrieve( + stop_id="stopID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schedule_for_stop = await response.parse() + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.schedule_for_stop.with_streaming_response.retrieve( + stop_id="stopID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schedule_for_stop = await response.parse() + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): + await async_client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index 6613263..d1abaeb 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -19,15 +19,12 @@ class TestStopsForLocation: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve( - key="key", - ) + stops_for_location = client.stops_for_location.retrieve() assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: stops_for_location = client.stops_for_location.retrieve( - key="key", lat=0, lon=0, ) @@ -35,9 +32,7 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.retrieve( - key="key", - ) + response = client.stops_for_location.with_raw_response.retrieve() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -46,9 +41,7 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.retrieve( - key="key", - ) as response: + with client.stops_for_location.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,15 +56,12 @@ class TestAsyncStopsForLocation: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve( - key="key", - ) + stops_for_location = await async_client.stops_for_location.retrieve() assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_location = await async_client.stops_for_location.retrieve( - key="key", lat=0, lon=0, ) @@ -79,9 +69,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.retrieve( - key="key", - ) + response = await async_client.stops_for_location.with_raw_response.retrieve() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,9 +78,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.retrieve( - key="key", - ) as response: + async with async_client.stops_for_location.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 9dfffd881f9bbe738a2af883ef1dae8db68c7eb7 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 31 Jul 2024 19:00:16 +0000 Subject: [PATCH 002/397] feat: chore: Refactor code by removing unnecessary blank lines --- examples/agencies_with_coverage.py | 16 +++-- examples/arrivals_and_departures_for_stop.py | 21 ++++--- examples/config.py | 15 +++-- examples/current_time.py | 15 +++-- examples/helpers/load_env.py | 13 ++-- examples/stop.py | 16 +++-- examples/stop_for_route.py | 19 +++--- examples/stop_ids_for_agency.py | 14 +++-- examples/stops_for_location.py | 19 +++--- examples/trip_details.py | 16 +++-- src/onebusaway/_base_client.py | 63 +++++++++++++------- src/onebusaway/_compat.py | 24 +++++--- src/onebusaway/_files.py | 12 ++-- src/onebusaway/_response.py | 12 ++-- src/onebusaway/_types.py | 9 ++- src/onebusaway/_utils/_proxy.py | 3 +- src/onebusaway/_utils/_utils.py | 18 ++++-- tests/test_deepcopy.py | 3 +- tests/test_response.py | 12 ++-- tests/test_utils/test_typing.py | 15 +++-- 20 files changed, 212 insertions(+), 123 deletions(-) diff --git a/examples/agencies_with_coverage.py b/examples/agencies_with_coverage.py index 878ba97..0e239ed 100644 --- a/examples/agencies_with_coverage.py +++ b/examples/agencies_with_coverage.py @@ -1,14 +1,18 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) diff --git a/examples/arrivals_and_departures_for_stop.py b/examples/arrivals_and_departures_for_stop.py index 6807007..d2888a6 100644 --- a/examples/arrivals_and_departures_for_stop.py +++ b/examples/arrivals_and_departures_for_stop.py @@ -1,24 +1,27 @@ -from onebusaway import OnebusawaySDK from helpers.load_env import load_settings +from onebusaway import OnebusawaySDK + # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) # Define the query parameters query = { - "tripId": '1_604670535', # Replace with actual trip ID - "serviceDate": '1810918000000', # Replace with actual service date in milliseconds since epoch + "tripId": "1_604670535", # Replace with actual trip ID + "serviceDate": "1810918000000", # Replace with actual service date in milliseconds since epoch } -stopId = '1_75403' # Replace with actual stop ID +stopId = "1_75403" # Replace with actual stop ID # Retrieve arrival and departure information response = oba.arrival_and_departure.list(stopId, extra_query=query) @@ -32,4 +35,4 @@ print(f"Predicted Arrival Time: {arr_dep.predicted_arrival_time}") print(f"Scheduled Arrival Time: {arr_dep.scheduled_arrival_time}") print(f"Vehicle ID: {arr_dep.vehicle_id}") - print('') + print("") diff --git a/examples/config.py b/examples/config.py index 01bdcf3..437640d 100644 --- a/examples/config.py +++ b/examples/config.py @@ -1,15 +1,18 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) diff --git a/examples/current_time.py b/examples/current_time.py index 00caf7a..f0db3e9 100644 --- a/examples/current_time.py +++ b/examples/current_time.py @@ -1,15 +1,18 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) diff --git a/examples/helpers/load_env.py b/examples/helpers/load_env.py index 50a7717..c0f6599 100644 --- a/examples/helpers/load_env.py +++ b/examples/helpers/load_env.py @@ -1,5 +1,6 @@ +from typing import Any, Dict, Optional from pathlib import Path -from typing import Optional, Dict, Any + def load_settings(default_settings: Dict[str, Any]) -> Dict[str, Any]: """ @@ -17,6 +18,7 @@ def load_settings(default_settings: Dict[str, Any]) -> Dict[str, Any]: else: return default_settings + def load_env() -> Optional[Dict[str, Any]]: """ Loads environment variables from a .env file located in the parent directory of the current file. @@ -25,13 +27,14 @@ def load_env() -> Optional[Dict[str, Any]]: A dictionary containing the loaded environment variables, or None if the .env file does not exist. """ dirname = Path(__file__).resolve().parent - env_path = dirname.parent / '.env' + env_path = dirname.parent / ".env" if env_path.exists(): return load_env_from_path(str(env_path)) else: return None + def load_env_from_path(file_path: str) -> Dict[str, str]: """ Load environment variables from a file. @@ -45,17 +48,17 @@ def load_env_from_path(file_path: str) -> Dict[str, str]: """ env = {} - with open(file_path, 'r', encoding='utf8') as file: + with open(file_path, "r", encoding="utf8") as file: lines = file.readlines() for line in lines: # Remove comments and trim whitespace - trimmed_line = line.split('#')[0].strip() + trimmed_line = line.split("#")[0].strip() if not trimmed_line: continue - key_value = trimmed_line.split('=', 1) + key_value = trimmed_line.split("=", 1) if len(key_value) != 2: continue diff --git a/examples/stop.py b/examples/stop.py index 94d35b8..7810f1a 100644 --- a/examples/stop.py +++ b/examples/stop.py @@ -1,14 +1,18 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) diff --git a/examples/stop_for_route.py b/examples/stop_for_route.py index 3b18d41..11354b1 100644 --- a/examples/stop_for_route.py +++ b/examples/stop_for_route.py @@ -1,21 +1,24 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -route_id = '1_100224' +route_id = "1_100224" response = oba.stops_for_route.list(route_id) if response and response.data: - pprint(response.data) + pprint(response.data) diff --git a/examples/stop_ids_for_agency.py b/examples/stop_ids_for_agency.py index 59b8d77..919ee60 100644 --- a/examples/stop_ids_for_agency.py +++ b/examples/stop_ids_for_agency.py @@ -1,19 +1,21 @@ -from onebusaway import OnebusawaySDK from helpers.load_env import load_settings +from onebusaway import OnebusawaySDK # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -agency_id = "40" # Link Light Rail in the Seattle area. +agency_id = "40" # Link Light Rail in the Seattle area. stop_ids = oba.stop_ids_for_agency.list(agency_id) if stop_ids.data and stop_ids.data.list: diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 8cbf2e5..3a8ecc3 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -1,22 +1,25 @@ -from onebusaway import OnebusawaySDK + from helpers.load_env import load_settings -from pprint import pprint + +from onebusaway import OnebusawaySDK # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) space_needle_stops = oba.stops_for_location.retrieve( - key="TEST", # TODO FIXME: I shouldn't have to specify the API key here. + key="TEST", # TODO FIXME: I shouldn't have to specify the API key here. lat=47.6205, - lon=-122.3493 + lon=-122.3493, ) stops = space_needle_stops.data.list diff --git a/examples/trip_details.py b/examples/trip_details.py index 149dd70..ada941e 100644 --- a/examples/trip_details.py +++ b/examples/trip_details.py @@ -1,14 +1,18 @@ -from onebusaway import OnebusawaySDK -from helpers.load_env import load_settings from pprint import pprint +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. -settings = load_settings({ - "api_key": "TEST", - "base_url": "https://api.pugetsound.onebusaway.org/", -}) +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index ae4d8a0..d17404e 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -124,14 +124,16 @@ def __init__( self, *, url: URL, - ) -> None: ... + ) -> None: + ... @overload def __init__( self, *, params: Query, - ) -> None: ... + ) -> None: + ... def __init__( self, @@ -164,7 +166,8 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: ... + def next_page_info(self) -> Optional[PageInfo]: + ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -900,7 +903,8 @@ def request( *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def request( @@ -910,7 +914,8 @@ def request( remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def request( @@ -921,7 +926,8 @@ def request( *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def request( self, @@ -1146,7 +1152,8 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def get( @@ -1157,7 +1164,8 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def get( @@ -1168,7 +1176,8 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def get( self, @@ -1194,7 +1203,8 @@ def post( options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def post( @@ -1207,7 +1217,8 @@ def post( files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def post( @@ -1220,7 +1231,8 @@ def post( files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def post( self, @@ -1453,7 +1465,8 @@ async def request( *, stream: Literal[False] = False, remaining_retries: Optional[int] = None, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def request( @@ -1464,7 +1477,8 @@ async def request( stream: Literal[True], stream_cls: type[_AsyncStreamT], remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def request( @@ -1475,7 +1489,8 @@ async def request( stream: bool, stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def request( self, @@ -1686,7 +1701,8 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def get( @@ -1697,7 +1713,8 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def get( @@ -1708,7 +1725,8 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def get( self, @@ -1732,7 +1750,8 @@ async def post( files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def post( @@ -1745,7 +1764,8 @@ async def post( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def post( @@ -1758,7 +1778,8 @@ async def post( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def post( self, diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 7c6f91a..c919b5a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -159,19 +159,22 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): ... + class GenericModel(pydantic.BaseModel): + ... else: if PYDANTIC_V2: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): ... + class GenericModel(pydantic.BaseModel): + ... else: import pydantic.generics - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): + ... # cached properties @@ -190,21 +193,26 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: ... + def __init__(self, func: Callable[[Any], _T]) -> None: + ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: + ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: + ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: ... + def __set_name__(self, owner: type[Any], name: str) -> None: + ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: ... + def __set__(self, instance: object, value: _T) -> None: + ... else: try: from functools import cached_property as cached_property diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 715cc20..0d2022a 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -39,11 +39,13 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: @overload -def to_httpx_files(files: None) -> None: ... +def to_httpx_files(files: None) -> None: + ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: + ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -81,11 +83,13 @@ def _read_file_content(file: FileContent) -> HttpxFileContent: @overload -async def async_to_httpx_files(files: None) -> None: ... +async def async_to_httpx_files(files: None) -> None: + ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: + ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index e29a7d3..40d4fb2 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -257,10 +257,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): @overload - def parse(self, *, to: type[_T]) -> _T: ... + def parse(self, *, to: type[_T]) -> _T: + ... @overload - def parse(self) -> R: ... + def parse(self) -> R: + ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -359,10 +361,12 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): @overload - async def parse(self, *, to: type[_T]) -> _T: ... + async def parse(self, *, to: type[_T]) -> _T: + ... @overload - async def parse(self) -> R: ... + async def parse(self) -> R: + ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index f554261..66ec7fc 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -111,7 +111,8 @@ class NotGiven: For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: + ... get(timeout=1) # 1s timeout @@ -161,14 +162,16 @@ def build( *, response: Response, data: object, - ) -> _T: ... + ) -> _T: + ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: ... + def get(self, __key: str) -> str | None: + ... HeadersLike = Union[Headers, HeadersLikeProtocol] diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index ffd883e..c46a62a 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -59,4 +59,5 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: ... + def __load__(self) -> T: + ... diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 2fc5a1c..34797c2 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -211,17 +211,20 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: ... + def foo(*, a: str) -> str: + ... @overload - def foo(*, b: bool) -> str: ... + def foo(*, b: bool) -> str: + ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: + ... ``` """ @@ -283,15 +286,18 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: ... +def strip_not_given(obj: None) -> None: + ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: + ... @overload -def strip_not_given(obj: object) -> object: ... +def strip_not_given(obj: object) -> object: + ... def strip_not_given(obj: object | None) -> object: diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 5da235a..519c9b1 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,7 +41,8 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: ... +class MyObject: + ... def test_ignores_other_types() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index df94f16..9e02d05 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -19,13 +19,16 @@ from onebusaway._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): + ... -class ConcreteAPIResponse(APIResponse[List[str]]): ... +class ConcreteAPIResponse(APIResponse[List[str]]): + ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): + ... def test_extract_response_type_direct_classes() -> None: @@ -53,7 +56,8 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): ... +class PydanticModel(pydantic.BaseModel): + ... def test_response_parse_mismatched_basemodel(client: OnebusawaySDK) -> None: diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 1f6e80a..c6438ff 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,19 +9,24 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): ... +class BaseGeneric(Generic[_T]): + ... -class SubclassGeneric(BaseGeneric[_T]): ... +class SubclassGeneric(BaseGeneric[_T]): + ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): + ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): + ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): + ... def test_extract_type_var() -> None: From d80d795cf0dfce32a27986630065fcf3f93a0eaa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:45:01 +0000 Subject: [PATCH 003/397] feat(api): OpenAPI spec update via Stainless API (#43) --- .stats.yml | 2 +- .../types/agencies_with_coverage_retrieve_response.py | 2 +- src/onebusaway/types/agency_retrieve_response.py | 2 +- src/onebusaway/types/arrival_and_departure_list_response.py | 2 +- src/onebusaway/types/arrival_and_departure_retrieve_response.py | 2 +- src/onebusaway/types/config_retrieve_response.py | 2 +- src/onebusaway/types/current_time_retrieve_response.py | 2 +- src/onebusaway/types/route_retrieve_response.py | 2 +- src/onebusaway/types/schedule_for_stop_retrieve_response.py | 2 +- src/onebusaway/types/stop_ids_for_agency_list_response.py | 2 +- src/onebusaway/types/stop_retrieve_response.py | 2 +- src/onebusaway/types/stops_for_location_retrieve_response.py | 2 +- src/onebusaway/types/trip_detail_retrieve_response.py | 2 +- src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 2 +- src/onebusaway/types/trip_retrieve_response.py | 2 +- src/onebusaway/types/trips_for_location_retrieve_response.py | 2 +- src/onebusaway/types/vehicles_for_agency_list_response.py | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.stats.yml b/.stats.yml index cce1cfa..bde8699 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 17 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-261df351536029839245955df4df7341de315fe2b1d1d6aeb063eaef62bcddc9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b3ce4adf9802981762637faaf11e9f3a1805de9b86da2c1afaa464ff17899d16.yml diff --git a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py index 6a54093..d4db507 100644 --- a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py +++ b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py @@ -36,4 +36,4 @@ class AgenciesWithCoverageRetrieveResponseData(BaseModel): class AgenciesWithCoverageRetrieveResponse(ResponseWrapper): - data: Optional[AgenciesWithCoverageRetrieveResponseData] = None + data: AgenciesWithCoverageRetrieveResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index bec686c..06000e6 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -42,4 +42,4 @@ class AgencyRetrieveResponseData(BaseModel): class AgencyRetrieveResponse(ResponseWrapper): - data: Optional[AgencyRetrieveResponseData] = None + data: AgencyRetrieveResponseData diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 84eb767..362df0d 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -278,4 +278,4 @@ class ArrivalAndDepartureListResponseData(BaseModel): class ArrivalAndDepartureListResponse(ResponseWrapper): - data: Optional[ArrivalAndDepartureListResponseData] = None + data: ArrivalAndDepartureListResponseData diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index 723eec7..b9a7507 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -271,4 +271,4 @@ class ArrivalAndDepartureRetrieveResponseData(BaseModel): class ArrivalAndDepartureRetrieveResponse(ResponseWrapper): - data: Optional[ArrivalAndDepartureRetrieveResponseData] = None + data: ArrivalAndDepartureRetrieveResponseData diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index fb24ae4..eaa7cf9 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -79,4 +79,4 @@ class ConfigRetrieveResponseData(BaseModel): class ConfigRetrieveResponse(ResponseWrapper): - data: Optional[ConfigRetrieveResponseData] = None + data: ConfigRetrieveResponseData diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 0f0ad3b..20fddb2 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -24,4 +24,4 @@ class CurrentTimeRetrieveResponseData(BaseModel): class CurrentTimeRetrieveResponse(ResponseWrapper): - data: Optional[CurrentTimeRetrieveResponseData] = None + data: CurrentTimeRetrieveResponseData diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index cf07d4a..7a153e8 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -38,4 +38,4 @@ class RouteRetrieveResponseData(BaseModel): class RouteRetrieveResponse(ResponseWrapper): - data: Optional[RouteRetrieveResponseData] = None + data: RouteRetrieveResponseData diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py index 5170464..83d1985 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -86,4 +86,4 @@ class ScheduleForStopRetrieveResponseData(BaseModel): class ScheduleForStopRetrieveResponse(ResponseWrapper): - data: Optional[ScheduleForStopRetrieveResponseData] = None + data: ScheduleForStopRetrieveResponseData diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index bf3927c..f36b63f 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -20,4 +20,4 @@ class StopIDsForAgencyListResponseData(BaseModel): class StopIDsForAgencyListResponse(ResponseWrapper): - data: Optional[StopIDsForAgencyListResponseData] = None + data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 8d71183..105a50c 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -42,4 +42,4 @@ class StopRetrieveResponseData(BaseModel): class StopRetrieveResponse(ResponseWrapper): - data: Optional[StopRetrieveResponseData] = None + data: StopRetrieveResponseData diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_retrieve_response.py index 3612168..6704d6e 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_retrieve_response.py @@ -48,4 +48,4 @@ class StopsForLocationRetrieveResponseData(BaseModel): class StopsForLocationRetrieveResponse(ResponseWrapper): - data: Optional[StopsForLocationRetrieveResponseData] = None + data: StopsForLocationRetrieveResponseData diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 24f2152..d750fe0 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -185,4 +185,4 @@ class TripDetailRetrieveResponseData(BaseModel): class TripDetailRetrieveResponse(ResponseWrapper): - data: Optional[TripDetailRetrieveResponseData] = None + data: TripDetailRetrieveResponseData diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 90a6ff8..42fa05e 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -185,4 +185,4 @@ class TripForVehicleRetrieveResponseData(BaseModel): class TripForVehicleRetrieveResponse(ResponseWrapper): - data: Optional[TripForVehicleRetrieveResponseData] = None + data: TripForVehicleRetrieveResponseData diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 92c8546..e939f2f 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -42,4 +42,4 @@ class TripRetrieveResponseData(BaseModel): class TripRetrieveResponse(ResponseWrapper): - data: Optional[TripRetrieveResponseData] = None + data: TripRetrieveResponseData diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 237c30c..0864e6d 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -38,4 +38,4 @@ class TripsForLocationRetrieveResponseData(BaseModel): class TripsForLocationRetrieveResponse(ResponseWrapper): - data: Optional[TripsForLocationRetrieveResponseData] = None + data: TripsForLocationRetrieveResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index f61596d..8675eda 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -174,4 +174,4 @@ class VehiclesForAgencyListResponseData(BaseModel): class VehiclesForAgencyListResponse(ResponseWrapper): - data: Optional[VehiclesForAgencyListResponseData] = None + data: VehiclesForAgencyListResponseData From aaccc2917f63dfc429ce74682892693e4d12b9b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:45:18 +0000 Subject: [PATCH 004/397] release: 0.1.0-alpha.11 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b005e5..ee49ac2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.10" + ".": "0.1.0-alpha.11" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fcfe2..a7fb75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.1.0-alpha.11 (2024-08-01) + +Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#43](https://github.com/OneBusAway/python-sdk/issues/43)) ([d80d795](https://github.com/OneBusAway/python-sdk/commit/d80d795cf0dfce32a27986630065fcf3f93a0eaa)) +* chore: Refactor code by removing unnecessary blank lines ([9dfffd8](https://github.com/OneBusAway/python-sdk/commit/9dfffd881f9bbe738a2af883ef1dae8db68c7eb7)) +* various codegen changes ([1cba822](https://github.com/OneBusAway/python-sdk/commit/1cba822390c0a6e2c2d8f3f9e101215a1abc22cc)) + ## 0.1.0-alpha.10 (2024-07-31) Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10) diff --git a/pyproject.toml b/pyproject.toml index 6db0b9e..c33aaf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.10" +version = "0.1.0-alpha.11" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ffc4f0c..9189dbc 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.10" # x-release-please-version +__version__ = "0.1.0-alpha.11" # x-release-please-version From 70461d8b097ae0ec821f06871818b3a0b1271921 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 06:55:06 +0300 Subject: [PATCH 005/397] chore: Remove unnecessary API key comment in stops_for_location.py --- examples/stops_for_location.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 3a8ecc3..8635c38 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -17,7 +17,6 @@ oba = OnebusawaySDK(**settings) space_needle_stops = oba.stops_for_location.retrieve( - key="TEST", # TODO FIXME: I shouldn't have to specify the API key here. lat=47.6205, lon=-122.3493, ) From c79102d2c079e23c77dd4583485b967cf8eaddc1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:57:49 +0000 Subject: [PATCH 006/397] feat(api): OpenAPI spec update via Stainless API (#44) --- .stats.yml | 2 +- src/onebusaway/types/shared/references.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index bde8699..530ad67 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 17 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b3ce4adf9802981762637faaf11e9f3a1805de9b86da2c1afaa464ff17899d16.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-2f06829fbda889b14e1a2adc5f3bf80df5ca926d166ef9ff487a132080fc6437.yml diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 827d72a..cb39a86 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -257,14 +257,14 @@ class Trip(BaseModel): class References(BaseModel): - agencies: Optional[List[Agency]] = None + agencies: List[Agency] - routes: Optional[List[Route]] = None + routes: List[Route] - situations: Optional[List[Situation]] = None + situations: List[Situation] - stops: Optional[List[Stop]] = None + stops: List[Stop] - stop_times: Optional[List[StopTime]] = FieldInfo(alias="stopTimes", default=None) + stop_times: List[StopTime] = FieldInfo(alias="stopTimes") - trips: Optional[List[Trip]] = None + trips: List[Trip] From dddd42142c02d44635e2c38fcc040e06d1c87414 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 03:58:03 +0000 Subject: [PATCH 007/397] release: 0.1.0-alpha.11 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 11 +++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b005e5..ee49ac2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.10" + ".": "0.1.0-alpha.11" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fcfe2..124dc2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.1.0-alpha.11 (2024-08-01) + +Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#43](https://github.com/OneBusAway/python-sdk/issues/43)) ([d80d795](https://github.com/OneBusAway/python-sdk/commit/d80d795cf0dfce32a27986630065fcf3f93a0eaa)) +* **api:** OpenAPI spec update via Stainless API ([#44](https://github.com/OneBusAway/python-sdk/issues/44)) ([c79102d](https://github.com/OneBusAway/python-sdk/commit/c79102d2c079e23c77dd4583485b967cf8eaddc1)) +* chore: Refactor code by removing unnecessary blank lines ([9dfffd8](https://github.com/OneBusAway/python-sdk/commit/9dfffd881f9bbe738a2af883ef1dae8db68c7eb7)) +* various codegen changes ([1cba822](https://github.com/OneBusAway/python-sdk/commit/1cba822390c0a6e2c2d8f3f9e101215a1abc22cc)) + ## 0.1.0-alpha.10 (2024-07-31) Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10) diff --git a/pyproject.toml b/pyproject.toml index 6db0b9e..c33aaf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.10" +version = "0.1.0-alpha.11" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ffc4f0c..9189dbc 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.10" # x-release-please-version +__version__ = "0.1.0-alpha.11" # x-release-please-version From 138c1c35902a68e251796e4713fcfeb609fb2592 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:09:35 +0000 Subject: [PATCH 008/397] feat(api): OpenAPI spec update via Stainless API (#45) --- .stats.yml | 2 +- .../stops_for_location_retrieve_response.py | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index 530ad67..0915939 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 17 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-2f06829fbda889b14e1a2adc5f3bf80df5ca926d166ef9ff487a132080fc6437.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e1da29690ebfb4c6c07ede3d292a4f6babcd2202d6f3bb38bfa287ae04dfeb50.yml diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_retrieve_response.py index 6704d6e..628b246 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_retrieve_response.py @@ -16,36 +16,36 @@ class StopsForLocationRetrieveResponseDataList(BaseModel): - id: Optional[str] = None + id: str - code: Optional[str] = None + lat: float - direction: Optional[str] = None + lon: float - lat: Optional[float] = None + name: str - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + parent: str - lon: Optional[float] = None + route_ids: List[str] = FieldInfo(alias="routeIds") - name: Optional[str] = None + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - parent: Optional[str] = None + code: Optional[str] = None - route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + direction: Optional[str] = None - static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) class StopsForLocationRetrieveResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[StopsForLocationRetrieveResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class StopsForLocationRetrieveResponse(ResponseWrapper): data: StopsForLocationRetrieveResponseData From 865b96be32373e572db8064ad76891d391b5b7b4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:09:49 +0000 Subject: [PATCH 009/397] release: 0.1.0-alpha.11 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 12 ++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b005e5..ee49ac2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.10" + ".": "0.1.0-alpha.11" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fcfe2..8f5d1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.1.0-alpha.11 (2024-08-01) + +Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#43](https://github.com/OneBusAway/python-sdk/issues/43)) ([d80d795](https://github.com/OneBusAway/python-sdk/commit/d80d795cf0dfce32a27986630065fcf3f93a0eaa)) +* **api:** OpenAPI spec update via Stainless API ([#44](https://github.com/OneBusAway/python-sdk/issues/44)) ([c79102d](https://github.com/OneBusAway/python-sdk/commit/c79102d2c079e23c77dd4583485b967cf8eaddc1)) +* **api:** OpenAPI spec update via Stainless API ([#45](https://github.com/OneBusAway/python-sdk/issues/45)) ([138c1c3](https://github.com/OneBusAway/python-sdk/commit/138c1c35902a68e251796e4713fcfeb609fb2592)) +* chore: Refactor code by removing unnecessary blank lines ([9dfffd8](https://github.com/OneBusAway/python-sdk/commit/9dfffd881f9bbe738a2af883ef1dae8db68c7eb7)) +* various codegen changes ([1cba822](https://github.com/OneBusAway/python-sdk/commit/1cba822390c0a6e2c2d8f3f9e101215a1abc22cc)) + ## 0.1.0-alpha.10 (2024-07-31) Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10) diff --git a/pyproject.toml b/pyproject.toml index 6db0b9e..c33aaf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.10" +version = "0.1.0-alpha.11" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ffc4f0c..9189dbc 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.10" # x-release-please-version +__version__ = "0.1.0-alpha.11" # x-release-please-version From 530a7993f6bdf1d7e6e128d03f25b3b624686537 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 07:13:18 +0300 Subject: [PATCH 010/397] chore: Remove unnecessary API key comment in stops_for_location.py --- examples/stops_for_location.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 8635c38..649bc9e 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -1,8 +1,10 @@ + from helpers.load_env import load_settings from onebusaway import OnebusawaySDK + # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. From 894b9f30e7a3adf8f24b7ab934cf4399df765c21 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 07:30:14 +0300 Subject: [PATCH 011/397] chore: format the code --- src/onebusaway/_base_client.py | 63 +++++++++++---------------------- src/onebusaway/_files.py | 12 +++---- src/onebusaway/_response.py | 12 +++---- src/onebusaway/_types.py | 9 ++--- src/onebusaway/_utils/_proxy.py | 3 +- src/onebusaway/_utils/_utils.py | 18 ++++------ tests/test_deepcopy.py | 3 +- tests/test_response.py | 12 +++---- tests/test_utils/test_typing.py | 15 +++----- 9 files changed, 49 insertions(+), 98 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index d17404e..ae4d8a0 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -124,16 +124,14 @@ def __init__( self, *, url: URL, - ) -> None: - ... + ) -> None: ... @overload def __init__( self, *, params: Query, - ) -> None: - ... + ) -> None: ... def __init__( self, @@ -166,8 +164,7 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: - ... + def next_page_info(self) -> Optional[PageInfo]: ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -903,8 +900,7 @@ def request( *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def request( @@ -914,8 +910,7 @@ def request( remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def request( @@ -926,8 +921,7 @@ def request( *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def request( self, @@ -1152,8 +1146,7 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def get( @@ -1164,8 +1157,7 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def get( @@ -1176,8 +1168,7 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def get( self, @@ -1203,8 +1194,7 @@ def post( options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def post( @@ -1217,8 +1207,7 @@ def post( files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def post( @@ -1231,8 +1220,7 @@ def post( files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def post( self, @@ -1465,8 +1453,7 @@ async def request( *, stream: Literal[False] = False, remaining_retries: Optional[int] = None, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def request( @@ -1477,8 +1464,7 @@ async def request( stream: Literal[True], stream_cls: type[_AsyncStreamT], remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def request( @@ -1489,8 +1475,7 @@ async def request( stream: bool, stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def request( self, @@ -1701,8 +1686,7 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def get( @@ -1713,8 +1697,7 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def get( @@ -1725,8 +1708,7 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def get( self, @@ -1750,8 +1732,7 @@ async def post( files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def post( @@ -1764,8 +1745,7 @@ async def post( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def post( @@ -1778,8 +1758,7 @@ async def post( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def post( self, diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 0d2022a..715cc20 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -39,13 +39,11 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: @overload -def to_httpx_files(files: None) -> None: - ... +def to_httpx_files(files: None) -> None: ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -83,13 +81,11 @@ def _read_file_content(file: FileContent) -> HttpxFileContent: @overload -async def async_to_httpx_files(files: None) -> None: - ... +async def async_to_httpx_files(files: None) -> None: ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 40d4fb2..e29a7d3 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -257,12 +257,10 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): @overload - def parse(self, *, to: type[_T]) -> _T: - ... + def parse(self, *, to: type[_T]) -> _T: ... @overload - def parse(self) -> R: - ... + def parse(self) -> R: ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -361,12 +359,10 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): @overload - async def parse(self, *, to: type[_T]) -> _T: - ... + async def parse(self, *, to: type[_T]) -> _T: ... @overload - async def parse(self) -> R: - ... + async def parse(self) -> R: ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 66ec7fc..f554261 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -111,8 +111,7 @@ class NotGiven: For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... get(timeout=1) # 1s timeout @@ -162,16 +161,14 @@ def build( *, response: Response, data: object, - ) -> _T: - ... + ) -> _T: ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: - ... + def get(self, __key: str) -> str | None: ... HeadersLike = Union[Headers, HeadersLikeProtocol] diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index c46a62a..ffd883e 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -59,5 +59,4 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: - ... + def __load__(self) -> T: ... diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 34797c2..2fc5a1c 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -211,20 +211,17 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: - ... + def foo(*, a: str) -> str: ... @overload - def foo(*, b: bool) -> str: - ... + def foo(*, b: bool) -> str: ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: - ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... ``` """ @@ -286,18 +283,15 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: - ... +def strip_not_given(obj: None) -> None: ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: - ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... @overload -def strip_not_given(obj: object) -> object: - ... +def strip_not_given(obj: object) -> object: ... def strip_not_given(obj: object | None) -> object: diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 519c9b1..5da235a 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,8 +41,7 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: - ... +class MyObject: ... def test_ignores_other_types() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 9e02d05..df94f16 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -19,16 +19,13 @@ from onebusaway._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): - ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... -class ConcreteAPIResponse(APIResponse[List[str]]): - ... +class ConcreteAPIResponse(APIResponse[List[str]]): ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): - ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... def test_extract_response_type_direct_classes() -> None: @@ -56,8 +53,7 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): - ... +class PydanticModel(pydantic.BaseModel): ... def test_response_parse_mismatched_basemodel(client: OnebusawaySDK) -> None: diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index c6438ff..1f6e80a 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,24 +9,19 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): - ... +class BaseGeneric(Generic[_T]): ... -class SubclassGeneric(BaseGeneric[_T]): - ... +class SubclassGeneric(BaseGeneric[_T]): ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): - ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): - ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): - ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... def test_extract_type_var() -> None: From 669433848d98f71c9761e0db346cf6d62449c90c Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 07:30:19 +0300 Subject: [PATCH 012/397] chore: Refactor _compat.py to use simplified GenericModel class --- src/onebusaway/_compat.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index c919b5a..7c6f91a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -159,22 +159,19 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: if PYDANTIC_V2: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: import pydantic.generics - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): - ... + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... # cached properties @@ -193,26 +190,21 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: - ... + def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: - ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: - ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: - ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: - ... + def __set__(self, instance: object, value: _T) -> None: ... else: try: from functools import cached_property as cached_property From a786c068e35ab1de354f6b2d43b4f4de80b176e1 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 07:48:36 +0300 Subject: [PATCH 013/397] chore: Add type hint to route variable in stops_for_location.py --- examples/stops_for_location.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 649bc9e..3107024 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -1,9 +1,8 @@ - - from helpers.load_env import load_settings from onebusaway import OnebusawaySDK +from typing import Any # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and @@ -36,7 +35,8 @@ print(" Routes:") for route_id in stop.route_ids: - route = reference_map[route_id] + # TODO: add type to route + route: Any = reference_map[route_id] # Get a string that looks like "D Line - Blue Ridge/Crown Hill - Ballard - Downtown Seattle" description = [route.null_safe_short_name, route.description] From dbbc76d7e13363b8a6ed9d0ce95b9ce5e9be835a Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 07:55:24 +0300 Subject: [PATCH 014/397] chore: Add type hint to route variable in stops_for_location.py --- examples/stops_for_location.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 3107024..a92c96e 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -1,9 +1,9 @@ +from typing import Any + from helpers.load_env import load_settings from onebusaway import OnebusawaySDK -from typing import Any - # Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. From 71191c5aa7d260517746d9a08d1ebb586c11c74e Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 13:06:05 +0300 Subject: [PATCH 015/397] chore: fornat code --- src/onebusaway/_base_client.py | 63 +++++++++++---------------------- src/onebusaway/_compat.py | 24 +++++-------- src/onebusaway/_files.py | 12 +++---- src/onebusaway/_response.py | 12 +++---- src/onebusaway/_types.py | 9 ++--- src/onebusaway/_utils/_proxy.py | 3 +- src/onebusaway/_utils/_utils.py | 18 ++++------ tests/test_deepcopy.py | 3 +- tests/test_response.py | 12 +++---- tests/test_utils/test_typing.py | 15 +++----- 10 files changed, 57 insertions(+), 114 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index d17404e..ae4d8a0 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -124,16 +124,14 @@ def __init__( self, *, url: URL, - ) -> None: - ... + ) -> None: ... @overload def __init__( self, *, params: Query, - ) -> None: - ... + ) -> None: ... def __init__( self, @@ -166,8 +164,7 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: - ... + def next_page_info(self) -> Optional[PageInfo]: ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -903,8 +900,7 @@ def request( *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def request( @@ -914,8 +910,7 @@ def request( remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def request( @@ -926,8 +921,7 @@ def request( *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def request( self, @@ -1152,8 +1146,7 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def get( @@ -1164,8 +1157,7 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def get( @@ -1176,8 +1168,7 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def get( self, @@ -1203,8 +1194,7 @@ def post( options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def post( @@ -1217,8 +1207,7 @@ def post( files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def post( @@ -1231,8 +1220,7 @@ def post( files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def post( self, @@ -1465,8 +1453,7 @@ async def request( *, stream: Literal[False] = False, remaining_retries: Optional[int] = None, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def request( @@ -1477,8 +1464,7 @@ async def request( stream: Literal[True], stream_cls: type[_AsyncStreamT], remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def request( @@ -1489,8 +1475,7 @@ async def request( stream: bool, stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def request( self, @@ -1701,8 +1686,7 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def get( @@ -1713,8 +1697,7 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def get( @@ -1725,8 +1708,7 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def get( self, @@ -1750,8 +1732,7 @@ async def post( files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def post( @@ -1764,8 +1745,7 @@ async def post( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def post( @@ -1778,8 +1758,7 @@ async def post( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def post( self, diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index c919b5a..7c6f91a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -159,22 +159,19 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: if PYDANTIC_V2: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: import pydantic.generics - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): - ... + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... # cached properties @@ -193,26 +190,21 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: - ... + def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: - ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: - ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: - ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: - ... + def __set__(self, instance: object, value: _T) -> None: ... else: try: from functools import cached_property as cached_property diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 0d2022a..715cc20 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -39,13 +39,11 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: @overload -def to_httpx_files(files: None) -> None: - ... +def to_httpx_files(files: None) -> None: ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -83,13 +81,11 @@ def _read_file_content(file: FileContent) -> HttpxFileContent: @overload -async def async_to_httpx_files(files: None) -> None: - ... +async def async_to_httpx_files(files: None) -> None: ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 40d4fb2..e29a7d3 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -257,12 +257,10 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): @overload - def parse(self, *, to: type[_T]) -> _T: - ... + def parse(self, *, to: type[_T]) -> _T: ... @overload - def parse(self) -> R: - ... + def parse(self) -> R: ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -361,12 +359,10 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): @overload - async def parse(self, *, to: type[_T]) -> _T: - ... + async def parse(self, *, to: type[_T]) -> _T: ... @overload - async def parse(self) -> R: - ... + async def parse(self) -> R: ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 66ec7fc..f554261 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -111,8 +111,7 @@ class NotGiven: For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... get(timeout=1) # 1s timeout @@ -162,16 +161,14 @@ def build( *, response: Response, data: object, - ) -> _T: - ... + ) -> _T: ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: - ... + def get(self, __key: str) -> str | None: ... HeadersLike = Union[Headers, HeadersLikeProtocol] diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index c46a62a..ffd883e 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -59,5 +59,4 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: - ... + def __load__(self) -> T: ... diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 34797c2..2fc5a1c 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -211,20 +211,17 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: - ... + def foo(*, a: str) -> str: ... @overload - def foo(*, b: bool) -> str: - ... + def foo(*, b: bool) -> str: ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: - ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... ``` """ @@ -286,18 +283,15 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: - ... +def strip_not_given(obj: None) -> None: ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: - ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... @overload -def strip_not_given(obj: object) -> object: - ... +def strip_not_given(obj: object) -> object: ... def strip_not_given(obj: object | None) -> object: diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 519c9b1..5da235a 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,8 +41,7 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: - ... +class MyObject: ... def test_ignores_other_types() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 9e02d05..df94f16 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -19,16 +19,13 @@ from onebusaway._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): - ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... -class ConcreteAPIResponse(APIResponse[List[str]]): - ... +class ConcreteAPIResponse(APIResponse[List[str]]): ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): - ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... def test_extract_response_type_direct_classes() -> None: @@ -56,8 +53,7 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): - ... +class PydanticModel(pydantic.BaseModel): ... def test_response_parse_mismatched_basemodel(client: OnebusawaySDK) -> None: diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index c6438ff..1f6e80a 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,24 +9,19 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): - ... +class BaseGeneric(Generic[_T]): ... -class SubclassGeneric(BaseGeneric[_T]): - ... +class SubclassGeneric(BaseGeneric[_T]): ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): - ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): - ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): - ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... def test_extract_type_var() -> None: From 7ae6416618afee7a51193f85fd1bc2095b502426 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 13:06:34 +0300 Subject: [PATCH 016/397] chore: Fix typo in stops_for_location.py --- examples/stops_for_location.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 998e48b..dbd53eb 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -4,9 +4,7 @@ from onebusaway import OnebusawaySDK -from onebusaway import OnebusawaySDK - -# Load settings from .env file, if it exists. If not, we'll use the +# Load settings from .en`v file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. settings = load_settings( From 3ff6d559611d5ae4f0e90a06179bf20a7b0be410 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 14:44:01 +0300 Subject: [PATCH 017/397] chore: code format --- src/onebusaway/_base_client.py | 63 ++++++++++++++++++++++----------- src/onebusaway/_compat.py | 24 ++++++++----- src/onebusaway/_files.py | 12 ++++--- src/onebusaway/_response.py | 12 ++++--- src/onebusaway/_types.py | 9 +++-- src/onebusaway/_utils/_proxy.py | 3 +- src/onebusaway/_utils/_utils.py | 18 ++++++---- tests/test_deepcopy.py | 3 +- tests/test_response.py | 12 ++++--- tests/test_utils/test_typing.py | 15 +++++--- 10 files changed, 114 insertions(+), 57 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index ae4d8a0..d17404e 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -124,14 +124,16 @@ def __init__( self, *, url: URL, - ) -> None: ... + ) -> None: + ... @overload def __init__( self, *, params: Query, - ) -> None: ... + ) -> None: + ... def __init__( self, @@ -164,7 +166,8 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: ... + def next_page_info(self) -> Optional[PageInfo]: + ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -900,7 +903,8 @@ def request( *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def request( @@ -910,7 +914,8 @@ def request( remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def request( @@ -921,7 +926,8 @@ def request( *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def request( self, @@ -1146,7 +1152,8 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def get( @@ -1157,7 +1164,8 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def get( @@ -1168,7 +1176,8 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def get( self, @@ -1194,7 +1203,8 @@ def post( options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload def post( @@ -1207,7 +1217,8 @@ def post( files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: ... + ) -> _StreamT: + ... @overload def post( @@ -1220,7 +1231,8 @@ def post( files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: ... + ) -> ResponseT | _StreamT: + ... def post( self, @@ -1453,7 +1465,8 @@ async def request( *, stream: Literal[False] = False, remaining_retries: Optional[int] = None, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def request( @@ -1464,7 +1477,8 @@ async def request( stream: Literal[True], stream_cls: type[_AsyncStreamT], remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def request( @@ -1475,7 +1489,8 @@ async def request( stream: bool, stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def request( self, @@ -1686,7 +1701,8 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def get( @@ -1697,7 +1713,8 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def get( @@ -1708,7 +1725,8 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def get( self, @@ -1732,7 +1750,8 @@ async def post( files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: ... + ) -> ResponseT: + ... @overload async def post( @@ -1745,7 +1764,8 @@ async def post( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: ... + ) -> _AsyncStreamT: + ... @overload async def post( @@ -1758,7 +1778,8 @@ async def post( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: ... + ) -> ResponseT | _AsyncStreamT: + ... async def post( self, diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 7c6f91a..c919b5a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -159,19 +159,22 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): ... + class GenericModel(pydantic.BaseModel): + ... else: if PYDANTIC_V2: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): ... + class GenericModel(pydantic.BaseModel): + ... else: import pydantic.generics - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): + ... # cached properties @@ -190,21 +193,26 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: ... + def __init__(self, func: Callable[[Any], _T]) -> None: + ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: + ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: + ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: ... + def __set_name__(self, owner: type[Any], name: str) -> None: + ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: ... + def __set__(self, instance: object, value: _T) -> None: + ... else: try: from functools import cached_property as cached_property diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 715cc20..0d2022a 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -39,11 +39,13 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: @overload -def to_httpx_files(files: None) -> None: ... +def to_httpx_files(files: None) -> None: + ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: + ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -81,11 +83,13 @@ def _read_file_content(file: FileContent) -> HttpxFileContent: @overload -async def async_to_httpx_files(files: None) -> None: ... +async def async_to_httpx_files(files: None) -> None: + ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: + ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index e29a7d3..40d4fb2 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -257,10 +257,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): @overload - def parse(self, *, to: type[_T]) -> _T: ... + def parse(self, *, to: type[_T]) -> _T: + ... @overload - def parse(self) -> R: ... + def parse(self) -> R: + ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -359,10 +361,12 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): @overload - async def parse(self, *, to: type[_T]) -> _T: ... + async def parse(self, *, to: type[_T]) -> _T: + ... @overload - async def parse(self) -> R: ... + async def parse(self) -> R: + ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index f554261..66ec7fc 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -111,7 +111,8 @@ class NotGiven: For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: + ... get(timeout=1) # 1s timeout @@ -161,14 +162,16 @@ def build( *, response: Response, data: object, - ) -> _T: ... + ) -> _T: + ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: ... + def get(self, __key: str) -> str | None: + ... HeadersLike = Union[Headers, HeadersLikeProtocol] diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index ffd883e..c46a62a 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -59,4 +59,5 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: ... + def __load__(self) -> T: + ... diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 2fc5a1c..34797c2 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -211,17 +211,20 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: ... + def foo(*, a: str) -> str: + ... @overload - def foo(*, b: bool) -> str: ... + def foo(*, b: bool) -> str: + ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: + ... ``` """ @@ -283,15 +286,18 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: ... +def strip_not_given(obj: None) -> None: + ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: + ... @overload -def strip_not_given(obj: object) -> object: ... +def strip_not_given(obj: object) -> object: + ... def strip_not_given(obj: object | None) -> object: diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 5da235a..519c9b1 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,7 +41,8 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: ... +class MyObject: + ... def test_ignores_other_types() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index df94f16..9e02d05 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -19,13 +19,16 @@ from onebusaway._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): + ... -class ConcreteAPIResponse(APIResponse[List[str]]): ... +class ConcreteAPIResponse(APIResponse[List[str]]): + ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): + ... def test_extract_response_type_direct_classes() -> None: @@ -53,7 +56,8 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): ... +class PydanticModel(pydantic.BaseModel): + ... def test_response_parse_mismatched_basemodel(client: OnebusawaySDK) -> None: diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 1f6e80a..c6438ff 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,19 +9,24 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): ... +class BaseGeneric(Generic[_T]): + ... -class SubclassGeneric(BaseGeneric[_T]): ... +class SubclassGeneric(BaseGeneric[_T]): + ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): + ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): + ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): + ... def test_extract_type_var() -> None: From 0edb28938def397326d428dde2af8754fa98c156 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 14:44:09 +0300 Subject: [PATCH 018/397] chore: Add helpers module with load_env and load_settings functions --- examples/helpers/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 examples/helpers/__init__.py diff --git a/examples/helpers/__init__.py b/examples/helpers/__init__.py new file mode 100644 index 0000000..76b6e5e --- /dev/null +++ b/examples/helpers/__init__.py @@ -0,0 +1,3 @@ +from .load_env import load_env, load_settings + +__all__ = ["load_settings", "load_env"] From 4170e67ebf01253afccd144683b170d196ab3dd2 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 1 Aug 2024 14:44:13 +0300 Subject: [PATCH 019/397] Refactor stops_for_location.py for improved readability and maintainability --- examples/stops_for_location.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index dbd53eb..ea9b153 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -4,7 +4,7 @@ from onebusaway import OnebusawaySDK -# Load settings from .en`v file, if it exists. If not, we'll use the +# Load settings from .env file, if it exists. If not, we'll use the # Puget Sound server URL (which is also the default in the SDK) and # the 'TEST' API key. settings = load_settings( @@ -27,8 +27,8 @@ # make it easy to look up routes by ID. reference_map = {} -for route in references.routes: - reference_map[route.id] = route +for ref_route in references.routes: + reference_map[ref_route.id] = ref_route for stop in stops: print(f"{stop.name} ({stop.lat}, {stop.lon})") @@ -39,7 +39,7 @@ route: Any = reference_map[route_id] # Get a string that looks like "D Line - Blue Ridge/Crown Hill - Ballard - Downtown Seattle" - description = [route.null_safe_short_name, route.description] - description = [e for e in description if e] - description = " - ".join(description) - print(f" {description}") + description_list = [route.null_safe_short_name, route.description] + description_list = [e for e in description_list if e] + description_str = " - ".join(description_list) + print(f" {description_str}") From a5c305c7a5614588dd3fb14607dd2489aab8b3c6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:23:53 +0000 Subject: [PATCH 020/397] feat(api): OpenAPI spec update via Stainless API (#48) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 12 ++ src/onebusaway/resources/__init__.py | 14 ++ .../resources/route_ids_for_agency.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../route_ids_for_agency_list_response.py | 23 +++ .../test_route_ids_for_agency.py | 98 ++++++++++++ 8 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/route_ids_for_agency.py create mode 100644 src/onebusaway/types/route_ids_for_agency_list_response.py create mode 100644 tests/api_resources/test_route_ids_for_agency.py diff --git a/.stats.yml b/.stats.yml index 0915939..f38736f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 17 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e1da29690ebfb4c6c07ede3d292a4f6babcd2202d6f3bb38bfa287ae04dfeb50.yml +configured_endpoints: 18 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-745fc14b503259d6b0d29d50d4277b86cada74faf6f831bb19710d2e7ead8a7c.yml diff --git a/api.md b/api.md index 8404d9c..1aa1c4c 100644 --- a/api.md +++ b/api.md @@ -136,6 +136,18 @@ Methods: - client.route.retrieve(route_id) -> RouteRetrieveResponse +# RouteIDsForAgency + +Types: + +```python +from onebusaway.types import RouteIDsForAgencyListResponse +``` + +Methods: + +- client.route_ids_for_agency.list(agency_id) -> RouteIDsForAgencyListResponse + # ArrivalAndDeparture Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 4d0abe9..12680ce 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -57,6 +57,7 @@ class OnebusawaySDK(SyncAPIClient): stop_ids_for_agency: resources.StopIDsForAgencyResource schedule_for_stop: resources.ScheduleForStopResource route: resources.RouteResource + route_ids_for_agency: resources.RouteIDsForAgencyResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource trips_for_location: resources.TripsForLocationResource @@ -130,6 +131,7 @@ def __init__( self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self) self.schedule_for_stop = resources.ScheduleForStopResource(self) self.route = resources.RouteResource(self) + self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) self.trips_for_location = resources.TripsForLocationResource(self) @@ -263,6 +265,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource schedule_for_stop: resources.AsyncScheduleForStopResource route: resources.AsyncRouteResource + route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource trips_for_location: resources.AsyncTripsForLocationResource @@ -336,6 +339,7 @@ def __init__( self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self) self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) self.route = resources.AsyncRouteResource(self) + self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) self.trips_for_location = resources.AsyncTripsForLocationResource(self) @@ -472,6 +476,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithRawResponse(client.route) + self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) @@ -494,6 +499,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) + self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure ) @@ -518,6 +524,9 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithStreamingResponse(client.route) + self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithStreamingResponse( + client.route_ids_for_agency + ) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) @@ -548,6 +557,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route) + self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithStreamingResponse( + client.route_ids_for_agency + ) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 48fb9f8..53d412c 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -112,6 +112,14 @@ VehiclesForAgencyResourceWithStreamingResponse, AsyncVehiclesForAgencyResourceWithStreamingResponse, ) +from .route_ids_for_agency import ( + RouteIDsForAgencyResource, + AsyncRouteIDsForAgencyResource, + RouteIDsForAgencyResourceWithRawResponse, + AsyncRouteIDsForAgencyResourceWithRawResponse, + RouteIDsForAgencyResourceWithStreamingResponse, + AsyncRouteIDsForAgencyResourceWithStreamingResponse, +) from .arrival_and_departure import ( ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource, @@ -196,6 +204,12 @@ "AsyncRouteResourceWithRawResponse", "RouteResourceWithStreamingResponse", "AsyncRouteResourceWithStreamingResponse", + "RouteIDsForAgencyResource", + "AsyncRouteIDsForAgencyResource", + "RouteIDsForAgencyResourceWithRawResponse", + "AsyncRouteIDsForAgencyResourceWithRawResponse", + "RouteIDsForAgencyResourceWithStreamingResponse", + "AsyncRouteIDsForAgencyResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py new file mode 100644 index 0000000..cf5ab88 --- /dev/null +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.route_ids_for_agency_list_response import RouteIDsForAgencyListResponse + +__all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] + + +class RouteIDsForAgencyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: + return RouteIDsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RouteIDsForAgencyResourceWithStreamingResponse: + return RouteIDsForAgencyResourceWithStreamingResponse(self) + + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteIDsForAgencyListResponse: + """ + Get route IDs for a specific agency + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return self._get( + f"/api/where/route-ids-for-agency/agencyID.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteIDsForAgencyListResponse, + ) + + +class AsyncRouteIDsForAgencyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: + return AsyncRouteIDsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRouteIDsForAgencyResourceWithStreamingResponse: + return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self) + + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteIDsForAgencyListResponse: + """ + Get route IDs for a specific agency + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return await self._get( + f"/api/where/route-ids-for-agency/agencyID.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RouteIDsForAgencyListResponse, + ) + + +class RouteIDsForAgencyResourceWithRawResponse: + def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: + self._route_ids_for_agency = route_ids_for_agency + + self.list = to_raw_response_wrapper( + route_ids_for_agency.list, + ) + + +class AsyncRouteIDsForAgencyResourceWithRawResponse: + def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: + self._route_ids_for_agency = route_ids_for_agency + + self.list = async_to_raw_response_wrapper( + route_ids_for_agency.list, + ) + + +class RouteIDsForAgencyResourceWithStreamingResponse: + def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: + self._route_ids_for_agency = route_ids_for_agency + + self.list = to_streamed_response_wrapper( + route_ids_for_agency.list, + ) + + +class AsyncRouteIDsForAgencyResourceWithStreamingResponse: + def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: + self._route_ids_for_agency = route_ids_for_agency + + self.list = async_to_streamed_response_wrapper( + route_ids_for_agency.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 87b7d0c..a8bf612 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -19,6 +19,7 @@ from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse +from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py new file mode 100644 index 0000000..ffe9c32 --- /dev/null +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] + + +class RouteIDsForAgencyListResponseData(BaseModel): + list: List[str] + + references: References + + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + + +class RouteIDsForAgencyListResponse(ResponseWrapper): + data: RouteIDsForAgencyListResponseData diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py new file mode 100644 index 0000000..867c19a --- /dev/null +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import RouteIDsForAgencyListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRouteIDsForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + route_ids_for_agency = client.route_ids_for_agency.list( + "agencyID", + ) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.route_ids_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route_ids_for_agency = response.parse() + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.route_ids_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route_ids_for_agency = response.parse() + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + client.route_ids_for_agency.with_raw_response.list( + "", + ) + + +class TestAsyncRouteIDsForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + route_ids_for_agency = await async_client.route_ids_for_agency.list( + "agencyID", + ) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.route_ids_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route_ids_for_agency = await response.parse() + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.route_ids_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route_ids_for_agency = await response.parse() + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + await async_client.route_ids_for_agency.with_raw_response.list( + "", + ) From 6d1fdf78cf6d63079bf037b88ac0540e619f9ae7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:26:24 +0000 Subject: [PATCH 021/397] chore(internal): bump pyright (#50) --- requirements-dev.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index bc4b747..ca77645 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -71,7 +71,7 @@ pydantic-core==2.18.2 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.364 +pyright==1.1.374 pytest==7.1.1 # via pytest-asyncio pytest-asyncio==0.21.1 From 97156e5dff5d743d04ecc0dbe73ec7c690dfb4fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:26:45 +0000 Subject: [PATCH 022/397] feat(client): add `retry_count` to raw response class (#51) --- src/onebusaway/_base_client.py | 8 ++++++ src/onebusaway/_response.py | 5 ++++ tests/test_client.py | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index d17404e..a38363f 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1049,6 +1049,7 @@ def _request( response=response, stream=stream, stream_cls=stream_cls, + retries_taken=options.get_max_retries(self.max_retries) - retries, ) def _retry_request( @@ -1090,6 +1091,7 @@ def _process_response( response: httpx.Response, stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, ) -> ResponseT: origin = get_origin(cast_to) or cast_to @@ -1107,6 +1109,7 @@ def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ), ) @@ -1120,6 +1123,7 @@ def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ) if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): return cast(ResponseT, api_response) @@ -1610,6 +1614,7 @@ async def _request( response=response, stream=stream, stream_cls=stream_cls, + retries_taken=options.get_max_retries(self.max_retries) - retries, ) async def _retry_request( @@ -1649,6 +1654,7 @@ async def _process_response( response: httpx.Response, stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, ) -> ResponseT: origin = get_origin(cast_to) or cast_to @@ -1666,6 +1672,7 @@ async def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ), ) @@ -1679,6 +1686,7 @@ async def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ) if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): return cast(ResponseT, api_response) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 40d4fb2..c0ca840 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -55,6 +55,9 @@ class BaseAPIResponse(Generic[R]): http_response: httpx.Response + retries_taken: int + """The number of retries made. If no retries happened this will be `0`""" + def __init__( self, *, @@ -64,6 +67,7 @@ def __init__( stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, options: FinalRequestOptions, + retries_taken: int = 0, ) -> None: self._cast_to = cast_to self._client = client @@ -72,6 +76,7 @@ def __init__( self._stream_cls = stream_cls self._options = options self.http_response = raw + self.retries_taken = retries_taken @property def headers(self) -> httpx.Headers: diff --git a/tests/test_client.py b/tests/test_client.py index a099efe..a68fac1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -734,6 +734,27 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non assert _get_open_connections(self.client) == 0 + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retries_taken(self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = client.current_time.with_raw_response.retrieve() + + assert response.retries_taken == failures_before_success + class TestAsyncOnebusawaySDK: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -1423,3 +1444,27 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) ) assert _get_open_connections(self.client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_retries_taken( + self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = await client.current_time.with_raw_response.retrieve() + + assert response.retries_taken == failures_before_success From f3b7cb00c4302b0ac1b8497835f2db0d3f9e7949 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:27:31 +0000 Subject: [PATCH 023/397] chore(internal): test updates (#52) --- src/onebusaway/_utils/_reflection.py | 2 +- tests/utils.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/onebusaway/_utils/_reflection.py b/src/onebusaway/_utils/_reflection.py index 9a53c7b..89aa712 100644 --- a/src/onebusaway/_utils/_reflection.py +++ b/src/onebusaway/_utils/_reflection.py @@ -34,7 +34,7 @@ def assert_signatures_in_sync( if custom_param.annotation != source_param.annotation: errors.append( - f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}" + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}" ) continue diff --git a/tests/utils.py b/tests/utils.py index d274fec..dd259a5 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,7 +8,7 @@ from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type -from onebusaway._types import NoneType +from onebusaway._types import Omit, NoneType from onebusaway._utils import ( is_dict, is_list, @@ -139,11 +139,15 @@ def _assert_list_type(type_: type[object], value: object) -> None: @contextlib.contextmanager -def update_env(**new_env: str) -> Iterator[None]: +def update_env(**new_env: str | Omit) -> Iterator[None]: old = os.environ.copy() try: - os.environ.update(new_env) + for name, value in new_env.items(): + if isinstance(value, Omit): + os.environ.pop(name, None) + else: + os.environ[name] = value yield None finally: From c8cbc6a1e48e42b15e42ebf40cdfd2f8fc0bc7ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:29:38 +0000 Subject: [PATCH 024/397] chore(internal): bump ruff version (#53) --- pyproject.toml | 12 ++++--- requirements-dev.lock | 2 +- src/onebusaway/_base_client.py | 63 +++++++++++---------------------- src/onebusaway/_compat.py | 24 +++++-------- src/onebusaway/_files.py | 12 +++---- src/onebusaway/_response.py | 12 +++---- src/onebusaway/_types.py | 9 ++--- src/onebusaway/_utils/_proxy.py | 3 +- src/onebusaway/_utils/_utils.py | 18 ++++------ tests/test_deepcopy.py | 3 +- tests/test_response.py | 12 +++---- tests/test_utils/test_typing.py | 15 +++----- 12 files changed, 65 insertions(+), 120 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c33aaf0..97bfdb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,8 +77,8 @@ format = { chain = [ "check:ruff", "typecheck", ]} -"check:ruff" = "ruff ." -"fix:ruff" = "ruff --fix ." +"check:ruff" = "ruff check ." +"fix:ruff" = "ruff check --fix ." typecheck = { chain = [ "typecheck:pyright", @@ -162,6 +162,11 @@ reportPrivateUsage = false line-length = 120 output-format = "grouped" target-version = "py37" + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] select = [ # isort "I", @@ -192,9 +197,6 @@ unfixable = [ ] ignore-init-module-imports = true -[tool.ruff.format] -docstring-code-format = true - [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" diff --git a/requirements-dev.lock b/requirements-dev.lock index ca77645..2acdbb2 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -81,7 +81,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.20.2 rich==13.7.1 -ruff==0.1.9 +ruff==0.5.6 setuptools==68.2.2 # via nodeenv six==1.16.0 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index a38363f..28c4797 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -124,16 +124,14 @@ def __init__( self, *, url: URL, - ) -> None: - ... + ) -> None: ... @overload def __init__( self, *, params: Query, - ) -> None: - ... + ) -> None: ... def __init__( self, @@ -166,8 +164,7 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: - ... + def next_page_info(self) -> Optional[PageInfo]: ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -903,8 +900,7 @@ def request( *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def request( @@ -914,8 +910,7 @@ def request( remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def request( @@ -926,8 +921,7 @@ def request( *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def request( self, @@ -1156,8 +1150,7 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def get( @@ -1168,8 +1161,7 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def get( @@ -1180,8 +1172,7 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def get( self, @@ -1207,8 +1198,7 @@ def post( options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def post( @@ -1221,8 +1211,7 @@ def post( files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def post( @@ -1235,8 +1224,7 @@ def post( files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def post( self, @@ -1469,8 +1457,7 @@ async def request( *, stream: Literal[False] = False, remaining_retries: Optional[int] = None, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def request( @@ -1481,8 +1468,7 @@ async def request( stream: Literal[True], stream_cls: type[_AsyncStreamT], remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def request( @@ -1493,8 +1479,7 @@ async def request( stream: bool, stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def request( self, @@ -1709,8 +1694,7 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def get( @@ -1721,8 +1705,7 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def get( @@ -1733,8 +1716,7 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def get( self, @@ -1758,8 +1740,7 @@ async def post( files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def post( @@ -1772,8 +1753,7 @@ async def post( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def post( @@ -1786,8 +1766,7 @@ async def post( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def post( self, diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index c919b5a..7c6f91a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -159,22 +159,19 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: if PYDANTIC_V2: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: import pydantic.generics - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): - ... + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... # cached properties @@ -193,26 +190,21 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: - ... + def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: - ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: - ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: - ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: - ... + def __set__(self, instance: object, value: _T) -> None: ... else: try: from functools import cached_property as cached_property diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 0d2022a..715cc20 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -39,13 +39,11 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: @overload -def to_httpx_files(files: None) -> None: - ... +def to_httpx_files(files: None) -> None: ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -83,13 +81,11 @@ def _read_file_content(file: FileContent) -> HttpxFileContent: @overload -async def async_to_httpx_files(files: None) -> None: - ... +async def async_to_httpx_files(files: None) -> None: ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index c0ca840..1191a35 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -262,12 +262,10 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): @overload - def parse(self, *, to: type[_T]) -> _T: - ... + def parse(self, *, to: type[_T]) -> _T: ... @overload - def parse(self) -> R: - ... + def parse(self) -> R: ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -366,12 +364,10 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): @overload - async def parse(self, *, to: type[_T]) -> _T: - ... + async def parse(self, *, to: type[_T]) -> _T: ... @overload - async def parse(self) -> R: - ... + async def parse(self) -> R: ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 66ec7fc..f554261 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -111,8 +111,7 @@ class NotGiven: For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... get(timeout=1) # 1s timeout @@ -162,16 +161,14 @@ def build( *, response: Response, data: object, - ) -> _T: - ... + ) -> _T: ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: - ... + def get(self, __key: str) -> str | None: ... HeadersLike = Union[Headers, HeadersLikeProtocol] diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index c46a62a..ffd883e 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -59,5 +59,4 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: - ... + def __load__(self) -> T: ... diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 34797c2..2fc5a1c 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -211,20 +211,17 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: - ... + def foo(*, a: str) -> str: ... @overload - def foo(*, b: bool) -> str: - ... + def foo(*, b: bool) -> str: ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: - ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... ``` """ @@ -286,18 +283,15 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: - ... +def strip_not_given(obj: None) -> None: ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: - ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... @overload -def strip_not_given(obj: object) -> object: - ... +def strip_not_given(obj: object) -> object: ... def strip_not_given(obj: object | None) -> object: diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 519c9b1..5da235a 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,8 +41,7 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: - ... +class MyObject: ... def test_ignores_other_types() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 9e02d05..df94f16 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -19,16 +19,13 @@ from onebusaway._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): - ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... -class ConcreteAPIResponse(APIResponse[List[str]]): - ... +class ConcreteAPIResponse(APIResponse[List[str]]): ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): - ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... def test_extract_response_type_direct_classes() -> None: @@ -56,8 +53,7 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): - ... +class PydanticModel(pydantic.BaseModel): ... def test_response_parse_mismatched_basemodel(client: OnebusawaySDK) -> None: diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index c6438ff..1f6e80a 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,24 +9,19 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): - ... +class BaseGeneric(Generic[_T]): ... -class SubclassGeneric(BaseGeneric[_T]): - ... +class SubclassGeneric(BaseGeneric[_T]): ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): - ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): - ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): - ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... def test_extract_type_var() -> None: From 1f501f0592c92e86c4c027f652a49ff11a068715 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:30:29 +0000 Subject: [PATCH 025/397] chore(internal): update pydantic compat helper function (#54) --- src/onebusaway/_compat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 7c6f91a..21fe694 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -7,7 +7,7 @@ import pydantic from pydantic.fields import FieldInfo -from ._types import StrBytesIntFloat +from ._types import IncEx, StrBytesIntFloat _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) @@ -133,17 +133,20 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: def model_dump( model: pydantic.BaseModel, *, + exclude: IncEx = None, exclude_unset: bool = False, exclude_defaults: bool = False, ) -> dict[str, Any]: if PYDANTIC_V2: return model.model_dump( + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, ), From 9adae4de96b8ea11ff8e2d7c251183580f86cf8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:04:09 +0000 Subject: [PATCH 026/397] feat(api): OpenAPI spec update via Stainless API (#55) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f38736f..b17a6c5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 18 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-745fc14b503259d6b0d29d50d4277b86cada74faf6f831bb19710d2e7ead8a7c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6579f942268e5d39432a6348fbf1eb5850e71235e72797ed78894a3329fbb25e.yml From 1882cdc8a4da9705c853ed6f5d5e8d73a4b9276c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:48:06 +0000 Subject: [PATCH 027/397] feat(api): OpenAPI spec update via Stainless API (#56) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/routes_for_agency.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/routes_for_agency_list_response.py | 45 ++++++ tests/api_resources/test_routes_for_agency.py | 98 ++++++++++++ 8 files changed, 321 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/routes_for_agency.py create mode 100644 src/onebusaway/types/routes_for_agency_list_response.py create mode 100644 tests/api_resources/test_routes_for_agency.py diff --git a/.stats.yml b/.stats.yml index b17a6c5..2f8fb74 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 18 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6579f942268e5d39432a6348fbf1eb5850e71235e72797ed78894a3329fbb25e.yml +configured_endpoints: 19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-321de3032fb9e1dd70c112bc3f172d12a36692f8fcfa2e8aec47ab6a85ca37e2.yml diff --git a/api.md b/api.md index 1aa1c4c..ff6371d 100644 --- a/api.md +++ b/api.md @@ -148,6 +148,18 @@ Methods: - client.route_ids_for_agency.list(agency_id) -> RouteIDsForAgencyListResponse +# RoutesForAgency + +Types: + +```python +from onebusaway.types import RoutesForAgencyListResponse +``` + +Methods: + +- client.routes_for_agency.list(agency_id) -> RoutesForAgencyListResponse + # ArrivalAndDeparture Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 12680ce..0103aaa 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -58,6 +58,7 @@ class OnebusawaySDK(SyncAPIClient): schedule_for_stop: resources.ScheduleForStopResource route: resources.RouteResource route_ids_for_agency: resources.RouteIDsForAgencyResource + routes_for_agency: resources.RoutesForAgencyResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource trips_for_location: resources.TripsForLocationResource @@ -132,6 +133,7 @@ def __init__( self.schedule_for_stop = resources.ScheduleForStopResource(self) self.route = resources.RouteResource(self) self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self) + self.routes_for_agency = resources.RoutesForAgencyResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) self.trips_for_location = resources.TripsForLocationResource(self) @@ -266,6 +268,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): schedule_for_stop: resources.AsyncScheduleForStopResource route: resources.AsyncRouteResource route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource + routes_for_agency: resources.AsyncRoutesForAgencyResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource trips_for_location: resources.AsyncTripsForLocationResource @@ -340,6 +343,7 @@ def __init__( self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) self.route = resources.AsyncRouteResource(self) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self) + self.routes_for_agency = resources.AsyncRoutesForAgencyResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) self.trips_for_location = resources.AsyncTripsForLocationResource(self) @@ -477,6 +481,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_agency = resources.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) @@ -500,6 +505,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure ) @@ -527,6 +533,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) + self.routes_for_agency = resources.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) @@ -560,6 +567,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) + self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 53d412c..944a791 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -72,6 +72,14 @@ TripForVehicleResourceWithStreamingResponse, AsyncTripForVehicleResourceWithStreamingResponse, ) +from .routes_for_agency import ( + RoutesForAgencyResource, + AsyncRoutesForAgencyResource, + RoutesForAgencyResourceWithRawResponse, + AsyncRoutesForAgencyResourceWithRawResponse, + RoutesForAgencyResourceWithStreamingResponse, + AsyncRoutesForAgencyResourceWithStreamingResponse, +) from .schedule_for_stop import ( ScheduleForStopResource, AsyncScheduleForStopResource, @@ -210,6 +218,12 @@ "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", + "RoutesForAgencyResource", + "AsyncRoutesForAgencyResource", + "RoutesForAgencyResourceWithRawResponse", + "AsyncRoutesForAgencyResourceWithRawResponse", + "RoutesForAgencyResourceWithStreamingResponse", + "AsyncRoutesForAgencyResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py new file mode 100644 index 0000000..637eefe --- /dev/null +++ b/src/onebusaway/resources/routes_for_agency.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.routes_for_agency_list_response import RoutesForAgencyListResponse + +__all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] + + +class RoutesForAgencyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: + return RoutesForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutesForAgencyResourceWithStreamingResponse: + return RoutesForAgencyResourceWithStreamingResponse(self) + + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForAgencyListResponse: + """ + Retrieve the list of all routes for a particular agency by id + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return self._get( + f"/api/where/routes-for-agency/agencyID.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoutesForAgencyListResponse, + ) + + +class AsyncRoutesForAgencyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: + return AsyncRoutesForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesForAgencyResourceWithStreamingResponse: + return AsyncRoutesForAgencyResourceWithStreamingResponse(self) + + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForAgencyListResponse: + """ + Retrieve the list of all routes for a particular agency by id + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return await self._get( + f"/api/where/routes-for-agency/agencyID.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoutesForAgencyListResponse, + ) + + +class RoutesForAgencyResourceWithRawResponse: + def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: + self._routes_for_agency = routes_for_agency + + self.list = to_raw_response_wrapper( + routes_for_agency.list, + ) + + +class AsyncRoutesForAgencyResourceWithRawResponse: + def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: + self._routes_for_agency = routes_for_agency + + self.list = async_to_raw_response_wrapper( + routes_for_agency.list, + ) + + +class RoutesForAgencyResourceWithStreamingResponse: + def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: + self._routes_for_agency = routes_for_agency + + self.list = to_streamed_response_wrapper( + routes_for_agency.list, + ) + + +class AsyncRoutesForAgencyResourceWithStreamingResponse: + def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: + self._routes_for_agency = routes_for_agency + + self.list = async_to_streamed_response_wrapper( + routes_for_agency.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index a8bf612..85cef90 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -13,6 +13,7 @@ from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py new file mode 100644 index 0000000..5ff3242 --- /dev/null +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] + + +class RoutesForAgencyListResponseDataList(BaseModel): + id: Optional[str] = None + + agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + + color: Optional[str] = None + + description: Optional[str] = None + + long_name: Optional[str] = FieldInfo(alias="longName", default=None) + + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + + type: Optional[int] = None + + url: Optional[str] = None + + +class RoutesForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[RoutesForAgencyListResponseDataList] + + references: References + + +class RoutesForAgencyListResponse(ResponseWrapper): + data: RoutesForAgencyListResponseData diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py new file mode 100644 index 0000000..1fe2d56 --- /dev/null +++ b/tests/api_resources/test_routes_for_agency.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import RoutesForAgencyListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoutesForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + routes_for_agency = client.routes_for_agency.list( + "agencyID", + ) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + routes_for_agency = response.parse() + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.routes_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + routes_for_agency = response.parse() + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + client.routes_for_agency.with_raw_response.list( + "", + ) + + +class TestAsyncRoutesForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_agency = await async_client.routes_for_agency.list( + "agencyID", + ) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + routes_for_agency = await response.parse() + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.routes_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + routes_for_agency = await response.parse() + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + await async_client.routes_for_agency.with_raw_response.list( + "", + ) From 5c8a7ee00dcd4ab6a3a9b6800fe10f7447d79c61 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 16:29:25 +0000 Subject: [PATCH 028/397] feat(api): OpenAPI spec update via Stainless API (#57) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 10 ++ src/onebusaway/resources/__init__.py | 14 ++ .../resources/schedule_for_route.py | 166 ++++++++++++++++++ src/onebusaway/types/__init__.py | 2 + .../schedule_for_route_retrieve_params.py | 15 ++ .../schedule_for_route_retrieve_response.py | 131 ++++++++++++++ .../api_resources/test_schedule_for_route.py | 114 ++++++++++++ 9 files changed, 466 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/schedule_for_route.py create mode 100644 src/onebusaway/types/schedule_for_route_retrieve_params.py create mode 100644 src/onebusaway/types/schedule_for_route_retrieve_response.py create mode 100644 tests/api_resources/test_schedule_for_route.py diff --git a/.stats.yml b/.stats.yml index 2f8fb74..1da4201 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-321de3032fb9e1dd70c112bc3f172d12a36692f8fcfa2e8aec47ab6a85ca37e2.yml +configured_endpoints: 20 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-681949f64ed7ba8d43a08daba3e5dfcee447cecc48a0a03fcf2aedef3b656641.yml diff --git a/api.md b/api.md index ff6371d..40f0d90 100644 --- a/api.md +++ b/api.md @@ -160,6 +160,18 @@ Methods: - client.routes_for_agency.list(agency_id) -> RoutesForAgencyListResponse +# ScheduleForRoute + +Types: + +```python +from onebusaway.types import ScheduleForRouteRetrieveResponse +``` + +Methods: + +- client.schedule_for_route.retrieve(route_id, \*\*params) -> ScheduleForRouteRetrieveResponse + # ArrivalAndDeparture Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 0103aaa..166e73c 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -59,6 +59,7 @@ class OnebusawaySDK(SyncAPIClient): route: resources.RouteResource route_ids_for_agency: resources.RouteIDsForAgencyResource routes_for_agency: resources.RoutesForAgencyResource + schedule_for_route: resources.ScheduleForRouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource trips_for_location: resources.TripsForLocationResource @@ -134,6 +135,7 @@ def __init__( self.route = resources.RouteResource(self) self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self) self.routes_for_agency = resources.RoutesForAgencyResource(self) + self.schedule_for_route = resources.ScheduleForRouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) self.trips_for_location = resources.TripsForLocationResource(self) @@ -269,6 +271,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): route: resources.AsyncRouteResource route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource routes_for_agency: resources.AsyncRoutesForAgencyResource + schedule_for_route: resources.AsyncScheduleForRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource trips_for_location: resources.AsyncTripsForLocationResource @@ -344,6 +347,7 @@ def __init__( self.route = resources.AsyncRouteResource(self) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self) self.routes_for_agency = resources.AsyncRoutesForAgencyResource(self) + self.schedule_for_route = resources.AsyncScheduleForRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) self.trips_for_location = resources.AsyncTripsForLocationResource(self) @@ -482,6 +486,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.route = resources.RouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) self.routes_for_agency = resources.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) + self.schedule_for_route = resources.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) @@ -506,6 +511,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) + self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure ) @@ -534,6 +540,7 @@ def __init__(self, client: OnebusawaySDK) -> None: client.route_ids_for_agency ) self.routes_for_agency = resources.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = resources.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) @@ -568,6 +575,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.route_ids_for_agency ) self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithStreamingResponse( + client.schedule_for_route + ) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 944a791..b7e6b33 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -88,6 +88,14 @@ ScheduleForStopResourceWithStreamingResponse, AsyncScheduleForStopResourceWithStreamingResponse, ) +from .schedule_for_route import ( + ScheduleForRouteResource, + AsyncScheduleForRouteResource, + ScheduleForRouteResourceWithRawResponse, + AsyncScheduleForRouteResourceWithRawResponse, + ScheduleForRouteResourceWithStreamingResponse, + AsyncScheduleForRouteResourceWithStreamingResponse, +) from .stops_for_location import ( StopsForLocationResource, AsyncStopsForLocationResource, @@ -224,6 +232,12 @@ "AsyncRoutesForAgencyResourceWithRawResponse", "RoutesForAgencyResourceWithStreamingResponse", "AsyncRoutesForAgencyResourceWithStreamingResponse", + "ScheduleForRouteResource", + "AsyncScheduleForRouteResource", + "ScheduleForRouteResourceWithRawResponse", + "AsyncScheduleForRouteResourceWithRawResponse", + "ScheduleForRouteResourceWithStreamingResponse", + "AsyncScheduleForRouteResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py new file mode 100644 index 0000000..74516bb --- /dev/null +++ b/src/onebusaway/resources/schedule_for_route.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import schedule_for_route_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse + +__all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] + + +class ScheduleForRouteResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: + return ScheduleForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ScheduleForRouteResourceWithStreamingResponse: + return ScheduleForRouteResourceWithStreamingResponse(self) + + def retrieve( + self, + route_id: str, + *, + date: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForRouteRetrieveResponse: + """ + Retrieve the full schedule for a route on a particular day + + Args: + date: The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to current date) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/api/where/schedule-for-route/routeID.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams + ), + ), + cast_to=ScheduleForRouteRetrieveResponse, + ) + + +class AsyncScheduleForRouteResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: + return AsyncScheduleForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncScheduleForRouteResourceWithStreamingResponse: + return AsyncScheduleForRouteResourceWithStreamingResponse(self) + + async def retrieve( + self, + route_id: str, + *, + date: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForRouteRetrieveResponse: + """ + Retrieve the full schedule for a route on a particular day + + Args: + date: The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to current date) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/api/where/schedule-for-route/routeID.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams + ), + ), + cast_to=ScheduleForRouteRetrieveResponse, + ) + + +class ScheduleForRouteResourceWithRawResponse: + def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: + self._schedule_for_route = schedule_for_route + + self.retrieve = to_raw_response_wrapper( + schedule_for_route.retrieve, + ) + + +class AsyncScheduleForRouteResourceWithRawResponse: + def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: + self._schedule_for_route = schedule_for_route + + self.retrieve = async_to_raw_response_wrapper( + schedule_for_route.retrieve, + ) + + +class ScheduleForRouteResourceWithStreamingResponse: + def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: + self._schedule_for_route = schedule_for_route + + self.retrieve = to_streamed_response_wrapper( + schedule_for_route.retrieve, + ) + + +class AsyncScheduleForRouteResourceWithStreamingResponse: + def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: + self._schedule_for_route = schedule_for_route + + self.retrieve = async_to_streamed_response_wrapper( + schedule_for_route.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 85cef90..939c0fb 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -21,11 +21,13 @@ from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse +from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse from .arrival_and_departure_retrieve_params import ( diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py new file mode 100644 index 0000000..0ba5bcf --- /dev/null +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ScheduleForRouteRetrieveParams"] + + +class ScheduleForRouteRetrieveParams(TypedDict, total=False): + date: str + """ + The date for which you want to request a schedule in the format YYYY-MM-DD + (optional, defaults to current date) + """ diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py new file mode 100644 index 0000000..1c68056 --- /dev/null +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -0,0 +1,131 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "ScheduleForRouteRetrieveResponse", + "ScheduleForRouteRetrieveResponseData", + "ScheduleForRouteRetrieveResponseDataEntry", + "ScheduleForRouteRetrieveResponseDataEntryStop", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", + "ScheduleForRouteRetrieveResponseDataEntryTrip", +] + + +class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): + id: str + + code: str + + lat: float + + lon: float + + name: str + + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + parent: Optional[str] = None + + route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + + static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + + +class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime(BaseModel): + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + + arrival_time: int = FieldInfo(alias="arrivalTime") + + departure_enabled: bool = FieldInfo(alias="departureEnabled") + + departure_time: int = FieldInfo(alias="departureTime") + + stop_id: str = FieldInfo(alias="stopId") + + trip_id: str = FieldInfo(alias="tripId") + + service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + +class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime(BaseModel): + stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo( + alias="stopTimes" + ) + + trip_id: str = FieldInfo(alias="tripId") + + +class ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping(BaseModel): + direction_id: str = FieldInfo(alias="directionId") + + stop_ids: List[str] = FieldInfo(alias="stopIds") + + trip_headsigns: List[str] = FieldInfo(alias="tripHeadsigns") + + trip_ids: List[str] = FieldInfo(alias="tripIds") + + trips_with_stop_times: Optional[ + List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime] + ] = FieldInfo(alias="tripsWithStopTimes", default=None) + + +class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): + id: str + + route_id: str = FieldInfo(alias="routeId") + + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + + direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + + peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + + service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) + + shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) + + trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + + +class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): + route_id: str = FieldInfo(alias="routeId") + + schedule_date: int = FieldInfo(alias="scheduleDate") + + service_ids: List[str] = FieldInfo(alias="serviceIds") + + stops: List[ScheduleForRouteRetrieveResponseDataEntryStop] + + stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo( + alias="stopTripGroupings" + ) + + trips: List[ScheduleForRouteRetrieveResponseDataEntryTrip] + + +class ScheduleForRouteRetrieveResponseData(BaseModel): + entry: ScheduleForRouteRetrieveResponseDataEntry + + +class ScheduleForRouteRetrieveResponse(ResponseWrapper): + data: ScheduleForRouteRetrieveResponseData diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py new file mode 100644 index 0000000..a7ff884 --- /dev/null +++ b/tests/api_resources/test_schedule_for_route.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import ScheduleForRouteRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestScheduleForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + schedule_for_route = client.schedule_for_route.retrieve( + route_id="1_100223", + ) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + schedule_for_route = client.schedule_for_route.retrieve( + route_id="1_100223", + date="date", + ) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_route.with_raw_response.retrieve( + route_id="1_100223", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schedule_for_route = response.parse() + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.schedule_for_route.with_streaming_response.retrieve( + route_id="1_100223", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schedule_for_route = response.parse() + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) + + +class TestAsyncScheduleForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + schedule_for_route = await async_client.schedule_for_route.retrieve( + route_id="1_100223", + ) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + schedule_for_route = await async_client.schedule_for_route.retrieve( + route_id="1_100223", + date="date", + ) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_route.with_raw_response.retrieve( + route_id="1_100223", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schedule_for_route = await response.parse() + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.schedule_for_route.with_streaming_response.retrieve( + route_id="1_100223", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schedule_for_route = await response.parse() + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) From 29edb45798ad111a1a4f6ce5bbbbadfe3e9099d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 16:44:56 +0000 Subject: [PATCH 029/397] feat(api): OpenAPI spec update via Stainless API (#58) --- .stats.yml | 2 +- api.md | 12 ++ src/onebusaway/_client.py | 10 + src/onebusaway/resources/__init__.py | 14 ++ .../resources/routes_for_location.py | 180 ++++++++++++++++++ src/onebusaway/types/__init__.py | 4 + .../routes_for_location_retrieve_params.py | 23 +++ .../routes_for_location_retrieve_response.py | 51 +++++ .../api_resources/test_routes_for_location.py | 114 +++++++++++ 9 files changed, 409 insertions(+), 1 deletion(-) create mode 100644 src/onebusaway/resources/routes_for_location.py create mode 100644 src/onebusaway/types/routes_for_location_retrieve_params.py create mode 100644 src/onebusaway/types/routes_for_location_retrieve_response.py create mode 100644 tests/api_resources/test_routes_for_location.py diff --git a/.stats.yml b/.stats.yml index 1da4201..c249e96 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 20 +configured_endpoints: 21 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-681949f64ed7ba8d43a08daba3e5dfcee447cecc48a0a03fcf2aedef3b656641.yml diff --git a/api.md b/api.md index 40f0d90..67780d0 100644 --- a/api.md +++ b/api.md @@ -148,6 +148,18 @@ Methods: - client.route_ids_for_agency.list(agency_id) -> RouteIDsForAgencyListResponse +# RoutesForLocation + +Types: + +```python +from onebusaway.types import RoutesForLocationRetrieveResponse +``` + +Methods: + +- client.routes_for_location.retrieve(\*\*params) -> RoutesForLocationRetrieveResponse + # RoutesForAgency Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 166e73c..89929e6 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -58,6 +58,7 @@ class OnebusawaySDK(SyncAPIClient): schedule_for_stop: resources.ScheduleForStopResource route: resources.RouteResource route_ids_for_agency: resources.RouteIDsForAgencyResource + routes_for_location: resources.RoutesForLocationResource routes_for_agency: resources.RoutesForAgencyResource schedule_for_route: resources.ScheduleForRouteResource arrival_and_departure: resources.ArrivalAndDepartureResource @@ -134,6 +135,7 @@ def __init__( self.schedule_for_stop = resources.ScheduleForStopResource(self) self.route = resources.RouteResource(self) self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self) + self.routes_for_location = resources.RoutesForLocationResource(self) self.routes_for_agency = resources.RoutesForAgencyResource(self) self.schedule_for_route = resources.ScheduleForRouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) @@ -270,6 +272,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): schedule_for_stop: resources.AsyncScheduleForStopResource route: resources.AsyncRouteResource route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource + routes_for_location: resources.AsyncRoutesForLocationResource routes_for_agency: resources.AsyncRoutesForAgencyResource schedule_for_route: resources.AsyncScheduleForRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource @@ -346,6 +349,7 @@ def __init__( self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) self.route = resources.AsyncRouteResource(self) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self) + self.routes_for_location = resources.AsyncRoutesForLocationResource(self) self.routes_for_agency = resources.AsyncRoutesForAgencyResource(self) self.schedule_for_route = resources.AsyncScheduleForRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) @@ -485,6 +489,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = resources.RoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = resources.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.schedule_for_route = resources.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) @@ -510,6 +515,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = resources.AsyncRoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( @@ -539,6 +545,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) + self.routes_for_location = resources.RoutesForLocationResourceWithStreamingResponse(client.routes_for_location) self.routes_for_agency = resources.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) self.schedule_for_route = resources.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( @@ -574,6 +581,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) + self.routes_for_location = resources.AsyncRoutesForLocationResourceWithStreamingResponse( + client.routes_for_location + ) self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithStreamingResponse( client.schedule_for_route diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index b7e6b33..a394a29 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -112,6 +112,14 @@ TripsForLocationResourceWithStreamingResponse, AsyncTripsForLocationResourceWithStreamingResponse, ) +from .routes_for_location import ( + RoutesForLocationResource, + AsyncRoutesForLocationResource, + RoutesForLocationResourceWithRawResponse, + AsyncRoutesForLocationResourceWithRawResponse, + RoutesForLocationResourceWithStreamingResponse, + AsyncRoutesForLocationResourceWithStreamingResponse, +) from .stop_ids_for_agency import ( StopIDsForAgencyResource, AsyncStopIDsForAgencyResource, @@ -226,6 +234,12 @@ "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", + "RoutesForLocationResource", + "AsyncRoutesForLocationResource", + "RoutesForLocationResourceWithRawResponse", + "AsyncRoutesForLocationResourceWithRawResponse", + "RoutesForLocationResourceWithStreamingResponse", + "AsyncRoutesForLocationResourceWithStreamingResponse", "RoutesForAgencyResource", "AsyncRoutesForAgencyResource", "RoutesForAgencyResourceWithRawResponse", diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py new file mode 100644 index 0000000..2c4d4e9 --- /dev/null +++ b/src/onebusaway/resources/routes_for_location.py @@ -0,0 +1,180 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import routes_for_location_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.routes_for_location_retrieve_response import RoutesForLocationRetrieveResponse + +__all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] + + +class RoutesForLocationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: + return RoutesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingResponse: + return RoutesForLocationResourceWithStreamingResponse(self) + + def retrieve( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForLocationRetrieveResponse: + """ + routes-for-location + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/api/where/routes-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + ), + ), + cast_to=RoutesForLocationRetrieveResponse, + ) + + +class AsyncRoutesForLocationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: + return AsyncRoutesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreamingResponse: + return AsyncRoutesForLocationResourceWithStreamingResponse(self) + + async def retrieve( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForLocationRetrieveResponse: + """ + routes-for-location + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/api/where/routes-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + ), + ), + cast_to=RoutesForLocationRetrieveResponse, + ) + + +class RoutesForLocationResourceWithRawResponse: + def __init__(self, routes_for_location: RoutesForLocationResource) -> None: + self._routes_for_location = routes_for_location + + self.retrieve = to_raw_response_wrapper( + routes_for_location.retrieve, + ) + + +class AsyncRoutesForLocationResourceWithRawResponse: + def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: + self._routes_for_location = routes_for_location + + self.retrieve = async_to_raw_response_wrapper( + routes_for_location.retrieve, + ) + + +class RoutesForLocationResourceWithStreamingResponse: + def __init__(self, routes_for_location: RoutesForLocationResource) -> None: + self._routes_for_location = routes_for_location + + self.retrieve = to_streamed_response_wrapper( + routes_for_location.retrieve, + ) + + +class AsyncRoutesForLocationResourceWithStreamingResponse: + def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: + self._routes_for_location = routes_for_location + + self.retrieve = async_to_streamed_response_wrapper( + routes_for_location.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 939c0fb..7cad009 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -26,6 +26,7 @@ from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse +from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse @@ -33,6 +34,9 @@ from .arrival_and_departure_retrieve_params import ( ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, ) +from .routes_for_location_retrieve_response import ( + RoutesForLocationRetrieveResponse as RoutesForLocationRetrieveResponse, +) from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) diff --git a/src/onebusaway/types/routes_for_location_retrieve_params.py b/src/onebusaway/types/routes_for_location_retrieve_params.py new file mode 100644 index 0000000..9acd9ce --- /dev/null +++ b/src/onebusaway/types/routes_for_location_retrieve_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["RoutesForLocationRetrieveParams"] + + +class RoutesForLocationRetrieveParams(TypedDict, total=False): + lat: Required[float] + + lon: Required[float] + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + + query: str + + radius: float diff --git a/src/onebusaway/types/routes_for_location_retrieve_response.py b/src/onebusaway/types/routes_for_location_retrieve_response.py new file mode 100644 index 0000000..a01a271 --- /dev/null +++ b/src/onebusaway/types/routes_for_location_retrieve_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "RoutesForLocationRetrieveResponse", + "RoutesForLocationRetrieveResponseData", + "RoutesForLocationRetrieveResponseDataList", +] + + +class RoutesForLocationRetrieveResponseDataList(BaseModel): + id: Optional[str] = None + + agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + + color: Optional[str] = None + + description: Optional[str] = None + + long_name: Optional[str] = FieldInfo(alias="longName", default=None) + + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + + type: Optional[int] = None + + url: Optional[str] = None + + +class RoutesForLocationRetrieveResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[RoutesForLocationRetrieveResponseDataList] + + out_of_range: bool = FieldInfo(alias="outOfRange") + + references: References + + +class RoutesForLocationRetrieveResponse(ResponseWrapper): + data: RoutesForLocationRetrieveResponseData diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py new file mode 100644 index 0000000..2e091e6 --- /dev/null +++ b/tests/api_resources/test_routes_for_location.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import RoutesForLocationRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoutesForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.retrieve( + lat=0, + lon=0, + ) + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.retrieve( + lat=0, + lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, + ) + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.retrieve( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + routes_for_location = response.parse() + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.routes_for_location.with_streaming_response.retrieve( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + routes_for_location = response.parse() + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRoutesForLocation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.retrieve( + lat=0, + lon=0, + ) + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.retrieve( + lat=0, + lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, + ) + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.retrieve( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + routes_for_location = await response.parse() + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.routes_for_location.with_streaming_response.retrieve( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + routes_for_location = await response.parse() + assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + + assert cast(Any, response.is_closed) is True From a6413af808c1ea04d05a46fa0a5d54ec888999bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:52:53 +0000 Subject: [PATCH 030/397] chore(internal): remove deprecated ruff config (#59) --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 97bfdb1..94b8843 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -195,7 +195,6 @@ unfixable = [ "T201", "T203", ] -ignore-init-module-imports = true [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" @@ -207,7 +206,7 @@ combine-as-imports = true extra-standard-library = ["typing_extensions"] known-first-party = ["onebusaway", "tests"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "bin/**.py" = ["T201", "T203"] "scripts/**.py" = ["T201", "T203"] "tests/**.py" = ["T201", "T203"] From 0bf59511bd3cdd575b2f7d5c4cf911c6492cb7bb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:53:11 +0000 Subject: [PATCH 031/397] release: 0.1.0-alpha.12 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 22 ++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9377f8f..09356f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.11" + ".": "0.1.0-alpha.12" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 568a3ed..52b2803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## 0.1.0-alpha.12 (2024-08-08) + +Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#48](https://github.com/OneBusAway/python-sdk/issues/48)) ([a5c305c](https://github.com/OneBusAway/python-sdk/commit/a5c305c7a5614588dd3fb14607dd2489aab8b3c6)) +* **api:** OpenAPI spec update via Stainless API ([#55](https://github.com/OneBusAway/python-sdk/issues/55)) ([9adae4d](https://github.com/OneBusAway/python-sdk/commit/9adae4de96b8ea11ff8e2d7c251183580f86cf8a)) +* **api:** OpenAPI spec update via Stainless API ([#56](https://github.com/OneBusAway/python-sdk/issues/56)) ([1882cdc](https://github.com/OneBusAway/python-sdk/commit/1882cdc8a4da9705c853ed6f5d5e8d73a4b9276c)) +* **api:** OpenAPI spec update via Stainless API ([#57](https://github.com/OneBusAway/python-sdk/issues/57)) ([5c8a7ee](https://github.com/OneBusAway/python-sdk/commit/5c8a7ee00dcd4ab6a3a9b6800fe10f7447d79c61)) +* **api:** OpenAPI spec update via Stainless API ([#58](https://github.com/OneBusAway/python-sdk/issues/58)) ([29edb45](https://github.com/OneBusAway/python-sdk/commit/29edb45798ad111a1a4f6ce5bbbbadfe3e9099d8)) +* **client:** add `retry_count` to raw response class ([#51](https://github.com/OneBusAway/python-sdk/issues/51)) ([97156e5](https://github.com/OneBusAway/python-sdk/commit/97156e5dff5d743d04ecc0dbe73ec7c690dfb4fe)) + + +### Chores + +* **internal:** bump pyright ([#50](https://github.com/OneBusAway/python-sdk/issues/50)) ([6d1fdf7](https://github.com/OneBusAway/python-sdk/commit/6d1fdf78cf6d63079bf037b88ac0540e619f9ae7)) +* **internal:** bump ruff version ([#53](https://github.com/OneBusAway/python-sdk/issues/53)) ([c8cbc6a](https://github.com/OneBusAway/python-sdk/commit/c8cbc6a1e48e42b15e42ebf40cdfd2f8fc0bc7ab)) +* **internal:** remove deprecated ruff config ([#59](https://github.com/OneBusAway/python-sdk/issues/59)) ([a6413af](https://github.com/OneBusAway/python-sdk/commit/a6413af808c1ea04d05a46fa0a5d54ec888999bf)) +* **internal:** test updates ([#52](https://github.com/OneBusAway/python-sdk/issues/52)) ([f3b7cb0](https://github.com/OneBusAway/python-sdk/commit/f3b7cb00c4302b0ac1b8497835f2db0d3f9e7949)) +* **internal:** update pydantic compat helper function ([#54](https://github.com/OneBusAway/python-sdk/issues/54)) ([1f501f0](https://github.com/OneBusAway/python-sdk/commit/1f501f0592c92e86c4c027f652a49ff11a068715)) + ## 0.1.0-alpha.11 (2024-08-01) Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) diff --git a/pyproject.toml b/pyproject.toml index 94b8843..121f816 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.11" +version = "0.1.0-alpha.12" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 9189dbc..342cc03 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.11" # x-release-please-version +__version__ = "0.1.0-alpha.12" # x-release-please-version From 95c7c8c3f2908490f2b3859dbca786ee3a5d74d9 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:05 +0000 Subject: [PATCH 032/397] feat: Add routes_for_agency.py example --- examples/routes_for_agency.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/routes_for_agency.py diff --git a/examples/routes_for_agency.py b/examples/routes_for_agency.py new file mode 100644 index 0000000..960f0fd --- /dev/null +++ b/examples/routes_for_agency.py @@ -0,0 +1,24 @@ +from pprint import pprint + +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +# Load settings from .env file, if it exists. If not, we'll use the +# Puget Sound server URL (which is also the default in the SDK) and +# the 'TEST' API key. +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +# Create a new instance of the OneBusAway SDK with the settings we loaded. +oba = OnebusawaySDK(**settings) + +agency_id = "40" +response = oba.routes_for_agency.list(agency_id) + +if response and response.data: + pprint(response.data) From 68e0128a24acbabf95ddbffe6c764d80dd4540d0 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:13 +0000 Subject: [PATCH 033/397] feat: Add routes_ids_for_agency.py example --- examples/routes_ids_for_agency.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/routes_ids_for_agency.py diff --git a/examples/routes_ids_for_agency.py b/examples/routes_ids_for_agency.py new file mode 100644 index 0000000..c5f6547 --- /dev/null +++ b/examples/routes_ids_for_agency.py @@ -0,0 +1,23 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +# Load settings from .env file, if it exists. If not, we'll use the +# Puget Sound server URL (which is also the default in the SDK) and +# the 'TEST' API key. +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +# Create a new instance of the OneBusAway SDK with the settings we loaded. +oba = OnebusawaySDK(**settings) + +agency_id = "40" # Link Light Rail in the Seattle area. + +route_ids = oba.route_ids_for_agency.list(agency_id) +if route_ids.data and route_ids.data.list: + for route_id in route_ids.data.list: + print(route_id) From 83251e2f295de6f0b416c6f202fff943caebe2e1 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:17 +0000 Subject: [PATCH 034/397] feat: Add schedule_for_route.py example --- examples/schedule_for_route.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/schedule_for_route.py diff --git a/examples/schedule_for_route.py b/examples/schedule_for_route.py new file mode 100644 index 0000000..530a3ca --- /dev/null +++ b/examples/schedule_for_route.py @@ -0,0 +1,21 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +# Load settings from .env file, if it exists. If not, we'll use the +# Puget Sound server URL (which is also the default in the SDK) and +# the 'TEST' API key. +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +# Create a new instance of the OneBusAway SDK with the settings we loaded. +oba = OnebusawaySDK(**settings) + +route_id = "1_100224" +response = oba.schedule_for_route.retrieve(route_id) +if response and response.data: + print(response.data.entry.stop_trip_groupings[0]) From 2d390e4ed6d35fa08041080e800da638d60f50d4 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:23 +0000 Subject: [PATCH 035/397] refactor: Update route_ids_for_agency.py to use agency_id parameter in API endpoint --- src/onebusaway/resources/route_ids_for_agency.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index cf5ab88..acf0a16 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -54,7 +54,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/route-ids-for-agency/agencyID.json", + f"/api/where/route-ids-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +97,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/route-ids-for-agency/agencyID.json", + f"/api/where/route-ids-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From e6e7c1eda4eead5d32809c9f6b5a51d0862205f4 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:29 +0000 Subject: [PATCH 036/397] refactor: Update route_ids_for_agency.py to use agency_id parameter in API endpoint --- src/onebusaway/resources/routes_for_agency.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index 637eefe..4364fd6 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -54,7 +54,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/routes-for-agency/agencyID.json", + f"/api/where/routes-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +97,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/routes-for-agency/agencyID.json", + f"/api/where/routes-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From 0340bdb360d6236d978a1775d12c067c3ad59f89 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 14:36:34 +0000 Subject: [PATCH 037/397] feat: Update schedule_for_route.py to use route_id parameter in API endpoint --- src/onebusaway/resources/schedule_for_route.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 74516bb..b43134a 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -63,7 +63,7 @@ def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( - f"/api/where/schedule-for-route/routeID.json", + f"/api/where/schedule-for-route/{route_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -116,7 +116,7 @@ async def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( - f"/api/where/schedule-for-route/routeID.json", + f"/api/where/schedule-for-route/{route_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, From 5d7fe060b6158f719e388feba0bc9f7dcb0fe288 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 8 Aug 2024 15:13:08 +0000 Subject: [PATCH 038/397] chore(internal): version bump (#61) --- .release-please-manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 09356f9..fd0ccba 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.12" -} + ".": "0.1.0-alpha.12" +} \ No newline at end of file From b3411ebcc5bf4025f3e8d4303faede0641e4e09a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:13:20 +0000 Subject: [PATCH 039/397] release: 0.1.0-alpha.13 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fd0ccba..000572e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.12" + ".": "0.1.0-alpha.13" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 52b2803..7afbb26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.13 (2024-08-08) + +Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13) + +### Chores + +* **internal:** version bump ([#61](https://github.com/OneBusAway/python-sdk/issues/61)) ([5d7fe06](https://github.com/OneBusAway/python-sdk/commit/5d7fe060b6158f719e388feba0bc9f7dcb0fe288)) + ## 0.1.0-alpha.12 (2024-08-08) Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12) diff --git a/pyproject.toml b/pyproject.toml index 121f816..ddf472f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.12" +version = "0.1.0-alpha.13" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 342cc03..d316c3e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.12" # x-release-please-version +__version__ = "0.1.0-alpha.13" # x-release-please-version From d93e82a4b6410768f1d5f9cd08ee83157eb405ce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:57:18 +0000 Subject: [PATCH 040/397] feat(api): OpenAPI spec update via Stainless API (#65) --- .stats.yml | 4 +- api.md | 6 + src/onebusaway/_client.py | 16 ++ src/onebusaway/resources/__init__.py | 14 ++ .../resources/report_problem_with_stop.py | 206 ++++++++++++++++++ src/onebusaway/types/__init__.py | 3 + ...eport_problem_with_stop_retrieve_params.py | 26 +++ .../test_report_problem_with_stop.py | 122 +++++++++++ 8 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/report_problem_with_stop.py create mode 100644 src/onebusaway/types/report_problem_with_stop_retrieve_params.py create mode 100644 tests/api_resources/test_report_problem_with_stop.py diff --git a/.stats.yml b/.stats.yml index c249e96..efbc30b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 21 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-681949f64ed7ba8d43a08daba3e5dfcee447cecc48a0a03fcf2aedef3b656641.yml +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5140605804e4ff2f23c4401b0747441e07daeefb864695a4389e734b83eb07e8.yml diff --git a/api.md b/api.md index 67780d0..bc80de8 100644 --- a/api.md +++ b/api.md @@ -244,3 +244,9 @@ from onebusaway.types import TripForVehicleRetrieveResponse Methods: - client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse + +# ReportProblemWithStop + +Methods: + +- client.report_problem_with_stop.retrieve(stop_id, \*\*params) -> ResponseWrapper diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 89929e6..12d1813 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -66,6 +66,7 @@ class OnebusawaySDK(SyncAPIClient): trips_for_location: resources.TripsForLocationResource trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource + report_problem_with_stop: resources.ReportProblemWithStopResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -143,6 +144,7 @@ def __init__( self.trips_for_location = resources.TripsForLocationResource(self) self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) + self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -280,6 +282,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trips_for_location: resources.AsyncTripsForLocationResource trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource + report_problem_with_stop: resources.AsyncReportProblemWithStopResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -357,6 +360,7 @@ def __init__( self.trips_for_location = resources.AsyncTripsForLocationResource(self) self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) + self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -497,6 +501,9 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( + client.report_problem_with_stop + ) class AsyncOnebusawaySDKWithRawResponse: @@ -525,6 +532,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( + client.report_problem_with_stop + ) class OnebusawaySDKWithStreamedResponse: @@ -555,6 +565,9 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( + client.report_problem_with_stop + ) class AsyncOnebusawaySDKWithStreamedResponse: @@ -597,6 +610,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( + client.report_problem_with_stop + ) Client = OnebusawaySDK diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index a394a29..03dfeff 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -160,6 +160,14 @@ AgenciesWithCoverageResourceWithStreamingResponse, AsyncAgenciesWithCoverageResourceWithStreamingResponse, ) +from .report_problem_with_stop import ( + ReportProblemWithStopResource, + AsyncReportProblemWithStopResource, + ReportProblemWithStopResourceWithRawResponse, + AsyncReportProblemWithStopResourceWithRawResponse, + ReportProblemWithStopResourceWithStreamingResponse, + AsyncReportProblemWithStopResourceWithStreamingResponse, +) __all__ = [ "AgenciesWithCoverageResource", @@ -282,4 +290,10 @@ "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", + "ReportProblemWithStopResource", + "AsyncReportProblemWithStopResource", + "ReportProblemWithStopResourceWithRawResponse", + "AsyncReportProblemWithStopResourceWithRawResponse", + "ReportProblemWithStopResourceWithStreamingResponse", + "AsyncReportProblemWithStopResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py new file mode 100644 index 0000000..8a3bff7 --- /dev/null +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -0,0 +1,206 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import report_problem_with_stop_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shared.response_wrapper import ResponseWrapper + +__all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] + + +class ReportProblemWithStopResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: + return ReportProblemWithStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingResponse: + return ReportProblemWithStopResourceWithStreamingResponse(self) + + def retrieve( + self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] + | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: + """ + Submit a user-generated problem report for a stop + + Args: + code: A string code identifying the nature of the problem + + user_comment: Additional comment text supplied by the user describing the problem + + user_lat: The reporting user’s current latitude + + user_location_accuracy: The reporting user’s location accuracy, in meters + + user_lon: The reporting user’s current longitude + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not stop_id: + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + return self._get( + f"/api/where/report-problem-with-stop/{stop_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, + report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, + ), + ), + cast_to=ResponseWrapper, + ) + + +class AsyncReportProblemWithStopResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: + return AsyncReportProblemWithStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStreamingResponse: + return AsyncReportProblemWithStopResourceWithStreamingResponse(self) + + async def retrieve( + self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] + | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: + """ + Submit a user-generated problem report for a stop + + Args: + code: A string code identifying the nature of the problem + + user_comment: Additional comment text supplied by the user describing the problem + + user_lat: The reporting user’s current latitude + + user_location_accuracy: The reporting user’s location accuracy, in meters + + user_lon: The reporting user’s current longitude + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not stop_id: + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + return await self._get( + f"/api/where/report-problem-with-stop/{stop_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, + report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, + ), + ), + cast_to=ResponseWrapper, + ) + + +class ReportProblemWithStopResourceWithRawResponse: + def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: + self._report_problem_with_stop = report_problem_with_stop + + self.retrieve = to_raw_response_wrapper( + report_problem_with_stop.retrieve, + ) + + +class AsyncReportProblemWithStopResourceWithRawResponse: + def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: + self._report_problem_with_stop = report_problem_with_stop + + self.retrieve = async_to_raw_response_wrapper( + report_problem_with_stop.retrieve, + ) + + +class ReportProblemWithStopResourceWithStreamingResponse: + def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: + self._report_problem_with_stop = report_problem_with_stop + + self.retrieve = to_streamed_response_wrapper( + report_problem_with_stop.retrieve, + ) + + +class AsyncReportProblemWithStopResourceWithStreamingResponse: + def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: + self._report_problem_with_stop = report_problem_with_stop + + self.retrieve = async_to_streamed_response_wrapper( + report_problem_with_stop.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 7cad009..a7e67a2 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -43,3 +43,6 @@ from .agencies_with_coverage_retrieve_response import ( AgenciesWithCoverageRetrieveResponse as AgenciesWithCoverageRetrieveResponse, ) +from .report_problem_with_stop_retrieve_params import ( + ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, +) diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py new file mode 100644 index 0000000..609f03f --- /dev/null +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ReportProblemWithStopRetrieveParams"] + + +class ReportProblemWithStopRetrieveParams(TypedDict, total=False): + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] + """A string code identifying the nature of the problem""" + + user_comment: Annotated[str, PropertyInfo(alias="userComment")] + """Additional comment text supplied by the user describing the problem""" + + user_lat: Annotated[float, PropertyInfo(alias="userLat")] + """The reporting user’s current latitude""" + + user_location_accuracy: Annotated[float, PropertyInfo(alias="userLocationAccuracy")] + """The reporting user’s location accuracy, in meters""" + + user_lon: Annotated[float, PropertyInfo(alias="userLon")] + """The reporting user’s current longitude""" diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py new file mode 100644 index 0000000..0b15883 --- /dev/null +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -0,0 +1,122 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types.shared import ResponseWrapper + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReportProblemWithStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + report_problem_with_stop = client.report_problem_with_stop.retrieve( + stop_id="stopID", + ) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + report_problem_with_stop = client.report_problem_with_stop.retrieve( + stop_id="stopID", + code="stop_name_wrong", + user_comment="userComment", + user_lat=0, + user_location_accuracy=0, + user_lon=0, + ) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="stopID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + report_problem_with_stop = response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.report_problem_with_stop.with_streaming_response.retrieve( + stop_id="stopID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + report_problem_with_stop = response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): + client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) + + +class TestAsyncReportProblemWithStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( + stop_id="stopID", + ) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( + stop_id="stopID", + code="stop_name_wrong", + user_comment="userComment", + user_lat=0, + user_location_accuracy=0, + user_lon=0, + ) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="stopID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + report_problem_with_stop = await response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.report_problem_with_stop.with_streaming_response.retrieve( + stop_id="stopID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + report_problem_with_stop = await response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): + await async_client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) From 32652dcf0be1935454de8711d6dd9e30f4a30234 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:57:34 +0000 Subject: [PATCH 041/397] release: 0.1.0-alpha.14 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 000572e..b069996 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.13" + ".": "0.1.0-alpha.14" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7afbb26..1cd4db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.14 (2024-08-08) + +Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#65](https://github.com/OneBusAway/python-sdk/issues/65)) ([d93e82a](https://github.com/OneBusAway/python-sdk/commit/d93e82a4b6410768f1d5f9cd08ee83157eb405ce)) + ## 0.1.0-alpha.13 (2024-08-08) Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13) diff --git a/pyproject.toml b/pyproject.toml index ddf472f..6f05f09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.13" +version = "0.1.0-alpha.14" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index d316c3e..edcdd30 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.13" # x-release-please-version +__version__ = "0.1.0-alpha.14" # x-release-please-version From 63676136b6d0b0f01738cfc778763b6a79775d09 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:56:39 +0000 Subject: [PATCH 042/397] feat(api): OpenAPI spec update via Stainless API (#68) --- .stats.yml | 4 +- api.md | 24 +++ src/onebusaway/_client.py | 16 ++ src/onebusaway/resources/__init__.py | 28 +++ src/onebusaway/resources/search_for_route.py | 172 ++++++++++++++++++ src/onebusaway/resources/search_for_stop.py | 172 ++++++++++++++++++ src/onebusaway/types/__init__.py | 4 + .../types/search_for_route_retrieve_params.py | 17 ++ .../search_for_route_retrieve_response.py | 51 ++++++ .../types/search_for_stop_retrieve_params.py | 17 ++ .../search_for_stop_retrieve_response.py | 53 ++++++ tests/api_resources/test_search_for_route.py | 100 ++++++++++ tests/api_resources/test_search_for_stop.py | 100 ++++++++++ 13 files changed, 756 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/search_for_route.py create mode 100644 src/onebusaway/resources/search_for_stop.py create mode 100644 src/onebusaway/types/search_for_route_retrieve_params.py create mode 100644 src/onebusaway/types/search_for_route_retrieve_response.py create mode 100644 src/onebusaway/types/search_for_stop_retrieve_params.py create mode 100644 src/onebusaway/types/search_for_stop_retrieve_response.py create mode 100644 tests/api_resources/test_search_for_route.py create mode 100644 tests/api_resources/test_search_for_stop.py diff --git a/.stats.yml b/.stats.yml index efbc30b..948d808 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5140605804e4ff2f23c4401b0747441e07daeefb864695a4389e734b83eb07e8.yml +configured_endpoints: 24 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-9c3d349c8e661f7dc8c2585d02f334bb6ba3456f0d929c44d46454a0d190af7b.yml diff --git a/api.md b/api.md index bc80de8..fcb81b4 100644 --- a/api.md +++ b/api.md @@ -250,3 +250,27 @@ Methods: Methods: - client.report_problem_with_stop.retrieve(stop_id, \*\*params) -> ResponseWrapper + +# SearchForStop + +Types: + +```python +from onebusaway.types import SearchForStopRetrieveResponse +``` + +Methods: + +- client.search_for_stop.retrieve(\*\*params) -> SearchForStopRetrieveResponse + +# SearchForRoute + +Types: + +```python +from onebusaway.types import SearchForRouteRetrieveResponse +``` + +Methods: + +- client.search_for_route.retrieve(\*\*params) -> SearchForRouteRetrieveResponse diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 12d1813..b9cb088 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -67,6 +67,8 @@ class OnebusawaySDK(SyncAPIClient): trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource report_problem_with_stop: resources.ReportProblemWithStopResource + search_for_stop: resources.SearchForStopResource + search_for_route: resources.SearchForRouteResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -145,6 +147,8 @@ def __init__( self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) + self.search_for_stop = resources.SearchForStopResource(self) + self.search_for_route = resources.SearchForRouteResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -283,6 +287,8 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource report_problem_with_stop: resources.AsyncReportProblemWithStopResource + search_for_stop: resources.AsyncSearchForStopResource + search_for_route: resources.AsyncSearchForRouteResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -361,6 +367,8 @@ def __init__( self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) + self.search_for_stop = resources.AsyncSearchForStopResource(self) + self.search_for_route = resources.AsyncSearchForRouteResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -504,6 +512,8 @@ def __init__(self, client: OnebusawaySDK) -> None: self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) + self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop) + self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route) class AsyncOnebusawaySDKWithRawResponse: @@ -535,6 +545,8 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) + self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) + self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) class OnebusawaySDKWithStreamedResponse: @@ -568,6 +580,8 @@ def __init__(self, client: OnebusawaySDK) -> None: self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) + self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop) + self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route) class AsyncOnebusawaySDKWithStreamedResponse: @@ -613,6 +627,8 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) + self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) + self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) Client = OnebusawaySDK diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 03dfeff..4bb8956 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -56,6 +56,14 @@ TripDetailsResourceWithStreamingResponse, AsyncTripDetailsResourceWithStreamingResponse, ) +from .search_for_stop import ( + SearchForStopResource, + AsyncSearchForStopResource, + SearchForStopResourceWithRawResponse, + AsyncSearchForStopResourceWithRawResponse, + SearchForStopResourceWithStreamingResponse, + AsyncSearchForStopResourceWithStreamingResponse, +) from .stops_for_route import ( StopsForRouteResource, AsyncStopsForRouteResource, @@ -64,6 +72,14 @@ StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse, ) +from .search_for_route import ( + SearchForRouteResource, + AsyncSearchForRouteResource, + SearchForRouteResourceWithRawResponse, + AsyncSearchForRouteResourceWithRawResponse, + SearchForRouteResourceWithStreamingResponse, + AsyncSearchForRouteResourceWithStreamingResponse, +) from .trip_for_vehicle import ( TripForVehicleResource, AsyncTripForVehicleResource, @@ -296,4 +312,16 @@ "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", + "SearchForStopResource", + "AsyncSearchForStopResource", + "SearchForStopResourceWithRawResponse", + "AsyncSearchForStopResourceWithRawResponse", + "SearchForStopResourceWithStreamingResponse", + "AsyncSearchForStopResourceWithStreamingResponse", + "SearchForRouteResource", + "AsyncSearchForRouteResource", + "SearchForRouteResourceWithRawResponse", + "AsyncSearchForRouteResourceWithRawResponse", + "SearchForRouteResourceWithStreamingResponse", + "AsyncSearchForRouteResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py new file mode 100644 index 0000000..455fd1a --- /dev/null +++ b/src/onebusaway/resources/search_for_route.py @@ -0,0 +1,172 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import search_for_route_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.search_for_route_retrieve_response import SearchForRouteRetrieveResponse + +__all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] + + +class SearchForRouteResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: + return SearchForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse: + return SearchForRouteResourceWithStreamingResponse(self) + + def retrieve( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForRouteRetrieveResponse: + """ + Search for a route based on its name. + + Args: + input: The string to search for. + + max_count: The max number of results to return. Defaults to 20. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/api/where/search/route.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_route_retrieve_params.SearchForRouteRetrieveParams, + ), + ), + cast_to=SearchForRouteRetrieveResponse, + ) + + +class AsyncSearchForRouteResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: + return AsyncSearchForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingResponse: + return AsyncSearchForRouteResourceWithStreamingResponse(self) + + async def retrieve( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForRouteRetrieveResponse: + """ + Search for a route based on its name. + + Args: + input: The string to search for. + + max_count: The max number of results to return. Defaults to 20. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/api/where/search/route.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_route_retrieve_params.SearchForRouteRetrieveParams, + ), + ), + cast_to=SearchForRouteRetrieveResponse, + ) + + +class SearchForRouteResourceWithRawResponse: + def __init__(self, search_for_route: SearchForRouteResource) -> None: + self._search_for_route = search_for_route + + self.retrieve = to_raw_response_wrapper( + search_for_route.retrieve, + ) + + +class AsyncSearchForRouteResourceWithRawResponse: + def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: + self._search_for_route = search_for_route + + self.retrieve = async_to_raw_response_wrapper( + search_for_route.retrieve, + ) + + +class SearchForRouteResourceWithStreamingResponse: + def __init__(self, search_for_route: SearchForRouteResource) -> None: + self._search_for_route = search_for_route + + self.retrieve = to_streamed_response_wrapper( + search_for_route.retrieve, + ) + + +class AsyncSearchForRouteResourceWithStreamingResponse: + def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: + self._search_for_route = search_for_route + + self.retrieve = async_to_streamed_response_wrapper( + search_for_route.retrieve, + ) diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py new file mode 100644 index 0000000..28a068e --- /dev/null +++ b/src/onebusaway/resources/search_for_stop.py @@ -0,0 +1,172 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import search_for_stop_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.search_for_stop_retrieve_response import SearchForStopRetrieveResponse + +__all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] + + +class SearchForStopResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SearchForStopResourceWithRawResponse: + return SearchForStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: + return SearchForStopResourceWithStreamingResponse(self) + + def retrieve( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForStopRetrieveResponse: + """ + Search for a stop based on its name. + + Args: + input: The string to search for. + + max_count: The max number of results to return. Defaults to 20. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/api/where/search/stop.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_stop_retrieve_params.SearchForStopRetrieveParams, + ), + ), + cast_to=SearchForStopRetrieveResponse, + ) + + +class AsyncSearchForStopResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: + return AsyncSearchForStopResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResponse: + return AsyncSearchForStopResourceWithStreamingResponse(self) + + async def retrieve( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForStopRetrieveResponse: + """ + Search for a stop based on its name. + + Args: + input: The string to search for. + + max_count: The max number of results to return. Defaults to 20. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/api/where/search/stop.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_stop_retrieve_params.SearchForStopRetrieveParams, + ), + ), + cast_to=SearchForStopRetrieveResponse, + ) + + +class SearchForStopResourceWithRawResponse: + def __init__(self, search_for_stop: SearchForStopResource) -> None: + self._search_for_stop = search_for_stop + + self.retrieve = to_raw_response_wrapper( + search_for_stop.retrieve, + ) + + +class AsyncSearchForStopResourceWithRawResponse: + def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: + self._search_for_stop = search_for_stop + + self.retrieve = async_to_raw_response_wrapper( + search_for_stop.retrieve, + ) + + +class SearchForStopResourceWithStreamingResponse: + def __init__(self, search_for_stop: SearchForStopResource) -> None: + self._search_for_stop = search_for_stop + + self.retrieve = to_streamed_response_wrapper( + search_for_stop.retrieve, + ) + + +class AsyncSearchForStopResourceWithStreamingResponse: + def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: + self._search_for_stop = search_for_stop + + self.retrieve = async_to_streamed_response_wrapper( + search_for_stop.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index a7e67a2..b8ab17b 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -14,14 +14,18 @@ from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams +from .search_for_route_retrieve_params import SearchForRouteRetrieveParams as SearchForRouteRetrieveParams from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams +from .search_for_stop_retrieve_response import SearchForStopRetrieveResponse as SearchForStopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams +from .search_for_route_retrieve_response import SearchForRouteRetrieveResponse as SearchForRouteRetrieveResponse from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams diff --git a/src/onebusaway/types/search_for_route_retrieve_params.py b/src/onebusaway/types/search_for_route_retrieve_params.py new file mode 100644 index 0000000..08e8086 --- /dev/null +++ b/src/onebusaway/types/search_for_route_retrieve_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SearchForRouteRetrieveParams"] + + +class SearchForRouteRetrieveParams(TypedDict, total=False): + input: Required[str] + """The string to search for.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py new file mode 100644 index 0000000..8eaa0d1 --- /dev/null +++ b/src/onebusaway/types/search_for_route_retrieve_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "SearchForRouteRetrieveResponse", + "SearchForRouteRetrieveResponseData", + "SearchForRouteRetrieveResponseDataList", +] + + +class SearchForRouteRetrieveResponseDataList(BaseModel): + id: Optional[str] = None + + agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + + color: Optional[str] = None + + description: Optional[str] = None + + long_name: Optional[str] = FieldInfo(alias="longName", default=None) + + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + + type: Optional[int] = None + + url: Optional[str] = None + + +class SearchForRouteRetrieveResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[SearchForRouteRetrieveResponseDataList] + + out_of_range: bool = FieldInfo(alias="outOfRange") + + references: References + + +class SearchForRouteRetrieveResponse(ResponseWrapper): + data: Optional[SearchForRouteRetrieveResponseData] = None diff --git a/src/onebusaway/types/search_for_stop_retrieve_params.py b/src/onebusaway/types/search_for_stop_retrieve_params.py new file mode 100644 index 0000000..2f47894 --- /dev/null +++ b/src/onebusaway/types/search_for_stop_retrieve_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SearchForStopRetrieveParams"] + + +class SearchForStopRetrieveParams(TypedDict, total=False): + input: Required[str] + """The string to search for.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_stop_retrieve_response.py b/src/onebusaway/types/search_for_stop_retrieve_response.py new file mode 100644 index 0000000..5ac10ca --- /dev/null +++ b/src/onebusaway/types/search_for_stop_retrieve_response.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "SearchForStopRetrieveResponse", + "SearchForStopRetrieveResponseData", + "SearchForStopRetrieveResponseDataList", +] + + +class SearchForStopRetrieveResponseDataList(BaseModel): + id: str + + code: str + + lat: float + + lon: float + + name: str + + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + parent: Optional[str] = None + + route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + + static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + + +class SearchForStopRetrieveResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[SearchForStopRetrieveResponseDataList] + + out_of_range: bool = FieldInfo(alias="outOfRange") + + references: References + + +class SearchForStopRetrieveResponse(ResponseWrapper): + data: Optional[SearchForStopRetrieveResponseData] = None diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py new file mode 100644 index 0000000..e598023 --- /dev/null +++ b/tests/api_resources/test_search_for_route.py @@ -0,0 +1,100 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import SearchForRouteRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSearchForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + search_for_route = client.search_for_route.retrieve( + input="input", + ) + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + search_for_route = client.search_for_route.retrieve( + input="input", + max_count=0, + ) + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.search_for_route.with_raw_response.retrieve( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search_for_route = response.parse() + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.search_for_route.with_streaming_response.retrieve( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search_for_route = response.parse() + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSearchForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_route = await async_client.search_for_route.retrieve( + input="input", + ) + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_route = await async_client.search_for_route.retrieve( + input="input", + max_count=0, + ) + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_route.with_raw_response.retrieve( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search_for_route = await response.parse() + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.search_for_route.with_streaming_response.retrieve( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search_for_route = await response.parse() + assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py new file mode 100644 index 0000000..c2af009 --- /dev/null +++ b/tests/api_resources/test_search_for_stop.py @@ -0,0 +1,100 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import SearchForStopRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSearchForStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + search_for_stop = client.search_for_stop.retrieve( + input="input", + ) + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + search_for_stop = client.search_for_stop.retrieve( + input="input", + max_count=0, + ) + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.search_for_stop.with_raw_response.retrieve( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search_for_stop = response.parse() + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.search_for_stop.with_streaming_response.retrieve( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search_for_stop = response.parse() + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSearchForStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_stop = await async_client.search_for_stop.retrieve( + input="input", + ) + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_stop = await async_client.search_for_stop.retrieve( + input="input", + max_count=0, + ) + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_stop.with_raw_response.retrieve( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search_for_stop = await response.parse() + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.search_for_stop.with_streaming_response.retrieve( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search_for_stop = await response.parse() + assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + + assert cast(Any, response.is_closed) is True From 037b8cf884c380c2dfe930c8a37d30bed8915a35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:56:56 +0000 Subject: [PATCH 043/397] release: 0.1.0-alpha.15 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b069996..08e82c4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.14" + ".": "0.1.0-alpha.15" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cd4db0..e9143dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.15 (2024-08-08) + +Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.14...v0.1.0-alpha.15) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#68](https://github.com/OneBusAway/python-sdk/issues/68)) ([6367613](https://github.com/OneBusAway/python-sdk/commit/63676136b6d0b0f01738cfc778763b6a79775d09)) + ## 0.1.0-alpha.14 (2024-08-08) Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14) diff --git a/pyproject.toml b/pyproject.toml index 6f05f09..6b799d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.14" +version = "0.1.0-alpha.15" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index edcdd30..794f5a5 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.14" # x-release-please-version +__version__ = "0.1.0-alpha.15" # x-release-please-version From aa36924d4ebafab425586ff009b61b8db1f2f6a5 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 22:25:38 +0300 Subject: [PATCH 044/397] feat: Add search_for_route.py example --- examples/search_for_route.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/search_for_route.py diff --git a/examples/search_for_route.py b/examples/search_for_route.py new file mode 100644 index 0000000..2d078d6 --- /dev/null +++ b/examples/search_for_route.py @@ -0,0 +1,20 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +oba = OnebusawaySDK(**settings) + +# Search for routes with the word "crystal" in them. +search_input = "crystal" + +# Retrieve the search results. +response = oba.search_for_route.retrieve(input=search_input) + +print(response.data) From cf6f587cd55cd76ca53f1b81ee48efb7108fd9ba Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 8 Aug 2024 22:25:41 +0300 Subject: [PATCH 045/397] feat: Add search_for_stop.py example --- examples/search_for_stop.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/search_for_stop.py diff --git a/examples/search_for_stop.py b/examples/search_for_stop.py new file mode 100644 index 0000000..75ecdeb --- /dev/null +++ b/examples/search_for_stop.py @@ -0,0 +1,20 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +oba = OnebusawaySDK(**settings) + +# Search for stops with the word "crystal" in them. +search_input = "crystal" + +# Retrieve the search results. +response = oba.search_for_stop.retrieve(input=search_input, max_count=5) + +print(response.data) From 876b77c3addf2460c3116738f7b4bc784f67350d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:08:56 +0000 Subject: [PATCH 046/397] feat(api): OpenAPI spec update via Stainless API (#71) --- .stats.yml | 4 +- api.md | 6 + src/onebusaway/_client.py | 16 ++ src/onebusaway/resources/__init__.py | 14 + .../resources/report_problem_with_trip.py | 260 ++++++++++++++++++ src/onebusaway/types/__init__.py | 3 + ...eport_problem_with_trip_retrieve_params.py | 48 ++++ .../test_report_problem_with_trip.py | 132 +++++++++ 8 files changed, 481 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/report_problem_with_trip.py create mode 100644 src/onebusaway/types/report_problem_with_trip_retrieve_params.py create mode 100644 tests/api_resources/test_report_problem_with_trip.py diff --git a/.stats.yml b/.stats.yml index 948d808..4595462 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 24 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-9c3d349c8e661f7dc8c2585d02f334bb6ba3456f0d929c44d46454a0d190af7b.yml +configured_endpoints: 25 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-af6147ab6853e8f03d6d9df903ce1c1a36d6663e5a0c9f99524c4b4c9014a72c.yml diff --git a/api.md b/api.md index fcb81b4..a716431 100644 --- a/api.md +++ b/api.md @@ -251,6 +251,12 @@ Methods: - client.report_problem_with_stop.retrieve(stop_id, \*\*params) -> ResponseWrapper +# ReportProblemWithTrip + +Methods: + +- client.report_problem_with_trip.retrieve(trip_id, \*\*params) -> ResponseWrapper + # SearchForStop Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index b9cb088..9ddb44d 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -67,6 +67,7 @@ class OnebusawaySDK(SyncAPIClient): trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource report_problem_with_stop: resources.ReportProblemWithStopResource + report_problem_with_trip: resources.ReportProblemWithTripResource search_for_stop: resources.SearchForStopResource search_for_route: resources.SearchForRouteResource with_raw_response: OnebusawaySDKWithRawResponse @@ -147,6 +148,7 @@ def __init__( self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) + self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) self.search_for_stop = resources.SearchForStopResource(self) self.search_for_route = resources.SearchForRouteResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) @@ -287,6 +289,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource report_problem_with_stop: resources.AsyncReportProblemWithStopResource + report_problem_with_trip: resources.AsyncReportProblemWithTripResource search_for_stop: resources.AsyncSearchForStopResource search_for_route: resources.AsyncSearchForRouteResource with_raw_response: AsyncOnebusawaySDKWithRawResponse @@ -367,6 +370,7 @@ def __init__( self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) + self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) self.search_for_stop = resources.AsyncSearchForStopResource(self) self.search_for_route = resources.AsyncSearchForRouteResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) @@ -512,6 +516,9 @@ def __init__(self, client: OnebusawaySDK) -> None: self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) + self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithRawResponse( + client.report_problem_with_trip + ) self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route) @@ -545,6 +552,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) + self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithRawResponse( + client.report_problem_with_trip + ) self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) @@ -580,6 +590,9 @@ def __init__(self, client: OnebusawaySDK) -> None: self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) + self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithStreamingResponse( + client.report_problem_with_trip + ) self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route) @@ -627,6 +640,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) + self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithStreamingResponse( + client.report_problem_with_trip + ) self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 4bb8956..0fd5c13 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -184,6 +184,14 @@ ReportProblemWithStopResourceWithStreamingResponse, AsyncReportProblemWithStopResourceWithStreamingResponse, ) +from .report_problem_with_trip import ( + ReportProblemWithTripResource, + AsyncReportProblemWithTripResource, + ReportProblemWithTripResourceWithRawResponse, + AsyncReportProblemWithTripResourceWithRawResponse, + ReportProblemWithTripResourceWithStreamingResponse, + AsyncReportProblemWithTripResourceWithStreamingResponse, +) __all__ = [ "AgenciesWithCoverageResource", @@ -312,6 +320,12 @@ "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", + "ReportProblemWithTripResource", + "AsyncReportProblemWithTripResource", + "ReportProblemWithTripResourceWithRawResponse", + "AsyncReportProblemWithTripResourceWithRawResponse", + "ReportProblemWithTripResourceWithStreamingResponse", + "AsyncReportProblemWithTripResourceWithStreamingResponse", "SearchForStopResource", "AsyncSearchForStopResource", "SearchForStopResourceWithRawResponse", diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py new file mode 100644 index 0000000..910ec0c --- /dev/null +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -0,0 +1,260 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import report_problem_with_trip_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shared.response_wrapper import ResponseWrapper + +__all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] + + +class ReportProblemWithTripResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: + return ReportProblemWithTripResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingResponse: + return ReportProblemWithTripResourceWithStreamingResponse(self) + + def retrieve( + self, + trip_id: str, + *, + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] + | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: + """ + Submit a user-generated problem report for a particular trip. + + Args: + code: A string code identifying the nature of the problem + + service_date: The service date of the trip + + stop_id: A stop ID indicating where the user is experiencing the problem + + user_comment: Additional comment text supplied by the user describing the problem + + user_lat: The reporting user’s current latitude + + user_location_accuracy: The reporting user’s location accuracy, in meters + + user_lon: The reporting user’s current longitude + + user_on_vehicle: Indicator if the user is on the transit vehicle experiencing the problem + + user_vehicle_number: The vehicle number, as reported by the user + + vehicle_id: The vehicle actively serving the trip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not trip_id: + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + return self._get( + f"/api/where/report-problem-with-trip/{trip_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, + report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, + ), + ), + cast_to=ResponseWrapper, + ) + + +class AsyncReportProblemWithTripResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: + return AsyncReportProblemWithTripResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStreamingResponse: + return AsyncReportProblemWithTripResourceWithStreamingResponse(self) + + async def retrieve( + self, + trip_id: str, + *, + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] + | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: + """ + Submit a user-generated problem report for a particular trip. + + Args: + code: A string code identifying the nature of the problem + + service_date: The service date of the trip + + stop_id: A stop ID indicating where the user is experiencing the problem + + user_comment: Additional comment text supplied by the user describing the problem + + user_lat: The reporting user’s current latitude + + user_location_accuracy: The reporting user’s location accuracy, in meters + + user_lon: The reporting user’s current longitude + + user_on_vehicle: Indicator if the user is on the transit vehicle experiencing the problem + + user_vehicle_number: The vehicle number, as reported by the user + + vehicle_id: The vehicle actively serving the trip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not trip_id: + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + return await self._get( + f"/api/where/report-problem-with-trip/{trip_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, + report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, + ), + ), + cast_to=ResponseWrapper, + ) + + +class ReportProblemWithTripResourceWithRawResponse: + def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: + self._report_problem_with_trip = report_problem_with_trip + + self.retrieve = to_raw_response_wrapper( + report_problem_with_trip.retrieve, + ) + + +class AsyncReportProblemWithTripResourceWithRawResponse: + def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: + self._report_problem_with_trip = report_problem_with_trip + + self.retrieve = async_to_raw_response_wrapper( + report_problem_with_trip.retrieve, + ) + + +class ReportProblemWithTripResourceWithStreamingResponse: + def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: + self._report_problem_with_trip = report_problem_with_trip + + self.retrieve = to_streamed_response_wrapper( + report_problem_with_trip.retrieve, + ) + + +class AsyncReportProblemWithTripResourceWithStreamingResponse: + def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: + self._report_problem_with_trip = report_problem_with_trip + + self.retrieve = async_to_streamed_response_wrapper( + report_problem_with_trip.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index b8ab17b..21dbc8f 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -50,3 +50,6 @@ from .report_problem_with_stop_retrieve_params import ( ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, ) +from .report_problem_with_trip_retrieve_params import ( + ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams, +) diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py new file mode 100644 index 0000000..110e282 --- /dev/null +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ReportProblemWithTripRetrieveParams"] + + +class ReportProblemWithTripRetrieveParams(TypedDict, total=False): + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] + """A string code identifying the nature of the problem""" + + service_date: Annotated[int, PropertyInfo(alias="serviceDate")] + """The service date of the trip""" + + stop_id: Annotated[str, PropertyInfo(alias="stopId")] + """A stop ID indicating where the user is experiencing the problem""" + + user_comment: Annotated[str, PropertyInfo(alias="userComment")] + """Additional comment text supplied by the user describing the problem""" + + user_lat: Annotated[float, PropertyInfo(alias="userLat")] + """The reporting user’s current latitude""" + + user_location_accuracy: Annotated[float, PropertyInfo(alias="userLocationAccuracy")] + """The reporting user’s location accuracy, in meters""" + + user_lon: Annotated[float, PropertyInfo(alias="userLon")] + """The reporting user’s current longitude""" + + user_on_vehicle: Annotated[bool, PropertyInfo(alias="userOnVehicle")] + """Indicator if the user is on the transit vehicle experiencing the problem""" + + user_vehicle_number: Annotated[str, PropertyInfo(alias="userVehicleNumber")] + """The vehicle number, as reported by the user""" + + vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] + """The vehicle actively serving the trip""" diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py new file mode 100644 index 0000000..370fb6b --- /dev/null +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -0,0 +1,132 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types.shared import ResponseWrapper + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReportProblemWithTrip: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + report_problem_with_trip = client.report_problem_with_trip.retrieve( + trip_id="tripID", + ) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + report_problem_with_trip = client.report_problem_with_trip.retrieve( + trip_id="tripID", + code="vehicle_never_came", + service_date=0, + stop_id="stopId", + user_comment="userComment", + user_lat=0, + user_location_accuracy=0, + user_lon=0, + user_on_vehicle=True, + user_vehicle_number="userVehicleNumber", + vehicle_id="vehicleId", + ) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="tripID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + report_problem_with_trip = response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.report_problem_with_trip.with_streaming_response.retrieve( + trip_id="tripID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + report_problem_with_trip = response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): + client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) + + +class TestAsyncReportProblemWithTrip: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + report_problem_with_trip = await async_client.report_problem_with_trip.retrieve( + trip_id="tripID", + ) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + report_problem_with_trip = await async_client.report_problem_with_trip.retrieve( + trip_id="tripID", + code="vehicle_never_came", + service_date=0, + stop_id="stopId", + user_comment="userComment", + user_lat=0, + user_location_accuracy=0, + user_lon=0, + user_on_vehicle=True, + user_vehicle_number="userVehicleNumber", + vehicle_id="vehicleId", + ) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="tripID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + report_problem_with_trip = await response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.report_problem_with_trip.with_streaming_response.retrieve( + trip_id="tripID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + report_problem_with_trip = await response.parse() + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): + await async_client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) From e303bb64a39d45801d72141e13e00bac40771f71 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:12:12 +0000 Subject: [PATCH 047/397] chore(ci): bump prism mock server version (#73) --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index f586157..d2814ae 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" fi From b4db5b955b4880c1eea3bba00749bb9f4a78416b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:12:52 +0000 Subject: [PATCH 048/397] chore(internal): ensure package is importable in lint cmd (#74) --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6b799d2..079bbc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,10 +76,13 @@ format = { chain = [ "lint" = { chain = [ "check:ruff", "typecheck", + "check:importable", ]} "check:ruff" = "ruff check ." "fix:ruff" = "ruff check --fix ." +"check:importable" = "python -c 'import onebusaway'" + typecheck = { chain = [ "typecheck:pyright", "typecheck:mypy" From 6af5d8a93d7f516c9bb7a20e20d063944d0435e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:24:22 +0000 Subject: [PATCH 049/397] feat(api): OpenAPI spec update via Stainless API (#75) --- .stats.yml | 2 +- .../types/report_problem_with_trip_retrieve_params.py | 4 ++-- tests/api_resources/test_report_problem_with_trip.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4595462..f5e154f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-af6147ab6853e8f03d6d9df903ce1c1a36d6663e5a0c9f99524c4b4c9014a72c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f0a1f65a327091207db6d5ecc22149149967274b0c54c192cc442f93cc819c64.yml diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py index 110e282..f55386d 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -23,7 +23,7 @@ class ReportProblemWithTripRetrieveParams(TypedDict, total=False): service_date: Annotated[int, PropertyInfo(alias="serviceDate")] """The service date of the trip""" - stop_id: Annotated[str, PropertyInfo(alias="stopId")] + stop_id: Annotated[str, PropertyInfo(alias="stopID")] """A stop ID indicating where the user is experiencing the problem""" user_comment: Annotated[str, PropertyInfo(alias="userComment")] @@ -44,5 +44,5 @@ class ReportProblemWithTripRetrieveParams(TypedDict, total=False): user_vehicle_number: Annotated[str, PropertyInfo(alias="userVehicleNumber")] """The vehicle number, as reported by the user""" - vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] + vehicle_id: Annotated[str, PropertyInfo(alias="vehicleID")] """The vehicle actively serving the trip""" diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index 370fb6b..0bc9cf2 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -30,14 +30,14 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: trip_id="tripID", code="vehicle_never_came", service_date=0, - stop_id="stopId", + stop_id="stopID", user_comment="userComment", user_lat=0, user_location_accuracy=0, user_lon=0, user_on_vehicle=True, user_vehicle_number="userVehicleNumber", - vehicle_id="vehicleId", + vehicle_id="vehicleID", ) assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @@ -89,14 +89,14 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw trip_id="tripID", code="vehicle_never_came", service_date=0, - stop_id="stopId", + stop_id="stopID", user_comment="userComment", user_lat=0, user_location_accuracy=0, user_lon=0, user_on_vehicle=True, user_vehicle_number="userVehicleNumber", - vehicle_id="vehicleId", + vehicle_id="vehicleID", ) assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) From fe3becc93ad8817f73a8f787b5aa45bcd6175416 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:24:37 +0000 Subject: [PATCH 050/397] release: 0.1.0-alpha.16 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 08e82c4..7e56fe2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.15" + ".": "0.1.0-alpha.16" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e9143dc..4da71ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.1.0-alpha.16 (2024-08-10) + +Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.15...v0.1.0-alpha.16) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#71](https://github.com/OneBusAway/python-sdk/issues/71)) ([876b77c](https://github.com/OneBusAway/python-sdk/commit/876b77c3addf2460c3116738f7b4bc784f67350d)) +* **api:** OpenAPI spec update via Stainless API ([#75](https://github.com/OneBusAway/python-sdk/issues/75)) ([6af5d8a](https://github.com/OneBusAway/python-sdk/commit/6af5d8a93d7f516c9bb7a20e20d063944d0435e9)) + + +### Chores + +* **ci:** bump prism mock server version ([#73](https://github.com/OneBusAway/python-sdk/issues/73)) ([e303bb6](https://github.com/OneBusAway/python-sdk/commit/e303bb64a39d45801d72141e13e00bac40771f71)) +* **internal:** ensure package is importable in lint cmd ([#74](https://github.com/OneBusAway/python-sdk/issues/74)) ([b4db5b9](https://github.com/OneBusAway/python-sdk/commit/b4db5b955b4880c1eea3bba00749bb9f4a78416b)) + ## 0.1.0-alpha.15 (2024-08-08) Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.14...v0.1.0-alpha.15) diff --git a/pyproject.toml b/pyproject.toml index 079bbc5..aa1ab17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.15" +version = "0.1.0-alpha.16" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 794f5a5..cd3b65f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.15" # x-release-please-version +__version__ = "0.1.0-alpha.16" # x-release-please-version From 70ce97c2c90dcfa6635fd36f83a7fb71a321ca69 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:51:36 +0000 Subject: [PATCH 051/397] feat(api): OpenAPI spec update via Stainless API (#77) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/block.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/block_retrieve_response.py | 77 ++++++++++ tests/api_resources/test_block.py | 98 ++++++++++++ 8 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/block.py create mode 100644 src/onebusaway/types/block_retrieve_response.py create mode 100644 tests/api_resources/test_block.py diff --git a/.stats.yml b/.stats.yml index f5e154f..4b50dee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f0a1f65a327091207db6d5ecc22149149967274b0c54c192cc442f93cc819c64.yml +configured_endpoints: 26 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-fbc053e98085f73b2bf9d6a71bd4992c5eec1b582a030fb48b727cc0788ceae7.yml diff --git a/api.md b/api.md index a716431..19539e7 100644 --- a/api.md +++ b/api.md @@ -280,3 +280,15 @@ from onebusaway.types import SearchForRouteRetrieveResponse Methods: - client.search_for_route.retrieve(\*\*params) -> SearchForRouteRetrieveResponse + +# Block + +Types: + +```python +from onebusaway.types import BlockRetrieveResponse +``` + +Methods: + +- client.block.retrieve(block_id) -> BlockRetrieveResponse diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 9ddb44d..790b05d 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -70,6 +70,7 @@ class OnebusawaySDK(SyncAPIClient): report_problem_with_trip: resources.ReportProblemWithTripResource search_for_stop: resources.SearchForStopResource search_for_route: resources.SearchForRouteResource + block: resources.BlockResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -151,6 +152,7 @@ def __init__( self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) self.search_for_stop = resources.SearchForStopResource(self) self.search_for_route = resources.SearchForRouteResource(self) + self.block = resources.BlockResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -292,6 +294,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): report_problem_with_trip: resources.AsyncReportProblemWithTripResource search_for_stop: resources.AsyncSearchForStopResource search_for_route: resources.AsyncSearchForRouteResource + block: resources.AsyncBlockResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -373,6 +376,7 @@ def __init__( self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) self.search_for_stop = resources.AsyncSearchForStopResource(self) self.search_for_route = resources.AsyncSearchForRouteResource(self) + self.block = resources.AsyncBlockResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -521,6 +525,7 @@ def __init__(self, client: OnebusawaySDK) -> None: ) self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route) + self.block = resources.BlockResourceWithRawResponse(client.block) class AsyncOnebusawaySDKWithRawResponse: @@ -557,6 +562,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) + self.block = resources.AsyncBlockResourceWithRawResponse(client.block) class OnebusawaySDKWithStreamedResponse: @@ -595,6 +601,7 @@ def __init__(self, client: OnebusawaySDK) -> None: ) self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route) + self.block = resources.BlockResourceWithStreamingResponse(client.block) class AsyncOnebusawaySDKWithStreamedResponse: @@ -645,6 +652,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) + self.block = resources.AsyncBlockResourceWithStreamingResponse(client.block) Client = OnebusawaySDK diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 0fd5c13..9a9d3a7 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -16,6 +16,14 @@ TripResourceWithStreamingResponse, AsyncTripResourceWithStreamingResponse, ) +from .block import ( + BlockResource, + AsyncBlockResource, + BlockResourceWithRawResponse, + AsyncBlockResourceWithRawResponse, + BlockResourceWithStreamingResponse, + AsyncBlockResourceWithStreamingResponse, +) from .route import ( RouteResource, AsyncRouteResource, @@ -338,4 +346,10 @@ "AsyncSearchForRouteResourceWithRawResponse", "SearchForRouteResourceWithStreamingResponse", "AsyncSearchForRouteResourceWithStreamingResponse", + "BlockResource", + "AsyncBlockResource", + "BlockResourceWithRawResponse", + "AsyncBlockResourceWithRawResponse", + "BlockResourceWithStreamingResponse", + "AsyncBlockResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py new file mode 100644 index 0000000..cccb595 --- /dev/null +++ b/src/onebusaway/resources/block.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.block_retrieve_response import BlockRetrieveResponse + +__all__ = ["BlockResource", "AsyncBlockResource"] + + +class BlockResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BlockResourceWithRawResponse: + return BlockResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BlockResourceWithStreamingResponse: + return BlockResourceWithStreamingResponse(self) + + def retrieve( + self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BlockRetrieveResponse: + """ + Get details of a specific block by ID + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not block_id: + raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + return self._get( + f"/api/where/block/{block_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BlockRetrieveResponse, + ) + + +class AsyncBlockResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: + return AsyncBlockResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBlockResourceWithStreamingResponse: + return AsyncBlockResourceWithStreamingResponse(self) + + async def retrieve( + self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BlockRetrieveResponse: + """ + Get details of a specific block by ID + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not block_id: + raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + return await self._get( + f"/api/where/block/{block_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BlockRetrieveResponse, + ) + + +class BlockResourceWithRawResponse: + def __init__(self, block: BlockResource) -> None: + self._block = block + + self.retrieve = to_raw_response_wrapper( + block.retrieve, + ) + + +class AsyncBlockResourceWithRawResponse: + def __init__(self, block: AsyncBlockResource) -> None: + self._block = block + + self.retrieve = async_to_raw_response_wrapper( + block.retrieve, + ) + + +class BlockResourceWithStreamingResponse: + def __init__(self, block: BlockResource) -> None: + self._block = block + + self.retrieve = to_streamed_response_wrapper( + block.retrieve, + ) + + +class AsyncBlockResourceWithStreamingResponse: + def __init__(self, block: AsyncBlockResource) -> None: + self._block = block + + self.retrieve = async_to_streamed_response_wrapper( + block.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 21dbc8f..aac318c 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -5,6 +5,7 @@ from .shared import References as References, ResponseWrapper as ResponseWrapper from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse +from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py new file mode 100644 index 0000000..aecb822 --- /dev/null +++ b/src/onebusaway/types/block_retrieve_response.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "BlockRetrieveResponse", + "BlockRetrieveResponseData", + "BlockRetrieveResponseDataEntry", + "BlockRetrieveResponseDataEntryConfiguration", + "BlockRetrieveResponseDataEntryConfigurationTrip", + "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", + "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime", +] + + +class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime(BaseModel): + arrival_time: int = FieldInfo(alias="arrivalTime") + + departure_time: int = FieldInfo(alias="departureTime") + + stop_id: str = FieldInfo(alias="stopId") + + drop_off_type: Optional[int] = FieldInfo(alias="dropOffType", default=None) + + pickup_type: Optional[int] = FieldInfo(alias="pickupType", default=None) + + +class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime(BaseModel): + accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") + + block_sequence: int = FieldInfo(alias="blockSequence") + + distance_along_block: float = FieldInfo(alias="distanceAlongBlock") + + stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias="stopTime") + + +class BlockRetrieveResponseDataEntryConfigurationTrip(BaseModel): + accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") + + block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo( + alias="blockStopTimes" + ) + + distance_along_block: float = FieldInfo(alias="distanceAlongBlock") + + trip_id: str = FieldInfo(alias="tripId") + + +class BlockRetrieveResponseDataEntryConfiguration(BaseModel): + active_service_ids: List[str] = FieldInfo(alias="activeServiceIds") + + trips: List[BlockRetrieveResponseDataEntryConfigurationTrip] + + inactive_service_ids: Optional[List[str]] = FieldInfo(alias="inactiveServiceIds", default=None) + + +class BlockRetrieveResponseDataEntry(BaseModel): + id: str + + configurations: List[BlockRetrieveResponseDataEntryConfiguration] + + +class BlockRetrieveResponseData(BaseModel): + entry: BlockRetrieveResponseDataEntry + + references: References + + +class BlockRetrieveResponse(ResponseWrapper): + data: BlockRetrieveResponseData diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py new file mode 100644 index 0000000..a07a29b --- /dev/null +++ b/tests/api_resources/test_block.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import BlockRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBlock: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + block = client.block.retrieve( + "blockID", + ) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.block.with_raw_response.retrieve( + "blockID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + block = response.parse() + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.block.with_streaming_response.retrieve( + "blockID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + block = response.parse() + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): + client.block.with_raw_response.retrieve( + "", + ) + + +class TestAsyncBlock: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + block = await async_client.block.retrieve( + "blockID", + ) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.block.with_raw_response.retrieve( + "blockID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + block = await response.parse() + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.block.with_streaming_response.retrieve( + "blockID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + block = await response.parse() + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): + await async_client.block.with_raw_response.retrieve( + "", + ) From b31341a157b8b9aa554ad161afcbc581a041c3fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:16:33 +0000 Subject: [PATCH 052/397] feat(api): update via SDK Studio (#79) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/shape.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/shape_retrieve_response.py | 28 ++++ tests/api_resources/test_shape.py | 98 ++++++++++++ 8 files changed, 304 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/shape.py create mode 100644 src/onebusaway/types/shape_retrieve_response.py create mode 100644 tests/api_resources/test_shape.py diff --git a/.stats.yml b/.stats.yml index 4b50dee..c040587 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 26 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-fbc053e98085f73b2bf9d6a71bd4992c5eec1b582a030fb48b727cc0788ceae7.yml +configured_endpoints: 27 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.yml diff --git a/api.md b/api.md index 19539e7..a0341c8 100644 --- a/api.md +++ b/api.md @@ -292,3 +292,15 @@ from onebusaway.types import BlockRetrieveResponse Methods: - client.block.retrieve(block_id) -> BlockRetrieveResponse + +# Shape + +Types: + +```python +from onebusaway.types import ShapeRetrieveResponse +``` + +Methods: + +- client.shape.retrieve(shape_id) -> ShapeRetrieveResponse diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 790b05d..e981b14 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -71,6 +71,7 @@ class OnebusawaySDK(SyncAPIClient): search_for_stop: resources.SearchForStopResource search_for_route: resources.SearchForRouteResource block: resources.BlockResource + shape: resources.ShapeResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -153,6 +154,7 @@ def __init__( self.search_for_stop = resources.SearchForStopResource(self) self.search_for_route = resources.SearchForRouteResource(self) self.block = resources.BlockResource(self) + self.shape = resources.ShapeResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -295,6 +297,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): search_for_stop: resources.AsyncSearchForStopResource search_for_route: resources.AsyncSearchForRouteResource block: resources.AsyncBlockResource + shape: resources.AsyncShapeResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -377,6 +380,7 @@ def __init__( self.search_for_stop = resources.AsyncSearchForStopResource(self) self.search_for_route = resources.AsyncSearchForRouteResource(self) self.block = resources.AsyncBlockResource(self) + self.shape = resources.AsyncShapeResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -526,6 +530,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route) self.block = resources.BlockResourceWithRawResponse(client.block) + self.shape = resources.ShapeResourceWithRawResponse(client.shape) class AsyncOnebusawaySDKWithRawResponse: @@ -563,6 +568,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) self.block = resources.AsyncBlockResourceWithRawResponse(client.block) + self.shape = resources.AsyncShapeResourceWithRawResponse(client.shape) class OnebusawaySDKWithStreamedResponse: @@ -602,6 +608,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = resources.BlockResourceWithStreamingResponse(client.block) + self.shape = resources.ShapeResourceWithStreamingResponse(client.shape) class AsyncOnebusawaySDKWithStreamedResponse: @@ -653,6 +660,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = resources.AsyncBlockResourceWithStreamingResponse(client.block) + self.shape = resources.AsyncShapeResourceWithStreamingResponse(client.shape) Client = OnebusawaySDK diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 9a9d3a7..ddb6e30 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -32,6 +32,14 @@ RouteResourceWithStreamingResponse, AsyncRouteResourceWithStreamingResponse, ) +from .shape import ( + ShapeResource, + AsyncShapeResource, + ShapeResourceWithRawResponse, + AsyncShapeResourceWithRawResponse, + ShapeResourceWithStreamingResponse, + AsyncShapeResourceWithStreamingResponse, +) from .agency import ( AgencyResource, AsyncAgencyResource, @@ -352,4 +360,10 @@ "AsyncBlockResourceWithRawResponse", "BlockResourceWithStreamingResponse", "AsyncBlockResourceWithStreamingResponse", + "ShapeResource", + "AsyncShapeResource", + "ShapeResourceWithRawResponse", + "AsyncShapeResourceWithRawResponse", + "ShapeResourceWithStreamingResponse", + "AsyncShapeResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py new file mode 100644 index 0000000..699d7d8 --- /dev/null +++ b/src/onebusaway/resources/shape.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shape_retrieve_response import ShapeRetrieveResponse + +__all__ = ["ShapeResource", "AsyncShapeResource"] + + +class ShapeResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ShapeResourceWithRawResponse: + return ShapeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ShapeResourceWithStreamingResponse: + return ShapeResourceWithStreamingResponse(self) + + def retrieve( + self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ShapeRetrieveResponse: + """ + Retrieve a shape (the path traveled by a transit vehicle) by ID. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not shape_id: + raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + return self._get( + f"/api/where/shape/{shape_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShapeRetrieveResponse, + ) + + +class AsyncShapeResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: + return AsyncShapeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncShapeResourceWithStreamingResponse: + return AsyncShapeResourceWithStreamingResponse(self) + + async def retrieve( + self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ShapeRetrieveResponse: + """ + Retrieve a shape (the path traveled by a transit vehicle) by ID. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not shape_id: + raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + return await self._get( + f"/api/where/shape/{shape_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShapeRetrieveResponse, + ) + + +class ShapeResourceWithRawResponse: + def __init__(self, shape: ShapeResource) -> None: + self._shape = shape + + self.retrieve = to_raw_response_wrapper( + shape.retrieve, + ) + + +class AsyncShapeResourceWithRawResponse: + def __init__(self, shape: AsyncShapeResource) -> None: + self._shape = shape + + self.retrieve = async_to_raw_response_wrapper( + shape.retrieve, + ) + + +class ShapeResourceWithStreamingResponse: + def __init__(self, shape: ShapeResource) -> None: + self._shape = shape + + self.retrieve = to_streamed_response_wrapper( + shape.retrieve, + ) + + +class AsyncShapeResourceWithStreamingResponse: + def __init__(self, shape: AsyncShapeResource) -> None: + self._shape = shape + + self.retrieve = async_to_streamed_response_wrapper( + shape.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index aac318c..125bec1 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -7,6 +7,7 @@ from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse +from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py new file mode 100644 index 0000000..07a3b6a --- /dev/null +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] + + +class ShapeRetrieveResponseDataEntry(BaseModel): + length: int + + points: str + """Encoded polyline format representing the shape of the path""" + + levels: Optional[str] = None + + +class ShapeRetrieveResponseData(BaseModel): + entry: ShapeRetrieveResponseDataEntry + + references: References + + +class ShapeRetrieveResponse(ResponseWrapper): + data: ShapeRetrieveResponseData diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py new file mode 100644 index 0000000..369da7d --- /dev/null +++ b/tests/api_resources/test_shape.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import ShapeRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestShape: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + shape = client.shape.retrieve( + "shapeID", + ) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.shape.with_raw_response.retrieve( + "shapeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shape = response.parse() + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: + with client.shape.with_streaming_response.retrieve( + "shapeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shape = response.parse() + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): + client.shape.with_raw_response.retrieve( + "", + ) + + +class TestAsyncShape: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + shape = await async_client.shape.retrieve( + "shapeID", + ) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.shape.with_raw_response.retrieve( + "shapeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shape = await response.parse() + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.shape.with_streaming_response.retrieve( + "shapeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shape = await response.parse() + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): + await async_client.shape.with_raw_response.retrieve( + "", + ) From 9946c6b93568a4c2b72616d673fd64faf262a2b9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:16:49 +0000 Subject: [PATCH 053/397] release: 0.1.0-alpha.17 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7e56fe2..e2f2c07 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.16" + ".": "0.1.0-alpha.17" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da71ee..8e5ed6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.1.0-alpha.17 (2024-08-12) + +Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#77](https://github.com/OneBusAway/python-sdk/issues/77)) ([70ce97c](https://github.com/OneBusAway/python-sdk/commit/70ce97c2c90dcfa6635fd36f83a7fb71a321ca69)) +* **api:** update via SDK Studio ([#79](https://github.com/OneBusAway/python-sdk/issues/79)) ([b31341a](https://github.com/OneBusAway/python-sdk/commit/b31341a157b8b9aa554ad161afcbc581a041c3fb)) + ## 0.1.0-alpha.16 (2024-08-10) Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.15...v0.1.0-alpha.16) diff --git a/pyproject.toml b/pyproject.toml index aa1ab17..12eaef3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.16" +version = "0.1.0-alpha.17" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index cd3b65f..f3b8c3d 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.16" # x-release-please-version +__version__ = "0.1.0-alpha.17" # x-release-please-version From 46c36b9b441bcbbe3b022433a8d81a72ad7562cf Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 13 Aug 2024 02:26:02 +0300 Subject: [PATCH 054/397] feat: Add example to retrieve and print block data --- examples/block.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/block.py diff --git a/examples/block.py b/examples/block.py new file mode 100644 index 0000000..3388a5e --- /dev/null +++ b/examples/block.py @@ -0,0 +1,21 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +# Load settings from .env file, if it exists. If not, we'll use the +# Puget Sound server URL (which is also the default in the SDK) and +# the 'TEST' API key. +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +# Create a new instance of the OneBusAway SDK with the settings we loaded. +oba = OnebusawaySDK(**settings) + +block_id = '1_7310845' +response = oba.block.retrieve(block_id) +if response and response.data: + print(response.data.entry) From 66adf29e647c8d04d30581dc04b226cb802d2503 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 13 Aug 2024 02:26:16 +0300 Subject: [PATCH 055/397] feat: Add example for shape endpoint --- examples/shape.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/shape.py diff --git a/examples/shape.py b/examples/shape.py new file mode 100644 index 0000000..df3ee0a --- /dev/null +++ b/examples/shape.py @@ -0,0 +1,21 @@ +from helpers.load_env import load_settings + +from onebusaway import OnebusawaySDK + +# Load settings from .env file, if it exists. If not, we'll use the +# Puget Sound server URL (which is also the default in the SDK) and +# the 'TEST' API key. +settings = load_settings( + { + "api_key": "TEST", + "base_url": "https://api.pugetsound.onebusaway.org/", + } +) + +# Create a new instance of the OneBusAway SDK with the settings we loaded. +oba = OnebusawaySDK(**settings) + +shape_id = '1_10002005' +response = oba.shape.retrieve(shape_id) +if response and response.data: + print(response.data.entry) From 71f8ac8808bc984dc772435e3dd25fb851a27156 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:05:13 +0000 Subject: [PATCH 056/397] feat(api): OpenAPI spec update via Stainless API (#81) --- .stats.yml | 2 +- api.md | 24 +-- src/onebusaway/_client.py | 24 +-- src/onebusaway/resources/__init__.py | 28 +-- .../resources/agencies_with_coverage.py | 113 ----------- src/onebusaway/resources/trips_for_route.py | 188 +++++++++++++++++ src/onebusaway/types/__init__.py | 5 +- ...gencies_with_coverage_retrieve_response.py | 39 ---- .../types/agency_retrieve_response.py | 4 +- .../arrival_and_departure_list_response.py | 96 ++++----- ...arrival_and_departure_retrieve_response.py | 96 ++++----- .../types/trip_detail_retrieve_response.py | 96 ++++----- .../trip_for_vehicle_retrieve_response.py | 96 ++++----- .../trips_for_location_retrieve_response.py | 153 ++++++++++++++ .../types/trips_for_route_list_params.py | 23 +++ .../types/trips_for_route_list_response.py | 190 ++++++++++++++++++ .../vehicles_for_agency_list_response.py | 100 ++++----- .../test_agencies_with_coverage.py | 72 ------- tests/api_resources/test_trips_for_route.py | 118 +++++++++++ 19 files changed, 953 insertions(+), 514 deletions(-) delete mode 100644 src/onebusaway/resources/agencies_with_coverage.py create mode 100644 src/onebusaway/resources/trips_for_route.py delete mode 100644 src/onebusaway/types/agencies_with_coverage_retrieve_response.py create mode 100644 src/onebusaway/types/trips_for_route_list_params.py create mode 100644 src/onebusaway/types/trips_for_route_list_response.py delete mode 100644 tests/api_resources/test_agencies_with_coverage.py create mode 100644 tests/api_resources/test_trips_for_route.py diff --git a/.stats.yml b/.stats.yml index c040587..91dcce8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml diff --git a/api.md b/api.md index a0341c8..1fb8d95 100644 --- a/api.md +++ b/api.md @@ -4,18 +4,6 @@ from onebusaway.types import References, ResponseWrapper ``` -# AgenciesWithCoverage - -Types: - -```python -from onebusaway.types import AgenciesWithCoverageRetrieveResponse -``` - -Methods: - -- client.agencies_with_coverage.retrieve() -> AgenciesWithCoverageRetrieveResponse - # Agency Types: @@ -245,6 +233,18 @@ Methods: - client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse +# TripsForRoute + +Types: + +```python +from onebusaway.types import TripsForRouteListResponse +``` + +Methods: + +- client.trips_for_route.list(route_id, \*\*params) -> TripsForRouteListResponse + # ReportProblemWithStop Methods: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e981b14..21660e9 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -46,7 +46,6 @@ class OnebusawaySDK(SyncAPIClient): - agencies_with_coverage: resources.AgenciesWithCoverageResource agency: resources.AgencyResource vehicles_for_agency: resources.VehiclesForAgencyResource config: resources.ConfigResource @@ -66,6 +65,7 @@ class OnebusawaySDK(SyncAPIClient): trips_for_location: resources.TripsForLocationResource trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource + trips_for_route: resources.TripsForRouteResource report_problem_with_stop: resources.ReportProblemWithStopResource report_problem_with_trip: resources.ReportProblemWithTripResource search_for_stop: resources.SearchForStopResource @@ -129,7 +129,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self) self.agency = resources.AgencyResource(self) self.vehicles_for_agency = resources.VehiclesForAgencyResource(self) self.config = resources.ConfigResource(self) @@ -149,6 +148,7 @@ def __init__( self.trips_for_location = resources.TripsForLocationResource(self) self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) + self.trips_for_route = resources.TripsForRouteResource(self) self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) self.search_for_stop = resources.SearchForStopResource(self) @@ -272,7 +272,6 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): - agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -292,6 +291,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trips_for_location: resources.AsyncTripsForLocationResource trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource + trips_for_route: resources.AsyncTripsForRouteResource report_problem_with_stop: resources.AsyncReportProblemWithStopResource report_problem_with_trip: resources.AsyncReportProblemWithTripResource search_for_stop: resources.AsyncSearchForStopResource @@ -355,7 +355,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self) self.agency = resources.AsyncAgencyResource(self) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self) self.config = resources.AsyncConfigResource(self) @@ -375,6 +374,7 @@ def __init__( self.trips_for_location = resources.AsyncTripsForLocationResource(self) self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) + self.trips_for_route = resources.AsyncTripsForRouteResource(self) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) self.search_for_stop = resources.AsyncSearchForStopResource(self) @@ -499,9 +499,6 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) self.agency = resources.AgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithRawResponse(client.config) @@ -521,6 +518,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = resources.TripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -535,9 +533,6 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.AsyncConfigResourceWithRawResponse(client.config) @@ -559,6 +554,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -573,9 +569,6 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) self.agency = resources.AgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithStreamingResponse(client.config) @@ -599,6 +592,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = resources.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) @@ -613,9 +607,6 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse( client.vehicles_for_agency @@ -651,6 +642,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index ddb6e30..1778a99 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -88,6 +88,14 @@ StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse, ) +from .trips_for_route import ( + TripsForRouteResource, + AsyncTripsForRouteResource, + TripsForRouteResourceWithRawResponse, + AsyncTripsForRouteResourceWithRawResponse, + TripsForRouteResourceWithStreamingResponse, + AsyncTripsForRouteResourceWithStreamingResponse, +) from .search_for_route import ( SearchForRouteResource, AsyncSearchForRouteResource, @@ -184,14 +192,6 @@ ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse, ) -from .agencies_with_coverage import ( - AgenciesWithCoverageResource, - AsyncAgenciesWithCoverageResource, - AgenciesWithCoverageResourceWithRawResponse, - AsyncAgenciesWithCoverageResourceWithRawResponse, - AgenciesWithCoverageResourceWithStreamingResponse, - AsyncAgenciesWithCoverageResourceWithStreamingResponse, -) from .report_problem_with_stop import ( ReportProblemWithStopResource, AsyncReportProblemWithStopResource, @@ -210,12 +210,6 @@ ) __all__ = [ - "AgenciesWithCoverageResource", - "AsyncAgenciesWithCoverageResource", - "AgenciesWithCoverageResourceWithRawResponse", - "AsyncAgenciesWithCoverageResourceWithRawResponse", - "AgenciesWithCoverageResourceWithStreamingResponse", - "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", @@ -330,6 +324,12 @@ "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", + "TripsForRouteResource", + "AsyncTripsForRouteResource", + "TripsForRouteResourceWithRawResponse", + "AsyncTripsForRouteResourceWithRawResponse", + "TripsForRouteResourceWithStreamingResponse", + "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py deleted file mode 100644 index 60fa85e..0000000 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ /dev/null @@ -1,113 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.agencies_with_coverage_retrieve_response import AgenciesWithCoverageRetrieveResponse - -__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] - - -class AgenciesWithCoverageResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: - return AgenciesWithCoverageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: - return AgenciesWithCoverageResourceWithStreamingResponse(self) - - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" - return self._get( - "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgenciesWithCoverageRetrieveResponse, - ) - - -class AsyncAgenciesWithCoverageResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: - return AsyncAgenciesWithCoverageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: - return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" - return await self._get( - "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgenciesWithCoverageRetrieveResponse, - ) - - -class AgenciesWithCoverageResourceWithRawResponse: - def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = to_raw_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AsyncAgenciesWithCoverageResourceWithRawResponse: - def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = async_to_raw_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AgenciesWithCoverageResourceWithStreamingResponse: - def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = to_streamed_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AsyncAgenciesWithCoverageResourceWithStreamingResponse: - def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = async_to_streamed_response_wrapper( - agencies_with_coverage.retrieve, - ) diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py new file mode 100644 index 0000000..10364f1 --- /dev/null +++ b/src/onebusaway/resources/trips_for_route.py @@ -0,0 +1,188 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import trips_for_route_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trips_for_route_list_response import TripsForRouteListResponse + +__all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] + + +class TripsForRouteResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: + return TripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: + return TripsForRouteResourceWithStreamingResponse(self) + + def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/api/where/trips-for-route/{route_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class AsyncTripsForRouteResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: + return AsyncTripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResponse: + return AsyncTripsForRouteResourceWithStreamingResponse(self) + + async def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/api/where/trips-for-route/{route_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class TripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_raw_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_raw_response_wrapper( + trips_for_route.list, + ) + + +class TripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_streamed_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_streamed_response_wrapper( + trips_for_route.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 125bec1..ea300f0 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -12,8 +12,10 @@ from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams +from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse +from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams @@ -46,9 +48,6 @@ from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) -from .agencies_with_coverage_retrieve_response import ( - AgenciesWithCoverageRetrieveResponse as AgenciesWithCoverageRetrieveResponse, -) from .report_problem_with_stop_retrieve_params import ( ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, ) diff --git a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py deleted file mode 100644 index d4db507..0000000 --- a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .shared.references import References -from .shared.response_wrapper import ResponseWrapper - -__all__ = [ - "AgenciesWithCoverageRetrieveResponse", - "AgenciesWithCoverageRetrieveResponseData", - "AgenciesWithCoverageRetrieveResponseDataList", -] - - -class AgenciesWithCoverageRetrieveResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias="agencyId") - - lat: float - - lat_span: float = FieldInfo(alias="latSpan") - - lon: float - - lon_span: float = FieldInfo(alias="lonSpan") - - -class AgenciesWithCoverageRetrieveResponseData(BaseModel): - list: List[AgenciesWithCoverageRetrieveResponseDataList] - - references: References - - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - - -class AgenciesWithCoverageRetrieveResponse(ResponseWrapper): - data: AgenciesWithCoverageRetrieveResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 06000e6..61d8e79 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -36,9 +36,9 @@ class AgencyRetrieveResponseDataEntry(BaseModel): class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - references: References + limit_exceeded: bool = FieldInfo(alias="limitExceeded") - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + references: References class AgencyRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 362df0d..0f40a34 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -36,33 +36,69 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[ ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation ] = FieldInfo(alias="lastKnownLocation", default=None) @@ -71,12 +107,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -86,51 +116,21 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index b9a7507..e3b7d27 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -35,33 +35,69 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -70,12 +106,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -85,51 +115,21 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index d750fe0..f6b5c88 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -65,33 +65,69 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -100,12 +136,6 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -115,51 +145,21 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[TripDetailRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 42fa05e..9e42fbc 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -65,33 +65,69 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -100,12 +136,6 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -115,51 +145,21 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 0864e6d..433dd1d 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -12,16 +12,169 @@ "TripsForLocationRetrieveResponse", "TripsForLocationRetrieveResponseData", "TripsForLocationRetrieveResponseDataList", + "TripsForLocationRetrieveResponseDataListSchedule", + "TripsForLocationRetrieveResponseDataListScheduleStopTime", + "TripsForLocationRetrieveResponseDataListStatus", + "TripsForLocationRetrieveResponseDataListStatusLastKnownLocation", + "TripsForLocationRetrieveResponseDataListStatusPosition", ] +class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): + frequency: Optional[str] = None + + next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + + previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + + stop_times: Optional[List[TripsForLocationRetrieveResponseDataListScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class TripsForLocationRetrieveResponseDataListStatus(BaseModel): + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[TripsForLocationRetrieveResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) + """Last known location of the transit vehicle.""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[TripsForLocationRetrieveResponseDataListStatusPosition] = None + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + class TripsForLocationRetrieveResponseDataList(BaseModel): frequency: Optional[str] = None + schedule: Optional[TripsForLocationRetrieveResponseDataListSchedule] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + status: Optional[TripsForLocationRetrieveResponseDataListStatus] = None + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py new file mode 100644 index 0000000..c2f7ec0 --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["TripsForRouteListParams"] + + +class TripsForRouteListParams(TypedDict, total=False): + include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] + """Determine whether full schedule elements are included. Defaults to false.""" + + include_status: Annotated[bool, PropertyInfo(alias="includeStatus")] + """ + Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + """ + + time: int + """Query the system at a specific time. Useful for testing.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py new file mode 100644 index 0000000..2a3ec1f --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "TripsForRouteListResponse", + "TripsForRouteListResponseData", + "TripsForRouteListResponseDataList", + "TripsForRouteListResponseDataListSchedule", + "TripsForRouteListResponseDataListScheduleStopTime", + "TripsForRouteListResponseDataListStatus", + "TripsForRouteListResponseDataListStatusLastKnownLocation", + "TripsForRouteListResponseDataListStatusPosition", +] + + +class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class TripsForRouteListResponseDataListSchedule(BaseModel): + frequency: Optional[str] = None + + next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + + previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + + stop_times: Optional[List[TripsForRouteListResponseDataListScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class TripsForRouteListResponseDataListStatusPosition(BaseModel): + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class TripsForRouteListResponseDataListStatus(BaseModel): + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) + """Last known location of the transit vehicle.""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[TripsForRouteListResponseDataListStatusPosition] = None + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + +class TripsForRouteListResponseDataList(BaseModel): + frequency: Optional[str] = None + + schedule: Optional[TripsForRouteListResponseDataListSchedule] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + status: Optional[TripsForRouteListResponseDataListStatus] = None + + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + + +class TripsForRouteListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[TripsForRouteListResponseDataList] + + references: References + + +class TripsForRouteListResponse(ResponseWrapper): + data: TripsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 8675eda..34601dd 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -42,33 +42,69 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -77,12 +113,6 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -92,51 +122,21 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[VehiclesForAgencyListResponseDataListTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" @@ -166,12 +166,12 @@ class VehiclesForAgencyListResponseDataList(BaseModel): class VehiclesForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[VehiclesForAgencyListResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class VehiclesForAgencyListResponse(ResponseWrapper): data: VehiclesForAgencyListResponseData diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py deleted file mode 100644 index fd96982..0000000 --- a/tests/api_resources/test_agencies_with_coverage.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -from tests.utils import assert_matches_type -from onebusaway.types import AgenciesWithCoverageRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - agencies_with_coverage = client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.agencies_with_coverage.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - agencies_with_coverage = await async_client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.agencies_with_coverage.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py new file mode 100644 index 0000000..0ef4092 --- /dev/null +++ b/tests/api_resources/test_trips_for_route.py @@ -0,0 +1,118 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import TripsForRouteListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTripsForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.trips_for_route.with_raw_response.list( + route_id="", + ) + + +class TestAsyncTripsForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) From bb398472831ec5623b587568acfd99ecd44be886 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:11:19 +0000 Subject: [PATCH 057/397] chore(internal): codegen related update (#83) --- .stats.yml | 2 +- api.md | 12 ++ src/onebusaway/_client.py | 16 +++ src/onebusaway/resources/__init__.py | 14 +++ .../resources/agencies_with_coverage.py | 119 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../agencies_with_coverage_list_response.py | 39 ++++++ .../test_agencies_with_coverage.py | 72 +++++++++++ 8 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/onebusaway/resources/agencies_with_coverage.py create mode 100644 src/onebusaway/types/agencies_with_coverage_list_response.py create mode 100644 tests/api_resources/test_agencies_with_coverage.py diff --git a/.stats.yml b/.stats.yml index 91dcce8..1572fae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 27 +configured_endpoints: 28 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml diff --git a/api.md b/api.md index 1fb8d95..8998bc7 100644 --- a/api.md +++ b/api.md @@ -4,6 +4,18 @@ from onebusaway.types import References, ResponseWrapper ``` +# AgenciesWithCoverage + +Types: + +```python +from onebusaway.types import AgenciesWithCoverageListResponse +``` + +Methods: + +- client.agencies_with_coverage.list() -> AgenciesWithCoverageListResponse + # Agency Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 21660e9..9907b34 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -46,6 +46,7 @@ class OnebusawaySDK(SyncAPIClient): + agencies_with_coverage: resources.AgenciesWithCoverageResource agency: resources.AgencyResource vehicles_for_agency: resources.VehiclesForAgencyResource config: resources.ConfigResource @@ -129,6 +130,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self) self.agency = resources.AgencyResource(self) self.vehicles_for_agency = resources.VehiclesForAgencyResource(self) self.config = resources.ConfigResource(self) @@ -272,6 +274,7 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): + agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -355,6 +358,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self) self.agency = resources.AsyncAgencyResource(self) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self) self.config = resources.AsyncConfigResource(self) @@ -499,6 +503,9 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = resources.AgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithRawResponse(client.config) @@ -533,6 +540,9 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.AsyncConfigResourceWithRawResponse(client.config) @@ -569,6 +579,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = resources.AgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithStreamingResponse(client.config) @@ -607,6 +620,9 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse( client.vehicles_for_agency diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 1778a99..d72f3d6 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -192,6 +192,14 @@ ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse, ) +from .agencies_with_coverage import ( + AgenciesWithCoverageResource, + AsyncAgenciesWithCoverageResource, + AgenciesWithCoverageResourceWithRawResponse, + AsyncAgenciesWithCoverageResourceWithRawResponse, + AgenciesWithCoverageResourceWithStreamingResponse, + AsyncAgenciesWithCoverageResourceWithStreamingResponse, +) from .report_problem_with_stop import ( ReportProblemWithStopResource, AsyncReportProblemWithStopResource, @@ -210,6 +218,12 @@ ) __all__ = [ + "AgenciesWithCoverageResource", + "AsyncAgenciesWithCoverageResource", + "AgenciesWithCoverageResourceWithRawResponse", + "AsyncAgenciesWithCoverageResourceWithRawResponse", + "AgenciesWithCoverageResourceWithStreamingResponse", + "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py new file mode 100644 index 0000000..edab37b --- /dev/null +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse + +__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] + + +class AgenciesWithCoverageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: + return AgenciesWithCoverageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: + return AgenciesWithCoverageResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ + return self._get( + "/api/where/agencies-with-coverage.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AgenciesWithCoverageListResponse, + ) + + +class AsyncAgenciesWithCoverageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: + return AsyncAgenciesWithCoverageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: + return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ + return await self._get( + "/api/where/agencies-with-coverage.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AgenciesWithCoverageListResponse, + ) + + +class AgenciesWithCoverageResourceWithRawResponse: + def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = to_raw_response_wrapper( + agencies_with_coverage.list, + ) + + +class AsyncAgenciesWithCoverageResourceWithRawResponse: + def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = async_to_raw_response_wrapper( + agencies_with_coverage.list, + ) + + +class AgenciesWithCoverageResourceWithStreamingResponse: + def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = to_streamed_response_wrapper( + agencies_with_coverage.list, + ) + + +class AsyncAgenciesWithCoverageResourceWithStreamingResponse: + def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = async_to_streamed_response_wrapper( + agencies_with_coverage.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index ea300f0..8cdc638 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -36,6 +36,7 @@ from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py new file mode 100644 index 0000000..13f182b --- /dev/null +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "AgenciesWithCoverageListResponse", + "AgenciesWithCoverageListResponseData", + "AgenciesWithCoverageListResponseDataList", +] + + +class AgenciesWithCoverageListResponseDataList(BaseModel): + agency_id: str = FieldInfo(alias="agencyId") + + lat: float + + lat_span: float = FieldInfo(alias="latSpan") + + lon: float + + lon_span: float = FieldInfo(alias="lonSpan") + + +class AgenciesWithCoverageListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[AgenciesWithCoverageListResponseDataList] + + references: References + + +class AgenciesWithCoverageListResponse(ResponseWrapper): + data: AgenciesWithCoverageListResponseData diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py new file mode 100644 index 0000000..fad1087 --- /dev/null +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import AgenciesWithCoverageListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + agencies_with_coverage = client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.agencies_with_coverage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + agencies_with_coverage = response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.agencies_with_coverage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + agencies_with_coverage = response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + agencies_with_coverage = await async_client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agencies_with_coverage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + agencies_with_coverage = await response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.agencies_with_coverage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + agencies_with_coverage = await response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + assert cast(Any, response.is_closed) is True From 8dbeb49a6f799aaef5214d77cfa46ae0d45fd635 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:11:58 +0000 Subject: [PATCH 058/397] chore(internal): use different 32bit detection method (#84) --- src/onebusaway/_base_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 28c4797..30f5672 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import json import time import uuid @@ -1982,7 +1983,6 @@ def get_python_version() -> str: def get_architecture() -> Arch: try: - python_bitness, _ = platform.architecture() machine = platform.machine().lower() except Exception: return "unknown" @@ -1998,7 +1998,7 @@ def get_architecture() -> Arch: return "x64" # TODO: untested - if python_bitness == "32bit": + if sys.maxsize <= 2**32: return "x32" if machine: From 87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:30:41 +0000 Subject: [PATCH 059/397] feat(api): OpenAPI spec update via Stainless API (#85) --- .stats.yml | 2 +- .../types/trip_detail_retrieve_response.py | 12 ++++------ .../trip_for_vehicle_retrieve_response.py | 12 ++++------ .../trips_for_location_retrieve_response.py | 24 +++++++++---------- .../types/trips_for_route_list_response.py | 24 +++++++++---------- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1572fae..5cb9754 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5ea57ef7593fcb03a66448381178efc842002e4ba63aa97f238e8584c8b4a6ee.yml diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index f6b5c88..f7cf226 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -35,17 +35,15 @@ class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripDetailRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 9e42fbc..90abdd7 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -35,17 +35,15 @@ class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 433dd1d..522c204 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -35,17 +35,15 @@ class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripsForLocationRetrieveResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripsForLocationRetrieveResponseDataListScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): @@ -165,17 +163,17 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): class TripsForLocationRetrieveResponseDataList(BaseModel): - frequency: Optional[str] = None + schedule: TripsForLocationRetrieveResponseDataListSchedule - schedule: Optional[TripsForLocationRetrieveResponseDataListSchedule] = None + status: TripsForLocationRetrieveResponseDataListStatus - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + trip_id: str = FieldInfo(alias="tripId") - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + frequency: Optional[str] = None - status: Optional[TripsForLocationRetrieveResponseDataListStatus] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) class TripsForLocationRetrieveResponseData(BaseModel): diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index 2a3ec1f..f9bc2d8 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -35,17 +35,15 @@ class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): class TripsForRouteListResponseDataListSchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripsForRouteListResponseDataListScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): @@ -165,17 +163,17 @@ class TripsForRouteListResponseDataListStatus(BaseModel): class TripsForRouteListResponseDataList(BaseModel): - frequency: Optional[str] = None + schedule: TripsForRouteListResponseDataListSchedule - schedule: Optional[TripsForRouteListResponseDataListSchedule] = None + status: TripsForRouteListResponseDataListStatus - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + trip_id: str = FieldInfo(alias="tripId") - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + frequency: Optional[str] = None - status: Optional[TripsForRouteListResponseDataListStatus] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) class TripsForRouteListResponseData(BaseModel): From d63524a8e1e7a3ab863e964f2f81069fdd4e5761 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:19:02 +0000 Subject: [PATCH 060/397] feat(api): OpenAPI spec update via Stainless API (#86) --- api.md | 12 ++--- .../resources/routes_for_location.py | 36 ++++++------- .../resources/stops_for_location.py | 36 ++++++------- .../resources/trips_for_location.py | 36 ++++++------- src/onebusaway/types/__init__.py | 14 +++--- ....py => routes_for_location_list_params.py} | 4 +- ...y => routes_for_location_list_response.py} | 16 +++--- ...s.py => stops_for_location_list_params.py} | 4 +- ...py => stops_for_location_list_response.py} | 16 +++--- ...s.py => trips_for_location_list_params.py} | 4 +- ...py => trips_for_location_list_response.py} | 46 ++++++++--------- .../api_resources/test_routes_for_location.py | 50 +++++++++---------- .../api_resources/test_stops_for_location.py | 50 +++++++++---------- .../api_resources/test_trips_for_location.py | 50 +++++++++---------- 14 files changed, 184 insertions(+), 190 deletions(-) rename src/onebusaway/types/{routes_for_location_retrieve_params.py => routes_for_location_list_params.py} (79%) rename src/onebusaway/types/{routes_for_location_retrieve_response.py => routes_for_location_list_response.py} (70%) rename src/onebusaway/types/{stops_for_location_retrieve_params.py => stops_for_location_list_params.py} (64%) rename src/onebusaway/types/{stops_for_location_retrieve_response.py => stops_for_location_list_response.py} (66%) rename src/onebusaway/types/{trips_for_location_retrieve_params.py => trips_for_location_list_params.py} (90%) rename src/onebusaway/types/{trips_for_location_retrieve_response.py => trips_for_location_list_response.py} (79%) diff --git a/api.md b/api.md index 8998bc7..408a5c9 100644 --- a/api.md +++ b/api.md @@ -69,12 +69,12 @@ Methods: Types: ```python -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse ``` Methods: -- client.stops_for_location.retrieve(\*\*params) -> StopsForLocationRetrieveResponse +- client.stops_for_location.list(\*\*params) -> StopsForLocationListResponse # StopsForRoute @@ -153,12 +153,12 @@ Methods: Types: ```python -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse ``` Methods: -- client.routes_for_location.retrieve(\*\*params) -> RoutesForLocationRetrieveResponse +- client.routes_for_location.list(\*\*params) -> RoutesForLocationListResponse # RoutesForAgency @@ -214,12 +214,12 @@ Methods: Types: ```python -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse ``` Methods: -- client.trips_for_location.retrieve(\*\*params) -> TripsForLocationRetrieveResponse +- client.trips_for_location.list(\*\*params) -> TripsForLocationListResponse # TripDetails diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index 2c4d4e9..ee3bd19 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import routes_for_location_retrieve_params +from ..types import routes_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.routes_for_location_retrieve_response import RoutesForLocationRetrieveResponse +from ..types.routes_for_location_list_response import RoutesForLocationListResponse __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingResponse: return RoutesForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -48,7 +48,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -77,10 +77,10 @@ def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -93,7 +93,7 @@ def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreamingResponse: return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -108,7 +108,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -137,10 +137,10 @@ async def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -148,8 +148,8 @@ class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = to_raw_response_wrapper( + routes_for_location.list, ) @@ -157,8 +157,8 @@ class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + routes_for_location.list, ) @@ -166,8 +166,8 @@ class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = to_streamed_response_wrapper( + routes_for_location.list, ) @@ -175,6 +175,6 @@ class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + routes_for_location.list, ) diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index dd64b27..c0a635b 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import stops_for_location_retrieve_params +from ..types import stops_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.stops_for_location_retrieve_response import StopsForLocationRetrieveResponse +from ..types.stops_for_location_list_response import StopsForLocationListResponse __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> StopsForLocationResourceWithStreamingResponse: return StopsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float | NotGiven = NOT_GIVEN, @@ -44,7 +44,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location @@ -69,10 +69,10 @@ def retrieve( "lat": lat, "lon": lon, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -85,7 +85,7 @@ def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingResponse: return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float | NotGiven = NOT_GIVEN, @@ -96,7 +96,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location @@ -121,10 +121,10 @@ async def retrieve( "lat": lat, "lon": lon, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -132,8 +132,8 @@ class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = to_raw_response_wrapper( + stops_for_location.list, ) @@ -141,8 +141,8 @@ class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + stops_for_location.list, ) @@ -150,8 +150,8 @@ class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = to_streamed_response_wrapper( + stops_for_location.list, ) @@ -159,6 +159,6 @@ class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + stops_for_location.list, ) diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 947283d..31acdc0 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import trips_for_location_retrieve_params +from ..types import trips_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.trips_for_location_retrieve_response import TripsForLocationRetrieveResponse +from ..types.trips_for_location_list_response import TripsForLocationListResponse __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> TripsForLocationResourceWithStreamingResponse: return TripsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -49,7 +49,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -95,10 +95,10 @@ def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -111,7 +111,7 @@ def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingResponse: return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -127,7 +127,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -173,10 +173,10 @@ async def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -184,8 +184,8 @@ class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = to_raw_response_wrapper( + trips_for_location.list, ) @@ -193,8 +193,8 @@ class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + trips_for_location.list, ) @@ -202,8 +202,8 @@ class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = to_streamed_response_wrapper( + trips_for_location.list, ) @@ -211,6 +211,6 @@ class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + trips_for_location.list, ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 8cdc638..5f9bda3 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -17,12 +17,18 @@ from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams +from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .search_for_route_retrieve_params import SearchForRouteRetrieveParams as SearchForRouteRetrieveParams +from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams +from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams from .search_for_stop_retrieve_response import SearchForStopRetrieveResponse as SearchForStopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse @@ -30,22 +36,14 @@ from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams from .search_for_route_retrieve_response import SearchForRouteRetrieveResponse as SearchForRouteRetrieveResponse -from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse -from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse -from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse -from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse -from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse from .arrival_and_departure_retrieve_params import ( ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, ) -from .routes_for_location_retrieve_response import ( - RoutesForLocationRetrieveResponse as RoutesForLocationRetrieveResponse, -) from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) diff --git a/src/onebusaway/types/routes_for_location_retrieve_params.py b/src/onebusaway/types/routes_for_location_list_params.py similarity index 79% rename from src/onebusaway/types/routes_for_location_retrieve_params.py rename to src/onebusaway/types/routes_for_location_list_params.py index 9acd9ce..033ec2a 100644 --- a/src/onebusaway/types/routes_for_location_retrieve_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["RoutesForLocationRetrieveParams"] +__all__ = ["RoutesForLocationListParams"] -class RoutesForLocationRetrieveParams(TypedDict, total=False): +class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] lon: Required[float] diff --git a/src/onebusaway/types/routes_for_location_retrieve_response.py b/src/onebusaway/types/routes_for_location_list_response.py similarity index 70% rename from src/onebusaway/types/routes_for_location_retrieve_response.py rename to src/onebusaway/types/routes_for_location_list_response.py index a01a271..41fb72c 100644 --- a/src/onebusaway/types/routes_for_location_retrieve_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -9,13 +9,13 @@ from .shared.response_wrapper import ResponseWrapper __all__ = [ - "RoutesForLocationRetrieveResponse", - "RoutesForLocationRetrieveResponseData", - "RoutesForLocationRetrieveResponseDataList", + "RoutesForLocationListResponse", + "RoutesForLocationListResponseData", + "RoutesForLocationListResponseDataList", ] -class RoutesForLocationRetrieveResponseDataList(BaseModel): +class RoutesForLocationListResponseDataList(BaseModel): id: Optional[str] = None agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) @@ -37,15 +37,15 @@ class RoutesForLocationRetrieveResponseDataList(BaseModel): url: Optional[str] = None -class RoutesForLocationRetrieveResponseData(BaseModel): +class RoutesForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[RoutesForLocationRetrieveResponseDataList] + list: List[RoutesForLocationListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References -class RoutesForLocationRetrieveResponse(ResponseWrapper): - data: RoutesForLocationRetrieveResponseData +class RoutesForLocationListResponse(ResponseWrapper): + data: RoutesForLocationListResponseData diff --git a/src/onebusaway/types/stops_for_location_retrieve_params.py b/src/onebusaway/types/stops_for_location_list_params.py similarity index 64% rename from src/onebusaway/types/stops_for_location_retrieve_params.py rename to src/onebusaway/types/stops_for_location_list_params.py index b5c1ba6..e8d5496 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["StopsForLocationRetrieveParams"] +__all__ = ["StopsForLocationListParams"] -class StopsForLocationRetrieveParams(TypedDict, total=False): +class StopsForLocationListParams(TypedDict, total=False): lat: float lon: float diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_list_response.py similarity index 66% rename from src/onebusaway/types/stops_for_location_retrieve_response.py rename to src/onebusaway/types/stops_for_location_list_response.py index 628b246..a74aea4 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -8,14 +8,10 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopsForLocationRetrieveResponse", - "StopsForLocationRetrieveResponseData", - "StopsForLocationRetrieveResponseDataList", -] +__all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] -class StopsForLocationRetrieveResponseDataList(BaseModel): +class StopsForLocationListResponseDataList(BaseModel): id: str lat: float @@ -39,13 +35,13 @@ class StopsForLocationRetrieveResponseDataList(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) -class StopsForLocationRetrieveResponseData(BaseModel): +class StopsForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForLocationRetrieveResponseDataList] + list: List[StopsForLocationListResponseDataList] references: References -class StopsForLocationRetrieveResponse(ResponseWrapper): - data: StopsForLocationRetrieveResponseData +class StopsForLocationListResponse(ResponseWrapper): + data: StopsForLocationListResponseData diff --git a/src/onebusaway/types/trips_for_location_retrieve_params.py b/src/onebusaway/types/trips_for_location_list_params.py similarity index 90% rename from src/onebusaway/types/trips_for_location_retrieve_params.py rename to src/onebusaway/types/trips_for_location_list_params.py index 341a0fd..69a9186 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["TripsForLocationRetrieveParams"] +__all__ = ["TripsForLocationListParams"] -class TripsForLocationRetrieveParams(TypedDict, total=False): +class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] """The latitude coordinate of the search center""" diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_list_response.py similarity index 79% rename from src/onebusaway/types/trips_for_location_retrieve_response.py rename to src/onebusaway/types/trips_for_location_list_response.py index 522c204..cbeafa0 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -9,18 +9,18 @@ from .shared.response_wrapper import ResponseWrapper __all__ = [ - "TripsForLocationRetrieveResponse", - "TripsForLocationRetrieveResponseData", - "TripsForLocationRetrieveResponseDataList", - "TripsForLocationRetrieveResponseDataListSchedule", - "TripsForLocationRetrieveResponseDataListScheduleStopTime", - "TripsForLocationRetrieveResponseDataListStatus", - "TripsForLocationRetrieveResponseDataListStatusLastKnownLocation", - "TripsForLocationRetrieveResponseDataListStatusPosition", + "TripsForLocationListResponse", + "TripsForLocationListResponseData", + "TripsForLocationListResponseDataList", + "TripsForLocationListResponseDataListSchedule", + "TripsForLocationListResponseDataListScheduleStopTime", + "TripsForLocationListResponseDataListStatus", + "TripsForLocationListResponseDataListStatusLastKnownLocation", + "TripsForLocationListResponseDataListStatusPosition", ] -class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): +class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) @@ -34,19 +34,19 @@ class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) -class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): +class TripsForLocationListResponseDataListSchedule(BaseModel): next_trip_id: str = FieldInfo(alias="nextTripId") previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripsForLocationRetrieveResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None -class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): +class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -54,7 +54,7 @@ class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel) """Longitude of the last known location of the transit vehicle.""" -class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): +class TripsForLocationListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -62,7 +62,7 @@ class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): """Longitude of the current position of the transit vehicle.""" -class TripsForLocationRetrieveResponseDataListStatus(BaseModel): +class TripsForLocationListResponseDataListStatus(BaseModel): active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" @@ -126,7 +126,7 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForLocationRetrieveResponseDataListStatusLastKnownLocation] = FieldInfo( + last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) """Last known location of the transit vehicle.""" @@ -146,7 +146,7 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - position: Optional[TripsForLocationRetrieveResponseDataListStatusPosition] = None + position: Optional[TripsForLocationListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) @@ -162,10 +162,10 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): """ID of the transit vehicle currently serving the trip.""" -class TripsForLocationRetrieveResponseDataList(BaseModel): - schedule: TripsForLocationRetrieveResponseDataListSchedule +class TripsForLocationListResponseDataList(BaseModel): + schedule: TripsForLocationListResponseDataListSchedule - status: TripsForLocationRetrieveResponseDataListStatus + status: TripsForLocationListResponseDataListStatus trip_id: str = FieldInfo(alias="tripId") @@ -176,8 +176,8 @@ class TripsForLocationRetrieveResponseDataList(BaseModel): situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) -class TripsForLocationRetrieveResponseData(BaseModel): - list: List[TripsForLocationRetrieveResponseDataList] +class TripsForLocationListResponseData(BaseModel): + list: List[TripsForLocationListResponseDataList] references: References @@ -188,5 +188,5 @@ class TripsForLocationRetrieveResponseData(BaseModel): """Indicates if the search location is out of range""" -class TripsForLocationRetrieveResponse(ResponseWrapper): - data: TripsForLocationRetrieveResponseData +class TripsForLocationListResponse(ResponseWrapper): + data: TripsForLocationListResponseData diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 2e091e6..55fbc31 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,16 +18,16 @@ class TestRoutesForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -35,11 +35,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.routes_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -47,11 +47,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.routes_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -59,7 +59,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,16 +68,16 @@ class TestAsyncRoutesForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -85,11 +85,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.routes_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -97,11 +97,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.routes_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -109,6 +109,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index d1abaeb..ebe72d8 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,35 +18,35 @@ class TestStopsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + def test_method_list(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list() + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list( lat=0, lon=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.retrieve() + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_location.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.retrieve() as response: + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.stops_for_location.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -55,34 +55,34 @@ class TestAsyncStopsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list() + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.retrieve() + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_location.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.retrieve() as response: + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.stops_for_location.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 439faca..050d552 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,18 +18,18 @@ class TestTripsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -38,11 +38,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trips_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -52,11 +52,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.trips_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -66,7 +66,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,18 +75,18 @@ class TestAsyncTripsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -95,11 +95,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trips_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -109,11 +109,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.trips_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -123,6 +123,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True From d4f2ca03ce7778c127e70a6f7db86e0fb667e157 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:23:07 +0000 Subject: [PATCH 061/397] feat(api): OpenAPI spec update via Stainless API (#87) --- .stats.yml | 2 +- src/onebusaway/types/route_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/stop_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/trips_for_location_list_response.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5cb9754..40f1ffc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5ea57ef7593fcb03a66448381178efc842002e4ba63aa97f238e8584c8b4a6ee.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f162ca6ca596aea614dc8d4451e8fb35d4a6850870f5dcf087e83f61c2284276.yml diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index ffe9c32..193704e 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class RouteIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class RouteIDsForAgencyListResponse(ResponseWrapper): data: RouteIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index f36b63f..3ae9947 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class StopIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class StopIDsForAgencyListResponse(ResponseWrapper): data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index cbeafa0..68ae881 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -177,13 +177,13 @@ class TripsForLocationListResponseDataList(BaseModel): class TripsForLocationListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + """Indicates if the limit of trips has been exceeded""" + list: List[TripsForLocationListResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - """Indicates if the limit of trips has been exceeded""" - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) """Indicates if the search location is out of range""" From 3543b38cf9e4b8a4762c41f494c8f54a6451d091 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 18 Aug 2024 17:43:54 +0000 Subject: [PATCH 062/397] feat(api): OpenAPI spec update via Stainless API (#88) --- .stats.yml | 2 +- src/onebusaway/types/schedule_for_route_retrieve_response.py | 4 ++-- src/onebusaway/types/shared/references.py | 4 ++-- src/onebusaway/types/trip_detail_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_retrieve_response.py | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 40f1ffc..3c0b0ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f162ca6ca596aea614dc8d4451e8fb35d4a6850870f5dcf087e83f61c2284276.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-dc20a161fa6713b46e7406967f2d7bdf01e1e4ed6ce0d5a190b8ad54c0a189ae.yml diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 1c68056..17f04e0 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -88,6 +88,8 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -96,8 +98,6 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index cb39a86..6b8ecd6 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -237,6 +237,8 @@ class Trip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -245,8 +247,6 @@ class Trip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index f7cf226..4b76689 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -163,6 +163,8 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): class TripDetailRetrieveResponseDataEntry(BaseModel): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None @@ -173,8 +175,6 @@ class TripDetailRetrieveResponseDataEntry(BaseModel): status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 90abdd7..136b96c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -163,6 +163,8 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): class TripForVehicleRetrieveResponseDataEntry(BaseModel): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None @@ -173,8 +175,6 @@ class TripForVehicleRetrieveResponseDataEntry(BaseModel): status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index e939f2f..152bfa2 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -16,6 +16,8 @@ class TripRetrieveResponseDataEntry(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -24,8 +26,6 @@ class TripRetrieveResponseDataEntry(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) From b56865a9f16ef4117ac278dec6174a3507b4b1dc Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 20 Aug 2024 19:37:09 +0000 Subject: [PATCH 063/397] feat(api): OpenAPI spec update via Stainless API (#89) --- .devcontainer/Dockerfile | 0 .devcontainer/devcontainer.json | 0 .github/workflows/ci.yml | 0 .github/workflows/publish-pypi.yml | 0 .github/workflows/release-doctor.yml | 0 .gitignore | 0 .python-version | 0 .release-please-manifest.json | 0 .stats.yml | 2 +- Brewfile | 0 CONTRIBUTING.md | 0 LICENSE | 0 README.md | 0 SECURITY.md | 0 api.md | 0 bin/check-release-environment | 0 bin/publish-pypi | 0 examples/.keep | 0 mypy.ini | 0 noxfile.py | 0 pyproject.toml | 0 release-please-config.json | 0 requirements-dev.lock | 0 requirements.lock | 0 scripts/utils/ruffen-docs.py | 0 src/onebusaway/__init__.py | 0 src/onebusaway/_base_client.py | 0 src/onebusaway/_client.py | 0 src/onebusaway/_compat.py | 0 src/onebusaway/_constants.py | 0 src/onebusaway/_exceptions.py | 0 src/onebusaway/_files.py | 0 src/onebusaway/_models.py | 0 src/onebusaway/_qs.py | 0 src/onebusaway/_resource.py | 0 src/onebusaway/_response.py | 0 src/onebusaway/_streaming.py | 0 src/onebusaway/_types.py | 0 src/onebusaway/_utils/__init__.py | 0 src/onebusaway/_utils/_logs.py | 0 src/onebusaway/_utils/_proxy.py | 0 src/onebusaway/_utils/_reflection.py | 0 src/onebusaway/_utils/_streams.py | 0 src/onebusaway/_utils/_sync.py | 0 src/onebusaway/_utils/_transform.py | 0 src/onebusaway/_utils/_typing.py | 0 src/onebusaway/_utils/_utils.py | 0 src/onebusaway/_version.py | 0 src/onebusaway/lib/.keep | 0 src/onebusaway/py.typed | 0 src/onebusaway/resources/__init__.py | 0 .../resources/agencies_with_coverage.py | 0 src/onebusaway/resources/agency.py | 0 .../resources/arrival_and_departure.py | 0 src/onebusaway/resources/block.py | 0 src/onebusaway/resources/config.py | 0 src/onebusaway/resources/current_time.py | 0 .../resources/report_problem_with_stop.py | 0 .../resources/report_problem_with_trip.py | 0 src/onebusaway/resources/route.py | 0 .../resources/route_ids_for_agency.py | 0 src/onebusaway/resources/routes_for_agency.py | 0 .../resources/routes_for_location.py | 0 .../resources/schedule_for_route.py | 0 src/onebusaway/resources/schedule_for_stop.py | 0 src/onebusaway/resources/search_for_route.py | 0 src/onebusaway/resources/search_for_stop.py | 0 src/onebusaway/resources/shape.py | 0 src/onebusaway/resources/stop.py | 0 .../resources/stop_ids_for_agency.py | 0 .../resources/stops_for_location.py | 40 +++++++++++++++++-- src/onebusaway/resources/stops_for_route.py | 0 src/onebusaway/resources/trip.py | 0 src/onebusaway/resources/trip_details.py | 0 src/onebusaway/resources/trip_for_vehicle.py | 0 .../resources/trips_for_location.py | 0 src/onebusaway/resources/trips_for_route.py | 0 .../resources/vehicles_for_agency.py | 0 src/onebusaway/types/__init__.py | 0 .../agencies_with_coverage_list_response.py | 0 .../types/agency_retrieve_response.py | 0 .../arrival_and_departure_list_params.py | 0 .../arrival_and_departure_list_response.py | 0 .../arrival_and_departure_retrieve_params.py | 0 ...arrival_and_departure_retrieve_response.py | 0 .../types/block_retrieve_response.py | 0 .../types/config_retrieve_response.py | 0 .../types/current_time_retrieve_response.py | 0 ...eport_problem_with_stop_retrieve_params.py | 0 ...eport_problem_with_trip_retrieve_params.py | 0 .../route_ids_for_agency_list_response.py | 0 .../types/route_retrieve_response.py | 0 .../types/routes_for_agency_list_response.py | 0 .../types/routes_for_location_list_params.py | 0 .../routes_for_location_list_response.py | 0 .../schedule_for_route_retrieve_params.py | 0 .../schedule_for_route_retrieve_response.py | 0 .../schedule_for_stop_retrieve_params.py | 0 .../schedule_for_stop_retrieve_response.py | 0 .../types/search_for_route_retrieve_params.py | 0 .../search_for_route_retrieve_response.py | 0 .../types/search_for_stop_retrieve_params.py | 0 .../search_for_stop_retrieve_response.py | 0 .../types/shape_retrieve_response.py | 0 src/onebusaway/types/shared/__init__.py | 0 src/onebusaway/types/shared/references.py | 0 .../types/shared/response_wrapper.py | 0 .../stop_ids_for_agency_list_response.py | 0 .../types/stop_retrieve_response.py | 0 .../types/stops_for_location_list_params.py | 20 ++++++++-- .../types/stops_for_location_list_response.py | 0 .../types/stops_for_route_list_params.py | 0 .../types/stops_for_route_list_response.py | 0 .../types/trip_detail_retrieve_params.py | 0 .../types/trip_detail_retrieve_response.py | 0 .../types/trip_for_vehicle_retrieve_params.py | 0 .../trip_for_vehicle_retrieve_response.py | 0 .../types/trip_retrieve_response.py | 0 .../types/trips_for_location_list_params.py | 0 .../types/trips_for_location_list_response.py | 0 .../types/trips_for_route_list_params.py | 0 .../types/trips_for_route_list_response.py | 0 .../types/vehicles_for_agency_list_params.py | 0 .../vehicles_for_agency_list_response.py | 0 src/open_transit/lib/.keep | 0 tests/__init__.py | 0 tests/api_resources/__init__.py | 0 .../test_agencies_with_coverage.py | 0 tests/api_resources/test_agency.py | 0 .../test_arrival_and_departure.py | 0 tests/api_resources/test_block.py | 0 tests/api_resources/test_config.py | 0 tests/api_resources/test_current_time.py | 0 .../test_report_problem_with_stop.py | 0 .../test_report_problem_with_trip.py | 0 tests/api_resources/test_route.py | 0 .../test_route_ids_for_agency.py | 0 tests/api_resources/test_routes_for_agency.py | 0 .../api_resources/test_routes_for_location.py | 0 .../api_resources/test_schedule_for_route.py | 0 tests/api_resources/test_schedule_for_stop.py | 0 tests/api_resources/test_search_for_route.py | 0 tests/api_resources/test_search_for_stop.py | 0 tests/api_resources/test_shape.py | 0 tests/api_resources/test_stop.py | 0 .../api_resources/test_stop_ids_for_agency.py | 0 .../api_resources/test_stops_for_location.py | 38 +++++++++++++++--- tests/api_resources/test_stops_for_route.py | 0 tests/api_resources/test_trip.py | 0 tests/api_resources/test_trip_details.py | 0 tests/api_resources/test_trip_for_vehicle.py | 0 .../api_resources/test_trips_for_location.py | 0 tests/api_resources/test_trips_for_route.py | 0 .../api_resources/test_vehicles_for_agency.py | 0 tests/conftest.py | 0 tests/sample_file.txt | 0 tests/test_client.py | 0 tests/test_deepcopy.py | 0 tests/test_extract_files.py | 0 tests/test_files.py | 0 tests/test_models.py | 0 tests/test_qs.py | 0 tests/test_required_args.py | 0 tests/test_response.py | 0 tests/test_streaming.py | 0 tests/test_transform.py | 0 tests/test_utils/test_proxy.py | 0 tests/test_utils/test_typing.py | 0 tests/utils.py | 0 169 files changed, 86 insertions(+), 14 deletions(-) mode change 100644 => 100755 .devcontainer/Dockerfile mode change 100644 => 100755 .devcontainer/devcontainer.json mode change 100644 => 100755 .github/workflows/ci.yml mode change 100644 => 100755 .github/workflows/publish-pypi.yml mode change 100644 => 100755 .github/workflows/release-doctor.yml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .python-version mode change 100644 => 100755 .release-please-manifest.json mode change 100644 => 100755 .stats.yml mode change 100644 => 100755 Brewfile mode change 100644 => 100755 CONTRIBUTING.md mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 SECURITY.md mode change 100644 => 100755 api.md mode change 100644 => 100755 bin/check-release-environment mode change 100644 => 100755 bin/publish-pypi mode change 100644 => 100755 examples/.keep mode change 100644 => 100755 mypy.ini mode change 100644 => 100755 noxfile.py mode change 100644 => 100755 pyproject.toml mode change 100644 => 100755 release-please-config.json mode change 100644 => 100755 requirements-dev.lock mode change 100644 => 100755 requirements.lock mode change 100644 => 100755 scripts/utils/ruffen-docs.py mode change 100644 => 100755 src/onebusaway/__init__.py mode change 100644 => 100755 src/onebusaway/_base_client.py mode change 100644 => 100755 src/onebusaway/_client.py mode change 100644 => 100755 src/onebusaway/_compat.py mode change 100644 => 100755 src/onebusaway/_constants.py mode change 100644 => 100755 src/onebusaway/_exceptions.py mode change 100644 => 100755 src/onebusaway/_files.py mode change 100644 => 100755 src/onebusaway/_models.py mode change 100644 => 100755 src/onebusaway/_qs.py mode change 100644 => 100755 src/onebusaway/_resource.py mode change 100644 => 100755 src/onebusaway/_response.py mode change 100644 => 100755 src/onebusaway/_streaming.py mode change 100644 => 100755 src/onebusaway/_types.py mode change 100644 => 100755 src/onebusaway/_utils/__init__.py mode change 100644 => 100755 src/onebusaway/_utils/_logs.py mode change 100644 => 100755 src/onebusaway/_utils/_proxy.py mode change 100644 => 100755 src/onebusaway/_utils/_reflection.py mode change 100644 => 100755 src/onebusaway/_utils/_streams.py mode change 100644 => 100755 src/onebusaway/_utils/_sync.py mode change 100644 => 100755 src/onebusaway/_utils/_transform.py mode change 100644 => 100755 src/onebusaway/_utils/_typing.py mode change 100644 => 100755 src/onebusaway/_utils/_utils.py mode change 100644 => 100755 src/onebusaway/_version.py mode change 100644 => 100755 src/onebusaway/lib/.keep mode change 100644 => 100755 src/onebusaway/py.typed mode change 100644 => 100755 src/onebusaway/resources/__init__.py mode change 100644 => 100755 src/onebusaway/resources/agencies_with_coverage.py mode change 100644 => 100755 src/onebusaway/resources/agency.py mode change 100644 => 100755 src/onebusaway/resources/arrival_and_departure.py mode change 100644 => 100755 src/onebusaway/resources/block.py mode change 100644 => 100755 src/onebusaway/resources/config.py mode change 100644 => 100755 src/onebusaway/resources/current_time.py mode change 100644 => 100755 src/onebusaway/resources/report_problem_with_stop.py mode change 100644 => 100755 src/onebusaway/resources/report_problem_with_trip.py mode change 100644 => 100755 src/onebusaway/resources/route.py mode change 100644 => 100755 src/onebusaway/resources/route_ids_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/routes_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/routes_for_location.py mode change 100644 => 100755 src/onebusaway/resources/schedule_for_route.py mode change 100644 => 100755 src/onebusaway/resources/schedule_for_stop.py mode change 100644 => 100755 src/onebusaway/resources/search_for_route.py mode change 100644 => 100755 src/onebusaway/resources/search_for_stop.py mode change 100644 => 100755 src/onebusaway/resources/shape.py mode change 100644 => 100755 src/onebusaway/resources/stop.py mode change 100644 => 100755 src/onebusaway/resources/stop_ids_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/stops_for_location.py mode change 100644 => 100755 src/onebusaway/resources/stops_for_route.py mode change 100644 => 100755 src/onebusaway/resources/trip.py mode change 100644 => 100755 src/onebusaway/resources/trip_details.py mode change 100644 => 100755 src/onebusaway/resources/trip_for_vehicle.py mode change 100644 => 100755 src/onebusaway/resources/trips_for_location.py mode change 100644 => 100755 src/onebusaway/resources/trips_for_route.py mode change 100644 => 100755 src/onebusaway/resources/vehicles_for_agency.py mode change 100644 => 100755 src/onebusaway/types/__init__.py mode change 100644 => 100755 src/onebusaway/types/agencies_with_coverage_list_response.py mode change 100644 => 100755 src/onebusaway/types/agency_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_list_params.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_list_response.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/block_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/config_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/current_time_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/report_problem_with_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/report_problem_with_trip_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/route_ids_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/routes_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/routes_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/routes_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_route_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/search_for_route_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/search_for_route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/search_for_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/search_for_stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/shape_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/shared/__init__.py mode change 100644 => 100755 src/onebusaway/types/shared/references.py mode change 100644 => 100755 src/onebusaway/types/shared/response_wrapper.py mode change 100644 => 100755 src/onebusaway/types/stop_ids_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/stops_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/stops_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/stops_for_route_list_params.py mode change 100644 => 100755 src/onebusaway/types/stops_for_route_list_response.py mode change 100644 => 100755 src/onebusaway/types/trip_detail_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/trip_detail_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trip_for_vehicle_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/trip_for_vehicle_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trip_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trips_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/trips_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/trips_for_route_list_params.py mode change 100644 => 100755 src/onebusaway/types/trips_for_route_list_response.py mode change 100644 => 100755 src/onebusaway/types/vehicles_for_agency_list_params.py mode change 100644 => 100755 src/onebusaway/types/vehicles_for_agency_list_response.py mode change 100644 => 100755 src/open_transit/lib/.keep mode change 100644 => 100755 tests/__init__.py mode change 100644 => 100755 tests/api_resources/__init__.py mode change 100644 => 100755 tests/api_resources/test_agencies_with_coverage.py mode change 100644 => 100755 tests/api_resources/test_agency.py mode change 100644 => 100755 tests/api_resources/test_arrival_and_departure.py mode change 100644 => 100755 tests/api_resources/test_block.py mode change 100644 => 100755 tests/api_resources/test_config.py mode change 100644 => 100755 tests/api_resources/test_current_time.py mode change 100644 => 100755 tests/api_resources/test_report_problem_with_stop.py mode change 100644 => 100755 tests/api_resources/test_report_problem_with_trip.py mode change 100644 => 100755 tests/api_resources/test_route.py mode change 100644 => 100755 tests/api_resources/test_route_ids_for_agency.py mode change 100644 => 100755 tests/api_resources/test_routes_for_agency.py mode change 100644 => 100755 tests/api_resources/test_routes_for_location.py mode change 100644 => 100755 tests/api_resources/test_schedule_for_route.py mode change 100644 => 100755 tests/api_resources/test_schedule_for_stop.py mode change 100644 => 100755 tests/api_resources/test_search_for_route.py mode change 100644 => 100755 tests/api_resources/test_search_for_stop.py mode change 100644 => 100755 tests/api_resources/test_shape.py mode change 100644 => 100755 tests/api_resources/test_stop.py mode change 100644 => 100755 tests/api_resources/test_stop_ids_for_agency.py mode change 100644 => 100755 tests/api_resources/test_stops_for_location.py mode change 100644 => 100755 tests/api_resources/test_stops_for_route.py mode change 100644 => 100755 tests/api_resources/test_trip.py mode change 100644 => 100755 tests/api_resources/test_trip_details.py mode change 100644 => 100755 tests/api_resources/test_trip_for_vehicle.py mode change 100644 => 100755 tests/api_resources/test_trips_for_location.py mode change 100644 => 100755 tests/api_resources/test_trips_for_route.py mode change 100644 => 100755 tests/api_resources/test_vehicles_for_agency.py mode change 100644 => 100755 tests/conftest.py mode change 100644 => 100755 tests/sample_file.txt mode change 100644 => 100755 tests/test_client.py mode change 100644 => 100755 tests/test_deepcopy.py mode change 100644 => 100755 tests/test_extract_files.py mode change 100644 => 100755 tests/test_files.py mode change 100644 => 100755 tests/test_models.py mode change 100644 => 100755 tests/test_qs.py mode change 100644 => 100755 tests/test_required_args.py mode change 100644 => 100755 tests/test_response.py mode change 100644 => 100755 tests/test_streaming.py mode change 100644 => 100755 tests/test_transform.py mode change 100644 => 100755 tests/test_utils/test_proxy.py mode change 100644 => 100755 tests/test_utils/test_typing.py mode change 100644 => 100755 tests/utils.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile old mode 100644 new mode 100755 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json old mode 100644 new mode 100755 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.python-version b/.python-version old mode 100644 new mode 100755 diff --git a/.release-please-manifest.json b/.release-please-manifest.json old mode 100644 new mode 100755 diff --git a/.stats.yml b/.stats.yml old mode 100644 new mode 100755 index 3c0b0ee..aa31abd --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-dc20a161fa6713b46e7406967f2d7bdf01e1e4ed6ce0d5a190b8ad54c0a189ae.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-481b0f5d51c8b998b4f1939c96da73e5afcbe4e1fd9189a4cc3b00721c47a70b.yml diff --git a/Brewfile b/Brewfile old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SECURITY.md b/SECURITY.md old mode 100644 new mode 100755 diff --git a/api.md b/api.md old mode 100644 new mode 100755 diff --git a/bin/check-release-environment b/bin/check-release-environment old mode 100644 new mode 100755 diff --git a/bin/publish-pypi b/bin/publish-pypi old mode 100644 new mode 100755 diff --git a/examples/.keep b/examples/.keep old mode 100644 new mode 100755 diff --git a/mypy.ini b/mypy.ini old mode 100644 new mode 100755 diff --git a/noxfile.py b/noxfile.py old mode 100644 new mode 100755 diff --git a/pyproject.toml b/pyproject.toml old mode 100644 new mode 100755 diff --git a/release-please-config.json b/release-please-config.json old mode 100644 new mode 100755 diff --git a/requirements-dev.lock b/requirements-dev.lock old mode 100644 new mode 100755 diff --git a/requirements.lock b/requirements.lock old mode 100644 new mode 100755 diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_logs.py b/src/onebusaway/_utils/_logs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_reflection.py b/src/onebusaway/_utils/_reflection.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_streams.py b/src/onebusaway/_utils/_streams.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/lib/.keep b/src/onebusaway/lib/.keep old mode 100644 new mode 100755 diff --git a/src/onebusaway/py.typed b/src/onebusaway/py.typed old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py old mode 100644 new mode 100755 index c0a635b..43bdbcf --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -36,8 +36,12 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -49,6 +53,14 @@ def list( stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -68,6 +80,10 @@ def list( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, stops_for_location_list_params.StopsForLocationListParams, ), @@ -88,8 +104,12 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR async def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -101,6 +121,14 @@ async def list( stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -120,6 +148,10 @@ async def list( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, stops_for_location_list_params.StopsForLocationListParams, ), diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_params.py b/src/onebusaway/types/search_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_stop_retrieve_params.py b/src/onebusaway/types/search_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_stop_retrieve_response.py b/src/onebusaway/types/search_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py old mode 100644 new mode 100755 index e8d5496..3174257 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -2,12 +2,26 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = ["StopsForLocationListParams"] class StopsForLocationListParams(TypedDict, total=False): - lat: float + lat: Required[float] + + lon: Required[float] + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + query: str + """A search query string to filter the results""" - lon: float + radius: float + """The radius in meters to search within""" diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/open_transit/lib/.keep b/src/open_transit/lib/.keep old mode 100644 new mode 100755 diff --git a/tests/__init__.py b/tests/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py old mode 100644 new mode 100755 index ebe72d8..fcb2f07 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -19,7 +19,10 @@ class TestStopsForLocation: @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.list() + stops_for_location = client.stops_for_location.list( + lat=0, + lon=0, + ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize @@ -27,12 +30,19 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: stops_for_location = client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.list() + response = client.stops_for_location.with_raw_response.list( + lat=0, + lon=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -41,7 +51,10 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.list() as response: + with client.stops_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,7 +69,10 @@ class TestAsyncStopsForLocation: @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.list() + stops_for_location = await async_client.stops_for_location.list( + lat=0, + lon=0, + ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize @@ -64,12 +80,19 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.list() + response = await async_client.stops_for_location.with_raw_response.list( + lat=0, + lon=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -78,7 +101,10 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.list() as response: + async with async_client.stops_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100644 new mode 100755 diff --git a/tests/sample_file.txt b/tests/sample_file.txt old mode 100644 new mode 100755 diff --git a/tests/test_client.py b/tests/test_client.py old mode 100644 new mode 100755 diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py old mode 100644 new mode 100755 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py old mode 100644 new mode 100755 diff --git a/tests/test_files.py b/tests/test_files.py old mode 100644 new mode 100755 diff --git a/tests/test_models.py b/tests/test_models.py old mode 100644 new mode 100755 diff --git a/tests/test_qs.py b/tests/test_qs.py old mode 100644 new mode 100755 diff --git a/tests/test_required_args.py b/tests/test_required_args.py old mode 100644 new mode 100755 diff --git a/tests/test_response.py b/tests/test_response.py old mode 100644 new mode 100755 diff --git a/tests/test_streaming.py b/tests/test_streaming.py old mode 100644 new mode 100755 diff --git a/tests/test_transform.py b/tests/test_transform.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py old mode 100644 new mode 100755 diff --git a/tests/utils.py b/tests/utils.py old mode 100644 new mode 100755 From 38860c19de2e79ab7ca5054c2ec9357a1fd3690b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:25:06 +0000 Subject: [PATCH 064/397] chore(client): fix parsing union responses when non-json is returned (#91) --- src/onebusaway/_models.py | 2 ++ tests/test_response.py | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 5148d5a..d386eaa 100755 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -380,6 +380,8 @@ def is_basemodel(type_: type) -> bool: def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) diff --git a/tests/test_response.py b/tests/test_response.py index df94f16..3d799b5 100755 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1,5 +1,5 @@ import json -from typing import List, cast +from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx @@ -188,3 +188,40 @@ async def test_async_response_parse_annotated_type(async_client: AsyncOnebusaway ) assert obj.foo == "hello!" assert obj.bar == 2 + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: OnebusawaySDK) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncOnebusawaySDK) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" From 19a03345944154c4db06c96304e2e9b5bb2cbc57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:27:54 +0000 Subject: [PATCH 065/397] chore(ci): also run pydantic v1 tests (#92) --- scripts/test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/test b/scripts/test index b3ace90..4fa5698 100755 --- a/scripts/test +++ b/scripts/test @@ -54,3 +54,6 @@ fi echo "==> Running tests" rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" From be44ac517f04b963fc27b68d07f94b7da9fb7380 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:55:52 +0000 Subject: [PATCH 066/397] feat(api): OpenAPI spec update via Stainless API (#93) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index aa31abd..495e5b8 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-481b0f5d51c8b998b4f1939c96da73e5afcbe4e1fd9189a4cc3b00721c47a70b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5d3578218e0a9a09a4a4b3ee87d01c3ff80bbb80a280f8e2c8e700daf814ad59.yml From 2ebd77c7d359fd48b7ed8104223db7abc0157de1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:11:35 +0000 Subject: [PATCH 067/397] feat(api): OpenAPI spec update via Stainless API (#94) --- .stats.yml | 2 +- src/onebusaway/types/stops_for_route_list_response.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 495e5b8..4cc10ee 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5d3578218e0a9a09a4a4b3ee87d01c3ff80bbb80a280f8e2c8e700daf814ad59.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a544d1ade5b8bb78126cb4b1c3d63d7e77da8ef302ad4a92e3eeb86964d90c4a.yml diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 2aa1644..53cff4e 100755 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -66,9 +66,9 @@ class StopsForRouteListResponseDataEntry(BaseModel): class StopsForRouteListResponseData(BaseModel): - entry: Optional[StopsForRouteListResponseDataEntry] = None + entry: StopsForRouteListResponseDataEntry - references: Optional[References] = None + references: References class StopsForRouteListResponse(ResponseWrapper): From e2d0f6611c6309c2ee176bcfd7b7d47a368ea85e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:38:08 +0000 Subject: [PATCH 068/397] release: 0.1.0-alpha.18 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e2f2c07..3cf71e6 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.17" + ".": "0.1.0-alpha.18" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5ed6e..40c47e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.1.0-alpha.18 (2024-08-20) + +Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/OneBusAway/python-sdk/issues/81)) ([71f8ac8](https://github.com/OneBusAway/python-sdk/commit/71f8ac8808bc984dc772435e3dd25fb851a27156)) +* **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/OneBusAway/python-sdk/issues/85)) ([87a9f3f](https://github.com/OneBusAway/python-sdk/commit/87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084)) +* **api:** OpenAPI spec update via Stainless API ([#86](https://github.com/OneBusAway/python-sdk/issues/86)) ([d63524a](https://github.com/OneBusAway/python-sdk/commit/d63524a8e1e7a3ab863e964f2f81069fdd4e5761)) +* **api:** OpenAPI spec update via Stainless API ([#87](https://github.com/OneBusAway/python-sdk/issues/87)) ([d4f2ca0](https://github.com/OneBusAway/python-sdk/commit/d4f2ca03ce7778c127e70a6f7db86e0fb667e157)) +* **api:** OpenAPI spec update via Stainless API ([#88](https://github.com/OneBusAway/python-sdk/issues/88)) ([3543b38](https://github.com/OneBusAway/python-sdk/commit/3543b38cf9e4b8a4762c41f494c8f54a6451d091)) +* **api:** OpenAPI spec update via Stainless API ([#89](https://github.com/OneBusAway/python-sdk/issues/89)) ([b56865a](https://github.com/OneBusAway/python-sdk/commit/b56865a9f16ef4117ac278dec6174a3507b4b1dc)) +* **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/OneBusAway/python-sdk/issues/93)) ([be44ac5](https://github.com/OneBusAway/python-sdk/commit/be44ac517f04b963fc27b68d07f94b7da9fb7380)) +* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/OneBusAway/python-sdk/issues/94)) ([2ebd77c](https://github.com/OneBusAway/python-sdk/commit/2ebd77c7d359fd48b7ed8104223db7abc0157de1)) + + +### Chores + +* **ci:** also run pydantic v1 tests ([#92](https://github.com/OneBusAway/python-sdk/issues/92)) ([19a0334](https://github.com/OneBusAway/python-sdk/commit/19a03345944154c4db06c96304e2e9b5bb2cbc57)) +* **client:** fix parsing union responses when non-json is returned ([#91](https://github.com/OneBusAway/python-sdk/issues/91)) ([38860c1](https://github.com/OneBusAway/python-sdk/commit/38860c19de2e79ab7ca5054c2ec9357a1fd3690b)) +* **internal:** codegen related update ([#83](https://github.com/OneBusAway/python-sdk/issues/83)) ([bb39847](https://github.com/OneBusAway/python-sdk/commit/bb398472831ec5623b587568acfd99ecd44be886)) +* **internal:** use different 32bit detection method ([#84](https://github.com/OneBusAway/python-sdk/issues/84)) ([8dbeb49](https://github.com/OneBusAway/python-sdk/commit/8dbeb49a6f799aaef5214d77cfa46ae0d45fd635)) + ## 0.1.0-alpha.17 (2024-08-12) Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) diff --git a/pyproject.toml b/pyproject.toml index 12eaef3..6482a9b 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.17" +version = "0.1.0-alpha.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f3b8c3d..64d65a3 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.17" # x-release-please-version +__version__ = "0.1.0-alpha.18" # x-release-please-version From fe7ffd4390455897635899ebfeb599bc915307b6 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:40:30 +0300 Subject: [PATCH 069/397] chore: Update shape_id in shape.py --- examples/shape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/shape.py b/examples/shape.py index df3ee0a..6a12f22 100644 --- a/examples/shape.py +++ b/examples/shape.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -shape_id = '1_10002005' +shape_id = "1_10002005" response = oba.shape.retrieve(shape_id) if response and response.data: print(response.data.entry) From d55df6be5317f3d0ac85197d13a314b2dac4f6fc Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:40:32 +0300 Subject: [PATCH 070/397] feat: Update block_id in block.py --- examples/block.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/block.py b/examples/block.py index 3388a5e..1d819bd 100644 --- a/examples/block.py +++ b/examples/block.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -block_id = '1_7310845' +block_id = "1_7310845" response = oba.block.retrieve(block_id) if response and response.data: print(response.data.entry) From 6e7f4706ebcb41defc4f083771e7f09e469ca983 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:43:16 +0300 Subject: [PATCH 071/397] refactor: Update method name in agencies_with_coverage.py --- examples/agencies_with_coverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/agencies_with_coverage.py b/examples/agencies_with_coverage.py index 0e239ed..87a5fb3 100644 --- a/examples/agencies_with_coverage.py +++ b/examples/agencies_with_coverage.py @@ -17,5 +17,5 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -response = oba.agencies_with_coverage.retrieve() +response = oba.agencies_with_coverage.list() pprint(response.data) From f51f17aa85e99327c48b772af6d686f7dce49a64 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:43:19 +0300 Subject: [PATCH 072/397] refactor: Update stops_for_location method name in stops_for_location.py --- examples/stops_for_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index ea9b153..118d8f7 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -17,7 +17,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -space_needle_stops = oba.stops_for_location.retrieve( +space_needle_stops = oba.stops_for_location.list( lat=47.6205, lon=-122.3493, ) From 54d58cf81718aee18e852dda9ad260dfa9392404 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:21:42 +0000 Subject: [PATCH 073/397] feat(api): OpenAPI spec update via Stainless API (#95) --- .stats.yml | 2 +- src/onebusaway/types/routes_for_agency_list_response.py | 8 ++++---- src/onebusaway/types/routes_for_location_list_response.py | 8 ++++---- .../types/search_for_route_retrieve_response.py | 8 ++++---- src/onebusaway/types/shared/references.py | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4cc10ee..07ba8ae 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a544d1ade5b8bb78126cb4b1c3d63d7e77da8ef302ad4a92e3eeb86964d90c4a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-83d4377b09e39943094f0bda53346388c12f40aa4646da2344e99116b5717e21.yml diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 5ff3242..672141d 100755 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -12,9 +12,11 @@ class RoutesForAgencyListResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -28,8 +30,6 @@ class RoutesForAgencyListResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index 41fb72c..0393f01 100755 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -16,9 +16,11 @@ class RoutesForLocationListResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,8 +34,6 @@ class RoutesForLocationListResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py index 8eaa0d1..0ed8dc3 100755 --- a/src/onebusaway/types/search_for_route_retrieve_response.py +++ b/src/onebusaway/types/search_for_route_retrieve_response.py @@ -16,9 +16,11 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,8 +34,6 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 6b8ecd6..98e9026 100755 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -50,9 +50,11 @@ class Agency(BaseModel): class Route(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -66,8 +68,6 @@ class Route(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None From 7cc92e8d051f011599844cd9d3851521a94cc49b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:23:28 +0000 Subject: [PATCH 074/397] feat(api): OpenAPI spec update via Stainless API (#96) --- .stats.yml | 2 +- src/onebusaway/types/route_retrieve_response.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 07ba8ae..b826c0b 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-83d4377b09e39943094f0bda53346388c12f40aa4646da2344e99116b5717e21.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-cffcd7dbe7a6265368945b6f8fc3e8916930710bd0f34a49f914cdcf3da5f4f9.yml diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index 7a153e8..a0dfa1e 100755 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -12,9 +12,11 @@ class RouteRetrieveResponseDataEntry(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -22,12 +24,12 @@ class RouteRetrieveResponseDataEntry(BaseModel): long_name: Optional[str] = FieldInfo(alias="longName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None From c3ca610df71affbe1381fcfa5a85f22614098beb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:37:02 +0000 Subject: [PATCH 075/397] feat(api): OpenAPI spec update via Stainless API (#97) --- .stats.yml | 2 +- .../arrival_and_departure_list_response.py | 126 +++++++++--------- ...arrival_and_departure_retrieve_response.py | 126 +++++++++--------- 3 files changed, 127 insertions(+), 127 deletions(-) diff --git a/.stats.yml b/.stats.yml index b826c0b..e8d181d 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-cffcd7dbe7a6265368945b6f8fc3e8916930710bd0f34a49f914cdcf3da5f4f9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b2ed1f0adc6090a8bea561c2a33d10e568a72db450c59858ea8e41cf3127c398.yml diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 0f40a34..cbabf18 100755 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -136,18 +136,75 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" @@ -160,12 +217,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -175,27 +226,12 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -211,59 +247,23 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureListResponseDataEntry(BaseModel): arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index e3b7d27..a0bc771 100755 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -135,18 +135,75 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" @@ -159,12 +216,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -174,27 +225,12 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -210,59 +246,23 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry From 5468907372bcac765dfab488d6ec8992752e6658 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:37:16 +0000 Subject: [PATCH 076/397] release: 0.1.0-alpha.18 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 26 ++++++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e2f2c07..3cf71e6 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.17" + ".": "0.1.0-alpha.18" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5ed6e..d593bcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.1.0-alpha.18 (2024-08-20) + +Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/OneBusAway/python-sdk/issues/81)) ([71f8ac8](https://github.com/OneBusAway/python-sdk/commit/71f8ac8808bc984dc772435e3dd25fb851a27156)) +* **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/OneBusAway/python-sdk/issues/85)) ([87a9f3f](https://github.com/OneBusAway/python-sdk/commit/87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084)) +* **api:** OpenAPI spec update via Stainless API ([#86](https://github.com/OneBusAway/python-sdk/issues/86)) ([d63524a](https://github.com/OneBusAway/python-sdk/commit/d63524a8e1e7a3ab863e964f2f81069fdd4e5761)) +* **api:** OpenAPI spec update via Stainless API ([#87](https://github.com/OneBusAway/python-sdk/issues/87)) ([d4f2ca0](https://github.com/OneBusAway/python-sdk/commit/d4f2ca03ce7778c127e70a6f7db86e0fb667e157)) +* **api:** OpenAPI spec update via Stainless API ([#88](https://github.com/OneBusAway/python-sdk/issues/88)) ([3543b38](https://github.com/OneBusAway/python-sdk/commit/3543b38cf9e4b8a4762c41f494c8f54a6451d091)) +* **api:** OpenAPI spec update via Stainless API ([#89](https://github.com/OneBusAway/python-sdk/issues/89)) ([b56865a](https://github.com/OneBusAway/python-sdk/commit/b56865a9f16ef4117ac278dec6174a3507b4b1dc)) +* **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/OneBusAway/python-sdk/issues/93)) ([be44ac5](https://github.com/OneBusAway/python-sdk/commit/be44ac517f04b963fc27b68d07f94b7da9fb7380)) +* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/OneBusAway/python-sdk/issues/94)) ([2ebd77c](https://github.com/OneBusAway/python-sdk/commit/2ebd77c7d359fd48b7ed8104223db7abc0157de1)) +* **api:** OpenAPI spec update via Stainless API ([#95](https://github.com/OneBusAway/python-sdk/issues/95)) ([54d58cf](https://github.com/OneBusAway/python-sdk/commit/54d58cf81718aee18e852dda9ad260dfa9392404)) +* **api:** OpenAPI spec update via Stainless API ([#96](https://github.com/OneBusAway/python-sdk/issues/96)) ([7cc92e8](https://github.com/OneBusAway/python-sdk/commit/7cc92e8d051f011599844cd9d3851521a94cc49b)) +* **api:** OpenAPI spec update via Stainless API ([#97](https://github.com/OneBusAway/python-sdk/issues/97)) ([c3ca610](https://github.com/OneBusAway/python-sdk/commit/c3ca610df71affbe1381fcfa5a85f22614098beb)) + + +### Chores + +* **ci:** also run pydantic v1 tests ([#92](https://github.com/OneBusAway/python-sdk/issues/92)) ([19a0334](https://github.com/OneBusAway/python-sdk/commit/19a03345944154c4db06c96304e2e9b5bb2cbc57)) +* **client:** fix parsing union responses when non-json is returned ([#91](https://github.com/OneBusAway/python-sdk/issues/91)) ([38860c1](https://github.com/OneBusAway/python-sdk/commit/38860c19de2e79ab7ca5054c2ec9357a1fd3690b)) +* **internal:** codegen related update ([#83](https://github.com/OneBusAway/python-sdk/issues/83)) ([bb39847](https://github.com/OneBusAway/python-sdk/commit/bb398472831ec5623b587568acfd99ecd44be886)) +* **internal:** use different 32bit detection method ([#84](https://github.com/OneBusAway/python-sdk/issues/84)) ([8dbeb49](https://github.com/OneBusAway/python-sdk/commit/8dbeb49a6f799aaef5214d77cfa46ae0d45fd635)) + ## 0.1.0-alpha.17 (2024-08-12) Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) diff --git a/pyproject.toml b/pyproject.toml index 12eaef3..6482a9b 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.17" +version = "0.1.0-alpha.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f3b8c3d..64d65a3 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.17" # x-release-please-version +__version__ = "0.1.0-alpha.18" # x-release-please-version From 2b530418373d776a8d59c4e91b6ea028df7a1ecb Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Wed, 21 Aug 2024 01:59:15 +0300 Subject: [PATCH 077/397] refactor: update memory leaks tests --- tests/test_client.py | 248 +++++++++++++++++++++---------------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index a68fac1..06ae42b 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,13 +2,13 @@ from __future__ import annotations -# import gc +import gc import os import json import asyncio import inspect -# import tracemalloc +import tracemalloc from typing import Any, Union, cast from unittest import mock @@ -185,67 +185,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - # # - # # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -891,67 +891,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - - # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() async def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) From f83c6d18a8000cdb98a2e0244c127a08a427c1cc Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Wed, 21 Aug 2024 02:04:55 +0300 Subject: [PATCH 078/397] refactor: format test_client code --- tests/test_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 06ae42b..abc4d37 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -7,7 +7,6 @@ import json import asyncio import inspect - import tracemalloc from typing import Any, Union, cast from unittest import mock From e2d03b34d459ca5954c40af72c0a8ec13ca19f7e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:35:36 +0000 Subject: [PATCH 079/397] feat(api): OpenAPI spec update via Stainless API (#99) --- api.md | 8 +-- src/onebusaway/resources/search_for_route.py | 36 ++++++------- src/onebusaway/resources/search_for_stop.py | 36 ++++++------- src/onebusaway/types/__init__.py | 8 +-- .../types/search_for_route_list_params.py | 17 +++++++ .../types/search_for_route_list_response.py | 47 +++++++++++++++++ .../types/search_for_stop_list_params.py | 17 +++++++ .../types/search_for_stop_list_response.py | 49 ++++++++++++++++++ tests/api_resources/test_search_for_route.py | 50 +++++++++---------- tests/api_resources/test_search_for_stop.py | 50 +++++++++---------- 10 files changed, 224 insertions(+), 94 deletions(-) create mode 100755 src/onebusaway/types/search_for_route_list_params.py create mode 100755 src/onebusaway/types/search_for_route_list_response.py create mode 100755 src/onebusaway/types/search_for_stop_list_params.py create mode 100755 src/onebusaway/types/search_for_stop_list_response.py diff --git a/api.md b/api.md index 408a5c9..2a318ed 100755 --- a/api.md +++ b/api.md @@ -274,24 +274,24 @@ Methods: Types: ```python -from onebusaway.types import SearchForStopRetrieveResponse +from onebusaway.types import SearchForStopListResponse ``` Methods: -- client.search_for_stop.retrieve(\*\*params) -> SearchForStopRetrieveResponse +- client.search_for_stop.list(\*\*params) -> SearchForStopListResponse # SearchForRoute Types: ```python -from onebusaway.types import SearchForRouteRetrieveResponse +from onebusaway.types import SearchForRouteListResponse ``` Methods: -- client.search_for_route.retrieve(\*\*params) -> SearchForRouteRetrieveResponse +- client.search_for_route.list(\*\*params) -> SearchForRouteListResponse # Block diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index 455fd1a..b12e162 100755 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -4,7 +4,7 @@ import httpx -from ..types import search_for_route_retrieve_params +from ..types import search_for_route_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.search_for_route_retrieve_response import SearchForRouteRetrieveResponse +from ..types.search_for_route_list_response import SearchForRouteListResponse __all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse: return SearchForRouteResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, input: str, @@ -44,7 +44,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteRetrieveResponse: + ) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -73,10 +73,10 @@ def retrieve( "input": input, "max_count": max_count, }, - search_for_route_retrieve_params.SearchForRouteRetrieveParams, + search_for_route_list_params.SearchForRouteListParams, ), ), - cast_to=SearchForRouteRetrieveResponse, + cast_to=SearchForRouteListResponse, ) @@ -89,7 +89,7 @@ def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingResponse: return AsyncSearchForRouteResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, input: str, @@ -100,7 +100,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteRetrieveResponse: + ) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -129,10 +129,10 @@ async def retrieve( "input": input, "max_count": max_count, }, - search_for_route_retrieve_params.SearchForRouteRetrieveParams, + search_for_route_list_params.SearchForRouteListParams, ), ), - cast_to=SearchForRouteRetrieveResponse, + cast_to=SearchForRouteListResponse, ) @@ -140,8 +140,8 @@ class SearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route - self.retrieve = to_raw_response_wrapper( - search_for_route.retrieve, + self.list = to_raw_response_wrapper( + search_for_route.list, ) @@ -149,8 +149,8 @@ class AsyncSearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route - self.retrieve = async_to_raw_response_wrapper( - search_for_route.retrieve, + self.list = async_to_raw_response_wrapper( + search_for_route.list, ) @@ -158,8 +158,8 @@ class SearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route - self.retrieve = to_streamed_response_wrapper( - search_for_route.retrieve, + self.list = to_streamed_response_wrapper( + search_for_route.list, ) @@ -167,6 +167,6 @@ class AsyncSearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route - self.retrieve = async_to_streamed_response_wrapper( - search_for_route.retrieve, + self.list = async_to_streamed_response_wrapper( + search_for_route.list, ) diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 28a068e..8663227 100755 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -4,7 +4,7 @@ import httpx -from ..types import search_for_stop_retrieve_params +from ..types import search_for_stop_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.search_for_stop_retrieve_response import SearchForStopRetrieveResponse +from ..types.search_for_stop_list_response import SearchForStopListResponse __all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> SearchForStopResourceWithRawResponse: def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: return SearchForStopResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, input: str, @@ -44,7 +44,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopRetrieveResponse: + ) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -73,10 +73,10 @@ def retrieve( "input": input, "max_count": max_count, }, - search_for_stop_retrieve_params.SearchForStopRetrieveParams, + search_for_stop_list_params.SearchForStopListParams, ), ), - cast_to=SearchForStopRetrieveResponse, + cast_to=SearchForStopListResponse, ) @@ -89,7 +89,7 @@ def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResponse: return AsyncSearchForStopResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, input: str, @@ -100,7 +100,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopRetrieveResponse: + ) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -129,10 +129,10 @@ async def retrieve( "input": input, "max_count": max_count, }, - search_for_stop_retrieve_params.SearchForStopRetrieveParams, + search_for_stop_list_params.SearchForStopListParams, ), ), - cast_to=SearchForStopRetrieveResponse, + cast_to=SearchForStopListResponse, ) @@ -140,8 +140,8 @@ class SearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop - self.retrieve = to_raw_response_wrapper( - search_for_stop.retrieve, + self.list = to_raw_response_wrapper( + search_for_stop.list, ) @@ -149,8 +149,8 @@ class AsyncSearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop - self.retrieve = async_to_raw_response_wrapper( - search_for_stop.retrieve, + self.list = async_to_raw_response_wrapper( + search_for_stop.list, ) @@ -158,8 +158,8 @@ class SearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop - self.retrieve = to_streamed_response_wrapper( - search_for_stop.retrieve, + self.list = to_streamed_response_wrapper( + search_for_stop.list, ) @@ -167,6 +167,6 @@ class AsyncSearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop - self.retrieve = async_to_streamed_response_wrapper( - search_for_stop.retrieve, + self.list = async_to_streamed_response_wrapper( + search_for_stop.list, ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 5f9bda3..3d9dab0 100755 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -10,32 +10,32 @@ from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse +from .search_for_stop_list_params import SearchForStopListParams as SearchForStopListParams from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams +from .search_for_route_list_params import SearchForRouteListParams as SearchForRouteListParams +from .search_for_stop_list_response import SearchForStopListResponse as SearchForStopListResponse from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams -from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams -from .search_for_route_retrieve_params import SearchForRouteRetrieveParams as SearchForRouteRetrieveParams from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams -from .search_for_stop_retrieve_response import SearchForStopRetrieveResponse as SearchForStopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams -from .search_for_route_retrieve_response import SearchForRouteRetrieveResponse as SearchForRouteRetrieveResponse from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse diff --git a/src/onebusaway/types/search_for_route_list_params.py b/src/onebusaway/types/search_for_route_list_params.py new file mode 100755 index 0000000..76f767b --- /dev/null +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SearchForRouteListParams"] + + +class SearchForRouteListParams(TypedDict, total=False): + input: Required[str] + """The string to search for.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py new file mode 100755 index 0000000..e54153a --- /dev/null +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] + + +class SearchForRouteListResponseDataList(BaseModel): + id: str + + agency_id: str = FieldInfo(alias="agencyId") + + type: int + + color: Optional[str] = None + + description: Optional[str] = None + + long_name: Optional[str] = FieldInfo(alias="longName", default=None) + + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + + url: Optional[str] = None + + +class SearchForRouteListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[SearchForRouteListResponseDataList] + + out_of_range: bool = FieldInfo(alias="outOfRange") + + references: References + + +class SearchForRouteListResponse(ResponseWrapper): + data: Optional[SearchForRouteListResponseData] = None diff --git a/src/onebusaway/types/search_for_stop_list_params.py b/src/onebusaway/types/search_for_stop_list_params.py new file mode 100755 index 0000000..012f802 --- /dev/null +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SearchForStopListParams"] + + +class SearchForStopListParams(TypedDict, total=False): + input: Required[str] + """The string to search for.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py new file mode 100755 index 0000000..e5a4e29 --- /dev/null +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] + + +class SearchForStopListResponseDataList(BaseModel): + id: str + + code: str + + lat: float + + lon: float + + name: str + + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + parent: Optional[str] = None + + route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + + static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + + +class SearchForStopListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[SearchForStopListResponseDataList] + + out_of_range: bool = FieldInfo(alias="outOfRange") + + references: References + + +class SearchForStopListResponse(ResponseWrapper): + data: Optional[SearchForStopListResponseData] = None diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index e598023..76114f6 100755 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import SearchForRouteRetrieveResponse +from onebusaway.types import SearchForRouteListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,41 +18,41 @@ class TestSearchForRoute: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - search_for_route = client.search_for_route.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + search_for_route = client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - search_for_route = client.search_for_route.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + search_for_route = client.search_for_route.list( input="input", max_count=0, ) - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.search_for_route.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = response.parse() - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.search_for_route.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.search_for_route.with_streaming_response.list( input="input", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = response.parse() - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,40 +61,40 @@ class TestAsyncSearchForRoute: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - search_for_route = await async_client.search_for_route.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_route = await async_client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - search_for_route = await async_client.search_for_route.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_route = await async_client.search_for_route.list( input="input", max_count=0, ) - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.search_for_route.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = await response.parse() - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.search_for_route.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.search_for_route.with_streaming_response.list( input="input", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = await response.parse() - assert_matches_type(SearchForRouteRetrieveResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index c2af009..bed17ea 100755 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import SearchForStopRetrieveResponse +from onebusaway.types import SearchForStopListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,41 +18,41 @@ class TestSearchForStop: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - search_for_stop = client.search_for_stop.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + search_for_stop = client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - search_for_stop = client.search_for_stop.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + search_for_stop = client.search_for_stop.list( input="input", max_count=0, ) - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.search_for_stop.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = response.parse() - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.search_for_stop.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.search_for_stop.with_streaming_response.list( input="input", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = response.parse() - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,40 +61,40 @@ class TestAsyncSearchForStop: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - search_for_stop = await async_client.search_for_stop.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_stop = await async_client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - search_for_stop = await async_client.search_for_stop.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + search_for_stop = await async_client.search_for_stop.list( input="input", max_count=0, ) - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.search_for_stop.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = await response.parse() - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.search_for_stop.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.search_for_stop.with_streaming_response.list( input="input", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = await response.parse() - assert_matches_type(SearchForStopRetrieveResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) assert cast(Any, response.is_closed) is True From bf9931b74fef8f97a4b4dab40ba34b84afe61098 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:35:56 +0000 Subject: [PATCH 080/397] release: 0.1.0-alpha.19 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3cf71e6..b386bef 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.18" + ".": "0.1.0-alpha.19" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f403d7..69e29a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.19 (2024-08-24) + +Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.18...v0.1.0-alpha.19) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#99](https://github.com/OneBusAway/python-sdk/issues/99)) ([e2d03b3](https://github.com/OneBusAway/python-sdk/commit/e2d03b34d459ca5954c40af72c0a8ec13ca19f7e)) + ## 0.1.0-alpha.18 (2024-08-20) Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) diff --git a/pyproject.toml b/pyproject.toml index 6482a9b..9927c24 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.18" +version = "0.1.0-alpha.19" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 64d65a3..89a9515 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.18" # x-release-please-version +__version__ = "0.1.0-alpha.19" # x-release-please-version From 38f39dd90ffdc2e1a73344a58661438824e6990f Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Sat, 24 Aug 2024 14:46:08 +0300 Subject: [PATCH 081/397] refactor: use list rather than retrieve --- examples/search_for_route.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/search_for_route.py b/examples/search_for_route.py index 2d078d6..94f22f9 100644 --- a/examples/search_for_route.py +++ b/examples/search_for_route.py @@ -15,6 +15,6 @@ search_input = "crystal" # Retrieve the search results. -response = oba.search_for_route.retrieve(input=search_input) +response = oba.search_for_route.list(input=search_input) print(response.data) From c2f5413de7fb443dcd63e474fa80e6f082b3d247 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Sat, 24 Aug 2024 14:46:21 +0300 Subject: [PATCH 082/397] refactor: use list instead of retrieve --- examples/search_for_stop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/search_for_stop.py b/examples/search_for_stop.py index 75ecdeb..d969ffc 100644 --- a/examples/search_for_stop.py +++ b/examples/search_for_stop.py @@ -15,6 +15,6 @@ search_input = "crystal" # Retrieve the search results. -response = oba.search_for_stop.retrieve(input=search_input, max_count=5) +response = oba.search_for_stop.list(input=search_input, max_count=5) print(response.data) From 709a1305f5dfd8aed9f95ee69ffd0f192c1b413e Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Wed, 28 Aug 2024 19:18:46 +0300 Subject: [PATCH 083/397] chore: release: 1.0.0 From f5d93bc5b45811c5fdf45faae176c15568022b80 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:20:07 +0000 Subject: [PATCH 084/397] release: 1.0.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b386bef..fea3454 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.19" + ".": "1.0.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 69e29a2..b96f76b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.0.0 (2024-08-28) + +Full Changelog: [v0.1.0-alpha.19...v1.0.0](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.19...v1.0.0) + +### Chores + +* release: 1.0.0 ([709a130](https://github.com/OneBusAway/python-sdk/commit/709a1305f5dfd8aed9f95ee69ffd0f192c1b413e)) + ## 0.1.0-alpha.19 (2024-08-24) Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.18...v0.1.0-alpha.19) diff --git a/README.md b/README.md index 1d01edc..cdb67c5 100755 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de ```sh # install from PyPI -pip install --pre onebusaway +pip install onebusaway ``` ## Usage diff --git a/pyproject.toml b/pyproject.toml index 9927c24..6ae1a20 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.19" +version = "1.0.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 89a9515..ed64fee 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.19" # x-release-please-version +__version__ = "1.0.0" # x-release-please-version From 91dc384f5ed7f6ffac6b20ee356c9c8d9993495f Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Sat, 7 Sep 2024 11:25:09 +0000 Subject: [PATCH 085/397] fix file permissions --- .devcontainer/Dockerfile | 0 .devcontainer/devcontainer.json | 0 .github/workflows/ci.yml | 0 .github/workflows/publish-pypi.yml | 0 .github/workflows/release-doctor.yml | 0 .gitignore | 0 .python-version | 0 .release-please-manifest.json | 0 .stats.yml | 0 Brewfile | 0 CONTRIBUTING.md | 0 LICENSE | 0 README.md | 0 SECURITY.md | 0 api.md | 0 bin/check-release-environment | 0 bin/publish-pypi | 0 examples/.keep | 0 mypy.ini | 0 noxfile.py | 0 pyproject.toml | 0 release-please-config.json | 0 requirements-dev.lock | 0 requirements.lock | 0 scripts/utils/ruffen-docs.py | 0 src/onebusaway/__init__.py | 0 src/onebusaway/_base_client.py | 0 src/onebusaway/_client.py | 0 src/onebusaway/_compat.py | 0 src/onebusaway/_constants.py | 0 src/onebusaway/_exceptions.py | 0 src/onebusaway/_files.py | 0 src/onebusaway/_models.py | 0 src/onebusaway/_qs.py | 0 src/onebusaway/_resource.py | 0 src/onebusaway/_response.py | 0 src/onebusaway/_streaming.py | 0 src/onebusaway/_types.py | 0 src/onebusaway/_utils/__init__.py | 0 src/onebusaway/_utils/_logs.py | 0 src/onebusaway/_utils/_proxy.py | 0 src/onebusaway/_utils/_reflection.py | 0 src/onebusaway/_utils/_streams.py | 0 src/onebusaway/_utils/_sync.py | 0 src/onebusaway/_utils/_transform.py | 0 src/onebusaway/_utils/_typing.py | 0 src/onebusaway/_utils/_utils.py | 0 src/onebusaway/_version.py | 0 src/onebusaway/lib/.keep | 0 src/onebusaway/py.typed | 0 src/onebusaway/resources/__init__.py | 0 src/onebusaway/resources/agencies_with_coverage.py | 0 src/onebusaway/resources/agency.py | 0 src/onebusaway/resources/arrival_and_departure.py | 0 src/onebusaway/resources/block.py | 0 src/onebusaway/resources/config.py | 0 src/onebusaway/resources/current_time.py | 0 src/onebusaway/resources/report_problem_with_stop.py | 0 src/onebusaway/resources/report_problem_with_trip.py | 0 src/onebusaway/resources/route.py | 0 src/onebusaway/resources/route_ids_for_agency.py | 0 src/onebusaway/resources/routes_for_agency.py | 0 src/onebusaway/resources/routes_for_location.py | 0 src/onebusaway/resources/schedule_for_route.py | 0 src/onebusaway/resources/schedule_for_stop.py | 0 src/onebusaway/resources/search_for_route.py | 0 src/onebusaway/resources/search_for_stop.py | 0 src/onebusaway/resources/shape.py | 0 src/onebusaway/resources/stop.py | 0 src/onebusaway/resources/stop_ids_for_agency.py | 0 src/onebusaway/resources/stops_for_location.py | 0 src/onebusaway/resources/stops_for_route.py | 0 src/onebusaway/resources/trip.py | 0 src/onebusaway/resources/trip_details.py | 0 src/onebusaway/resources/trip_for_vehicle.py | 0 src/onebusaway/resources/trips_for_location.py | 0 src/onebusaway/resources/trips_for_route.py | 0 src/onebusaway/resources/vehicles_for_agency.py | 0 src/onebusaway/types/__init__.py | 0 src/onebusaway/types/agencies_with_coverage_list_response.py | 0 src/onebusaway/types/agency_retrieve_response.py | 0 src/onebusaway/types/arrival_and_departure_list_params.py | 0 src/onebusaway/types/arrival_and_departure_list_response.py | 0 src/onebusaway/types/arrival_and_departure_retrieve_params.py | 0 src/onebusaway/types/arrival_and_departure_retrieve_response.py | 0 src/onebusaway/types/block_retrieve_response.py | 0 src/onebusaway/types/config_retrieve_response.py | 0 src/onebusaway/types/current_time_retrieve_response.py | 0 src/onebusaway/types/report_problem_with_stop_retrieve_params.py | 0 src/onebusaway/types/report_problem_with_trip_retrieve_params.py | 0 src/onebusaway/types/route_ids_for_agency_list_response.py | 0 src/onebusaway/types/route_retrieve_response.py | 0 src/onebusaway/types/routes_for_agency_list_response.py | 0 src/onebusaway/types/routes_for_location_list_params.py | 0 src/onebusaway/types/routes_for_location_list_response.py | 0 src/onebusaway/types/schedule_for_route_retrieve_params.py | 0 src/onebusaway/types/schedule_for_route_retrieve_response.py | 0 src/onebusaway/types/schedule_for_stop_retrieve_params.py | 0 src/onebusaway/types/schedule_for_stop_retrieve_response.py | 0 src/onebusaway/types/shape_retrieve_response.py | 0 src/onebusaway/types/shared/__init__.py | 0 src/onebusaway/types/shared/references.py | 0 src/onebusaway/types/shared/response_wrapper.py | 0 src/onebusaway/types/stop_ids_for_agency_list_response.py | 0 src/onebusaway/types/stop_retrieve_response.py | 0 src/onebusaway/types/stops_for_location_list_params.py | 0 src/onebusaway/types/stops_for_location_list_response.py | 0 src/onebusaway/types/stops_for_route_list_params.py | 0 src/onebusaway/types/stops_for_route_list_response.py | 0 src/onebusaway/types/trip_detail_retrieve_params.py | 0 src/onebusaway/types/trip_detail_retrieve_response.py | 0 src/onebusaway/types/trip_for_vehicle_retrieve_params.py | 0 src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 0 src/onebusaway/types/trip_retrieve_response.py | 0 src/onebusaway/types/trips_for_location_list_params.py | 0 src/onebusaway/types/trips_for_location_list_response.py | 0 src/onebusaway/types/trips_for_route_list_params.py | 0 src/onebusaway/types/trips_for_route_list_response.py | 0 src/onebusaway/types/vehicles_for_agency_list_params.py | 0 src/onebusaway/types/vehicles_for_agency_list_response.py | 0 src/open_transit/lib/.keep | 0 tests/__init__.py | 0 tests/api_resources/__init__.py | 0 tests/api_resources/test_agencies_with_coverage.py | 0 tests/api_resources/test_agency.py | 0 tests/api_resources/test_arrival_and_departure.py | 0 tests/api_resources/test_block.py | 0 tests/api_resources/test_config.py | 0 tests/api_resources/test_current_time.py | 0 tests/api_resources/test_report_problem_with_stop.py | 0 tests/api_resources/test_report_problem_with_trip.py | 0 tests/api_resources/test_route.py | 0 tests/api_resources/test_route_ids_for_agency.py | 0 tests/api_resources/test_routes_for_agency.py | 0 tests/api_resources/test_routes_for_location.py | 0 tests/api_resources/test_schedule_for_route.py | 0 tests/api_resources/test_schedule_for_stop.py | 0 tests/api_resources/test_search_for_route.py | 0 tests/api_resources/test_search_for_stop.py | 0 tests/api_resources/test_shape.py | 0 tests/api_resources/test_stop.py | 0 tests/api_resources/test_stop_ids_for_agency.py | 0 tests/api_resources/test_stops_for_location.py | 0 tests/api_resources/test_stops_for_route.py | 0 tests/api_resources/test_trip.py | 0 tests/api_resources/test_trip_details.py | 0 tests/api_resources/test_trip_for_vehicle.py | 0 tests/api_resources/test_trips_for_location.py | 0 tests/api_resources/test_trips_for_route.py | 0 tests/api_resources/test_vehicles_for_agency.py | 0 tests/conftest.py | 0 tests/sample_file.txt | 0 tests/test_client.py | 0 tests/test_deepcopy.py | 0 tests/test_extract_files.py | 0 tests/test_files.py | 0 tests/test_models.py | 0 tests/test_qs.py | 0 tests/test_required_args.py | 0 tests/test_response.py | 0 tests/test_streaming.py | 0 tests/test_transform.py | 0 tests/test_utils/test_proxy.py | 0 tests/test_utils/test_typing.py | 0 tests/utils.py | 0 165 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .devcontainer/Dockerfile mode change 100755 => 100644 .devcontainer/devcontainer.json mode change 100755 => 100644 .github/workflows/ci.yml mode change 100755 => 100644 .github/workflows/publish-pypi.yml mode change 100755 => 100644 .github/workflows/release-doctor.yml mode change 100755 => 100644 .gitignore mode change 100755 => 100644 .python-version mode change 100755 => 100644 .release-please-manifest.json mode change 100755 => 100644 .stats.yml mode change 100755 => 100644 Brewfile mode change 100755 => 100644 CONTRIBUTING.md mode change 100755 => 100644 LICENSE mode change 100755 => 100644 README.md mode change 100755 => 100644 SECURITY.md mode change 100755 => 100644 api.md mode change 100755 => 100644 bin/check-release-environment mode change 100755 => 100644 bin/publish-pypi mode change 100755 => 100644 examples/.keep mode change 100755 => 100644 mypy.ini mode change 100755 => 100644 noxfile.py mode change 100755 => 100644 pyproject.toml mode change 100755 => 100644 release-please-config.json mode change 100755 => 100644 requirements-dev.lock mode change 100755 => 100644 requirements.lock mode change 100755 => 100644 scripts/utils/ruffen-docs.py mode change 100755 => 100644 src/onebusaway/__init__.py mode change 100755 => 100644 src/onebusaway/_base_client.py mode change 100755 => 100644 src/onebusaway/_client.py mode change 100755 => 100644 src/onebusaway/_compat.py mode change 100755 => 100644 src/onebusaway/_constants.py mode change 100755 => 100644 src/onebusaway/_exceptions.py mode change 100755 => 100644 src/onebusaway/_files.py mode change 100755 => 100644 src/onebusaway/_models.py mode change 100755 => 100644 src/onebusaway/_qs.py mode change 100755 => 100644 src/onebusaway/_resource.py mode change 100755 => 100644 src/onebusaway/_response.py mode change 100755 => 100644 src/onebusaway/_streaming.py mode change 100755 => 100644 src/onebusaway/_types.py mode change 100755 => 100644 src/onebusaway/_utils/__init__.py mode change 100755 => 100644 src/onebusaway/_utils/_logs.py mode change 100755 => 100644 src/onebusaway/_utils/_proxy.py mode change 100755 => 100644 src/onebusaway/_utils/_reflection.py mode change 100755 => 100644 src/onebusaway/_utils/_streams.py mode change 100755 => 100644 src/onebusaway/_utils/_sync.py mode change 100755 => 100644 src/onebusaway/_utils/_transform.py mode change 100755 => 100644 src/onebusaway/_utils/_typing.py mode change 100755 => 100644 src/onebusaway/_utils/_utils.py mode change 100755 => 100644 src/onebusaway/_version.py mode change 100755 => 100644 src/onebusaway/lib/.keep mode change 100755 => 100644 src/onebusaway/py.typed mode change 100755 => 100644 src/onebusaway/resources/__init__.py mode change 100755 => 100644 src/onebusaway/resources/agencies_with_coverage.py mode change 100755 => 100644 src/onebusaway/resources/agency.py mode change 100755 => 100644 src/onebusaway/resources/arrival_and_departure.py mode change 100755 => 100644 src/onebusaway/resources/block.py mode change 100755 => 100644 src/onebusaway/resources/config.py mode change 100755 => 100644 src/onebusaway/resources/current_time.py mode change 100755 => 100644 src/onebusaway/resources/report_problem_with_stop.py mode change 100755 => 100644 src/onebusaway/resources/report_problem_with_trip.py mode change 100755 => 100644 src/onebusaway/resources/route.py mode change 100755 => 100644 src/onebusaway/resources/route_ids_for_agency.py mode change 100755 => 100644 src/onebusaway/resources/routes_for_agency.py mode change 100755 => 100644 src/onebusaway/resources/routes_for_location.py mode change 100755 => 100644 src/onebusaway/resources/schedule_for_route.py mode change 100755 => 100644 src/onebusaway/resources/schedule_for_stop.py mode change 100755 => 100644 src/onebusaway/resources/search_for_route.py mode change 100755 => 100644 src/onebusaway/resources/search_for_stop.py mode change 100755 => 100644 src/onebusaway/resources/shape.py mode change 100755 => 100644 src/onebusaway/resources/stop.py mode change 100755 => 100644 src/onebusaway/resources/stop_ids_for_agency.py mode change 100755 => 100644 src/onebusaway/resources/stops_for_location.py mode change 100755 => 100644 src/onebusaway/resources/stops_for_route.py mode change 100755 => 100644 src/onebusaway/resources/trip.py mode change 100755 => 100644 src/onebusaway/resources/trip_details.py mode change 100755 => 100644 src/onebusaway/resources/trip_for_vehicle.py mode change 100755 => 100644 src/onebusaway/resources/trips_for_location.py mode change 100755 => 100644 src/onebusaway/resources/trips_for_route.py mode change 100755 => 100644 src/onebusaway/resources/vehicles_for_agency.py mode change 100755 => 100644 src/onebusaway/types/__init__.py mode change 100755 => 100644 src/onebusaway/types/agencies_with_coverage_list_response.py mode change 100755 => 100644 src/onebusaway/types/agency_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/arrival_and_departure_list_params.py mode change 100755 => 100644 src/onebusaway/types/arrival_and_departure_list_response.py mode change 100755 => 100644 src/onebusaway/types/arrival_and_departure_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/arrival_and_departure_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/block_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/config_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/current_time_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/report_problem_with_stop_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/report_problem_with_trip_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/route_ids_for_agency_list_response.py mode change 100755 => 100644 src/onebusaway/types/route_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/routes_for_agency_list_response.py mode change 100755 => 100644 src/onebusaway/types/routes_for_location_list_params.py mode change 100755 => 100644 src/onebusaway/types/routes_for_location_list_response.py mode change 100755 => 100644 src/onebusaway/types/schedule_for_route_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/schedule_for_route_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/schedule_for_stop_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/schedule_for_stop_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/shape_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/shared/__init__.py mode change 100755 => 100644 src/onebusaway/types/shared/references.py mode change 100755 => 100644 src/onebusaway/types/shared/response_wrapper.py mode change 100755 => 100644 src/onebusaway/types/stop_ids_for_agency_list_response.py mode change 100755 => 100644 src/onebusaway/types/stop_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/stops_for_location_list_params.py mode change 100755 => 100644 src/onebusaway/types/stops_for_location_list_response.py mode change 100755 => 100644 src/onebusaway/types/stops_for_route_list_params.py mode change 100755 => 100644 src/onebusaway/types/stops_for_route_list_response.py mode change 100755 => 100644 src/onebusaway/types/trip_detail_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/trip_detail_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/trip_for_vehicle_retrieve_params.py mode change 100755 => 100644 src/onebusaway/types/trip_for_vehicle_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/trip_retrieve_response.py mode change 100755 => 100644 src/onebusaway/types/trips_for_location_list_params.py mode change 100755 => 100644 src/onebusaway/types/trips_for_location_list_response.py mode change 100755 => 100644 src/onebusaway/types/trips_for_route_list_params.py mode change 100755 => 100644 src/onebusaway/types/trips_for_route_list_response.py mode change 100755 => 100644 src/onebusaway/types/vehicles_for_agency_list_params.py mode change 100755 => 100644 src/onebusaway/types/vehicles_for_agency_list_response.py mode change 100755 => 100644 src/open_transit/lib/.keep mode change 100755 => 100644 tests/__init__.py mode change 100755 => 100644 tests/api_resources/__init__.py mode change 100755 => 100644 tests/api_resources/test_agencies_with_coverage.py mode change 100755 => 100644 tests/api_resources/test_agency.py mode change 100755 => 100644 tests/api_resources/test_arrival_and_departure.py mode change 100755 => 100644 tests/api_resources/test_block.py mode change 100755 => 100644 tests/api_resources/test_config.py mode change 100755 => 100644 tests/api_resources/test_current_time.py mode change 100755 => 100644 tests/api_resources/test_report_problem_with_stop.py mode change 100755 => 100644 tests/api_resources/test_report_problem_with_trip.py mode change 100755 => 100644 tests/api_resources/test_route.py mode change 100755 => 100644 tests/api_resources/test_route_ids_for_agency.py mode change 100755 => 100644 tests/api_resources/test_routes_for_agency.py mode change 100755 => 100644 tests/api_resources/test_routes_for_location.py mode change 100755 => 100644 tests/api_resources/test_schedule_for_route.py mode change 100755 => 100644 tests/api_resources/test_schedule_for_stop.py mode change 100755 => 100644 tests/api_resources/test_search_for_route.py mode change 100755 => 100644 tests/api_resources/test_search_for_stop.py mode change 100755 => 100644 tests/api_resources/test_shape.py mode change 100755 => 100644 tests/api_resources/test_stop.py mode change 100755 => 100644 tests/api_resources/test_stop_ids_for_agency.py mode change 100755 => 100644 tests/api_resources/test_stops_for_location.py mode change 100755 => 100644 tests/api_resources/test_stops_for_route.py mode change 100755 => 100644 tests/api_resources/test_trip.py mode change 100755 => 100644 tests/api_resources/test_trip_details.py mode change 100755 => 100644 tests/api_resources/test_trip_for_vehicle.py mode change 100755 => 100644 tests/api_resources/test_trips_for_location.py mode change 100755 => 100644 tests/api_resources/test_trips_for_route.py mode change 100755 => 100644 tests/api_resources/test_vehicles_for_agency.py mode change 100755 => 100644 tests/conftest.py mode change 100755 => 100644 tests/sample_file.txt mode change 100755 => 100644 tests/test_client.py mode change 100755 => 100644 tests/test_deepcopy.py mode change 100755 => 100644 tests/test_extract_files.py mode change 100755 => 100644 tests/test_files.py mode change 100755 => 100644 tests/test_models.py mode change 100755 => 100644 tests/test_qs.py mode change 100755 => 100644 tests/test_required_args.py mode change 100755 => 100644 tests/test_response.py mode change 100755 => 100644 tests/test_streaming.py mode change 100755 => 100644 tests/test_transform.py mode change 100755 => 100644 tests/test_utils/test_proxy.py mode change 100755 => 100644 tests/test_utils/test_typing.py mode change 100755 => 100644 tests/utils.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile old mode 100755 new mode 100644 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json old mode 100755 new mode 100644 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/.python-version b/.python-version old mode 100755 new mode 100644 diff --git a/.release-please-manifest.json b/.release-please-manifest.json old mode 100755 new mode 100644 diff --git a/.stats.yml b/.stats.yml old mode 100755 new mode 100644 diff --git a/Brewfile b/Brewfile old mode 100755 new mode 100644 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/SECURITY.md b/SECURITY.md old mode 100755 new mode 100644 diff --git a/api.md b/api.md old mode 100755 new mode 100644 diff --git a/bin/check-release-environment b/bin/check-release-environment old mode 100755 new mode 100644 diff --git a/bin/publish-pypi b/bin/publish-pypi old mode 100755 new mode 100644 diff --git a/examples/.keep b/examples/.keep old mode 100755 new mode 100644 diff --git a/mypy.ini b/mypy.ini old mode 100755 new mode 100644 diff --git a/noxfile.py b/noxfile.py old mode 100755 new mode 100644 diff --git a/pyproject.toml b/pyproject.toml old mode 100755 new mode 100644 diff --git a/release-please-config.json b/release-please-config.json old mode 100755 new mode 100644 diff --git a/requirements-dev.lock b/requirements-dev.lock old mode 100755 new mode 100644 diff --git a/requirements.lock b/requirements.lock old mode 100755 new mode 100644 diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_logs.py b/src/onebusaway/_utils/_logs.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_reflection.py b/src/onebusaway/_utils/_reflection.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_streams.py b/src/onebusaway/_utils/_streams.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/lib/.keep b/src/onebusaway/lib/.keep old mode 100755 new mode 100644 diff --git a/src/onebusaway/py.typed b/src/onebusaway/py.typed old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py old mode 100755 new mode 100644 diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py old mode 100755 new mode 100644 diff --git a/src/open_transit/lib/.keep b/src/open_transit/lib/.keep old mode 100755 new mode 100644 diff --git a/tests/__init__.py b/tests/__init__.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py old mode 100755 new mode 100644 diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py old mode 100755 new mode 100644 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100755 new mode 100644 diff --git a/tests/sample_file.txt b/tests/sample_file.txt old mode 100755 new mode 100644 diff --git a/tests/test_client.py b/tests/test_client.py old mode 100755 new mode 100644 diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py old mode 100755 new mode 100644 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py old mode 100755 new mode 100644 diff --git a/tests/test_files.py b/tests/test_files.py old mode 100755 new mode 100644 diff --git a/tests/test_models.py b/tests/test_models.py old mode 100755 new mode 100644 diff --git a/tests/test_qs.py b/tests/test_qs.py old mode 100755 new mode 100644 diff --git a/tests/test_required_args.py b/tests/test_required_args.py old mode 100755 new mode 100644 diff --git a/tests/test_response.py b/tests/test_response.py old mode 100755 new mode 100644 diff --git a/tests/test_streaming.py b/tests/test_streaming.py old mode 100755 new mode 100644 diff --git a/tests/test_transform.py b/tests/test_transform.py old mode 100755 new mode 100644 diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py old mode 100755 new mode 100644 diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py old mode 100755 new mode 100644 diff --git a/tests/utils.py b/tests/utils.py old mode 100755 new mode 100644 From 1c46884dffc5766e2c0b03826b341e658ef4b58b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:27:23 +0000 Subject: [PATCH 086/397] chore(internal): codegen related update (#105) --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6ae1a20..e615040 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", "cached-property; python_version < '3.8'", - ] requires-python = ">= 3.7" classifiers = [ @@ -36,8 +35,6 @@ classifiers = [ "License :: OSI Approved :: Apache Software License" ] - - [project.urls] Homepage = "https://github.com/OneBusAway/python-sdk" Repository = "https://github.com/OneBusAway/python-sdk" @@ -59,7 +56,6 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - ] [tool.rye.scripts] From 0fecff5be41b8bc6049a49ed56eb80399eccf775 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:32:57 +0000 Subject: [PATCH 087/397] chore: add docstrings to raw response properties (#107) --- .../resources/agencies_with_coverage.py | 22 +++++++++++++++++++ src/onebusaway/resources/agency.py | 22 +++++++++++++++++++ .../resources/arrival_and_departure.py | 22 +++++++++++++++++++ src/onebusaway/resources/block.py | 22 +++++++++++++++++++ src/onebusaway/resources/config.py | 22 +++++++++++++++++++ src/onebusaway/resources/current_time.py | 22 +++++++++++++++++++ .../resources/report_problem_with_stop.py | 22 +++++++++++++++++++ .../resources/report_problem_with_trip.py | 22 +++++++++++++++++++ src/onebusaway/resources/route.py | 22 +++++++++++++++++++ .../resources/route_ids_for_agency.py | 22 +++++++++++++++++++ src/onebusaway/resources/routes_for_agency.py | 22 +++++++++++++++++++ .../resources/routes_for_location.py | 22 +++++++++++++++++++ .../resources/schedule_for_route.py | 22 +++++++++++++++++++ src/onebusaway/resources/schedule_for_stop.py | 22 +++++++++++++++++++ src/onebusaway/resources/search_for_route.py | 22 +++++++++++++++++++ src/onebusaway/resources/search_for_stop.py | 22 +++++++++++++++++++ src/onebusaway/resources/shape.py | 22 +++++++++++++++++++ src/onebusaway/resources/stop.py | 22 +++++++++++++++++++ .../resources/stop_ids_for_agency.py | 22 +++++++++++++++++++ .../resources/stops_for_location.py | 22 +++++++++++++++++++ src/onebusaway/resources/stops_for_route.py | 22 +++++++++++++++++++ src/onebusaway/resources/trip.py | 22 +++++++++++++++++++ src/onebusaway/resources/trip_details.py | 22 +++++++++++++++++++ src/onebusaway/resources/trip_for_vehicle.py | 22 +++++++++++++++++++ .../resources/trips_for_location.py | 22 +++++++++++++++++++ src/onebusaway/resources/trips_for_route.py | 22 +++++++++++++++++++ .../resources/vehicles_for_agency.py | 22 +++++++++++++++++++ 27 files changed, 594 insertions(+) diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index edab37b..3e4cdb3 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -22,10 +22,21 @@ class AgenciesWithCoverageResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AgenciesWithCoverageResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AgenciesWithCoverageResourceWithStreamingResponse(self) def list( @@ -54,10 +65,21 @@ def list( class AsyncAgenciesWithCoverageResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncAgenciesWithCoverageResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 0a9c46b..955614b 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -22,10 +22,21 @@ class AgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AgencyResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncAgencyResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 349e9af..20437d5 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -31,10 +31,21 @@ class ArrivalAndDepartureResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ArrivalAndDepartureResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ArrivalAndDepartureResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ArrivalAndDepartureResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ArrivalAndDepartureResourceWithStreamingResponse(self) def retrieve( @@ -145,10 +156,21 @@ def list( class AsyncArrivalAndDepartureResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncArrivalAndDepartureResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncArrivalAndDepartureResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncArrivalAndDepartureResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncArrivalAndDepartureResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index cccb595..8e0f23f 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -22,10 +22,21 @@ class BlockResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BlockResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return BlockResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> BlockResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return BlockResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncBlockResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncBlockResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncBlockResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncBlockResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 983c10e..56b30af 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -22,10 +22,21 @@ class ConfigResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ConfigResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ConfigResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ConfigResourceWithStreamingResponse(self) def retrieve( @@ -51,10 +62,21 @@ def retrieve( class AsyncConfigResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncConfigResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncConfigResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncConfigResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 70f504e..1923f27 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -22,10 +22,21 @@ class CurrentTimeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CurrentTimeResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return CurrentTimeResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> CurrentTimeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return CurrentTimeResourceWithStreamingResponse(self) def retrieve( @@ -51,10 +62,21 @@ def retrieve( class AsyncCurrentTimeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCurrentTimeResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncCurrentTimeResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncCurrentTimeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncCurrentTimeResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index 8a3bff7..b10f43f 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -29,10 +29,21 @@ class ReportProblemWithStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ReportProblemWithStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ReportProblemWithStopResourceWithStreamingResponse(self) def retrieve( @@ -101,10 +112,21 @@ def retrieve( class AsyncReportProblemWithStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncReportProblemWithStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncReportProblemWithStopResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index 910ec0c..140dab7 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -29,10 +29,21 @@ class ReportProblemWithTripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ReportProblemWithTripResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ReportProblemWithTripResourceWithStreamingResponse(self) def retrieve( @@ -128,10 +139,21 @@ def retrieve( class AsyncReportProblemWithTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncReportProblemWithTripResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncReportProblemWithTripResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 7cf9b32..110f91b 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -22,10 +22,21 @@ class RouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return RouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> RouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return RouteResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncRouteResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index acf0a16..69c45d9 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -22,10 +22,21 @@ class RouteIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return RouteIDsForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> RouteIDsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return RouteIDsForAgencyResourceWithStreamingResponse(self) def list( @@ -65,10 +76,21 @@ def list( class AsyncRouteIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncRouteIDsForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncRouteIDsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index 4364fd6..cc20b2d 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -22,10 +22,21 @@ class RoutesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return RoutesForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> RoutesForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return RoutesForAgencyResourceWithStreamingResponse(self) def list( @@ -65,10 +76,21 @@ def list( class AsyncRoutesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncRoutesForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncRoutesForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncRoutesForAgencyResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index ee3bd19..4eab85b 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -27,10 +27,21 @@ class RoutesForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return RoutesForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return RoutesForLocationResourceWithStreamingResponse(self) def list( @@ -87,10 +98,21 @@ def list( class AsyncRoutesForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncRoutesForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncRoutesForLocationResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index b43134a..8a69d22 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -27,10 +27,21 @@ class ScheduleForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ScheduleForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ScheduleForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ScheduleForRouteResourceWithStreamingResponse(self) def retrieve( @@ -80,10 +91,21 @@ def retrieve( class AsyncScheduleForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncScheduleForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncScheduleForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncScheduleForRouteResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 9b44909..fccd5d5 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -30,10 +30,21 @@ class ScheduleForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ScheduleForStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ScheduleForStopResourceWithStreamingResponse(self) def retrieve( @@ -81,10 +92,21 @@ def retrieve( class AsyncScheduleForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncScheduleForStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncScheduleForStopResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index b12e162..5d21094 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -27,10 +27,21 @@ class SearchForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return SearchForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return SearchForRouteResourceWithStreamingResponse(self) def list( @@ -83,10 +94,21 @@ def list( class AsyncSearchForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncSearchForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncSearchForRouteResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 8663227..78cf27b 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -27,10 +27,21 @@ class SearchForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return SearchForStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return SearchForStopResourceWithStreamingResponse(self) def list( @@ -83,10 +94,21 @@ def list( class AsyncSearchForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncSearchForStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncSearchForStopResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 699d7d8..c1bb6f7 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -22,10 +22,21 @@ class ShapeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ShapeResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return ShapeResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> ShapeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return ShapeResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncShapeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncShapeResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncShapeResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncShapeResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 10b95ec..2fec702 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -22,10 +22,21 @@ class StopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return StopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> StopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return StopResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncStopResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncStopResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index a611a6e..e1146b1 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -22,10 +22,21 @@ class StopIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return StopIDsForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return StopIDsForAgencyResourceWithStreamingResponse(self) def list( @@ -65,10 +76,21 @@ def list( class AsyncStopIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncStopIDsForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncStopIDsForAgencyResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 43bdbcf..a4fa7c8 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -27,10 +27,21 @@ class StopsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return StopsForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> StopsForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return StopsForLocationResourceWithStreamingResponse(self) def list( @@ -95,10 +106,21 @@ def list( class AsyncStopsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncStopsForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncStopsForLocationResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 2a8e5b8..3d1b92a 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -27,10 +27,21 @@ class StopsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return StopsForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> StopsForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return StopsForRouteResourceWithStreamingResponse(self) def list( @@ -86,10 +97,21 @@ def list( class AsyncStopsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncStopsForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncStopsForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncStopsForRouteResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index d4965a6..2484425 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -22,10 +22,21 @@ class TripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return TripResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> TripResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return TripResourceWithStreamingResponse(self) def retrieve( @@ -65,10 +76,21 @@ def retrieve( class AsyncTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncTripResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncTripResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncTripResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 7245d2b..a75d05a 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -27,10 +27,21 @@ class TripDetailsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripDetailsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return TripDetailsResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> TripDetailsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return TripDetailsResourceWithStreamingResponse(self) def retrieve( @@ -101,10 +112,21 @@ def retrieve( class AsyncTripDetailsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncTripDetailsResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncTripDetailsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncTripDetailsResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index b98c3ed..fdd77a2 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -27,10 +27,21 @@ class TripForVehicleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return TripForVehicleResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> TripForVehicleResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return TripForVehicleResourceWithStreamingResponse(self) def retrieve( @@ -97,10 +108,21 @@ def retrieve( class AsyncTripForVehicleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncTripForVehicleResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncTripForVehicleResourceWithStreamingResponse(self) async def retrieve( diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 31acdc0..2b8369c 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -27,10 +27,21 @@ class TripsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return TripsForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> TripsForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return TripsForLocationResourceWithStreamingResponse(self) def list( @@ -105,10 +116,21 @@ def list( class AsyncTripsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncTripsForLocationResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncTripsForLocationResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index 10364f1..2f715ba 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -27,10 +27,21 @@ class TripsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return TripsForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return TripsForRouteResourceWithStreamingResponse(self) def list( @@ -91,10 +102,21 @@ def list( class AsyncTripsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncTripsForRouteResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncTripsForRouteResourceWithStreamingResponse(self) async def list( diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 800559b..b423def 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -27,10 +27,21 @@ class VehiclesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return VehiclesForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return VehiclesForAgencyResourceWithStreamingResponse(self) def list( @@ -77,10 +88,21 @@ def list( class AsyncVehiclesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ return AsyncVehiclesForAgencyResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ return AsyncVehiclesForAgencyResourceWithStreamingResponse(self) async def list( From 01b74e91f822fedd4407b5de3d2fca1d03aaecbb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:33:20 +0000 Subject: [PATCH 088/397] docs(readme): add section on determining installed version (#108) --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index cdb67c5..d121816 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,17 @@ We take backwards-compatibility seriously and work hard to ensure you can rely o We are keen for your feedback; please open an [issue](https://www.github.com/OneBusAway/python-sdk/issues) with questions, bugs, or suggestions. +### Determining the installed version + +If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version. + +You can determine the version that is being used at runtime with: + +```py +import onebusaway +print(onebusaway.__version__) +``` + ## Requirements Python 3.7 or higher. From 89d809e01baa6cd1b1b98c45e88853584f8ac8a3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:49:30 +0000 Subject: [PATCH 089/397] chore(internal): codegen related update (#109) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d121816..afe7a67 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ client = OnebusawaySDK( api_key=os.environ.get("ONEBUSAWAY_API_KEY"), ) -current_time_retrieve_response = client.current_time.retrieve() +current_time = client.current_time.retrieve() ``` While you can provide an `api_key` keyword argument, @@ -56,7 +56,7 @@ client = AsyncOnebusawaySDK( async def main() -> None: - current_time_retrieve_response = await client.current_time.retrieve() + current_time = await client.current_time.retrieve() asyncio.run(main()) From 6ae5ddf666032f4374abf719b02127326c8b344f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 20:56:34 +0000 Subject: [PATCH 090/397] feat(api): OpenAPI spec update via Stainless API (#110) --- .stats.yml | 2 +- src/onebusaway/resources/schedule_for_route.py | 7 +++++-- .../types/schedule_for_route_retrieve_params.py | 8 ++++++-- tests/api_resources/test_schedule_for_route.py | 5 +++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index e8d181d..0ebc21b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b2ed1f0adc6090a8bea561c2a33d10e568a72db450c59858ea8e41cf3127c398.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-d04668d97c66a80708cb1896ce9638dc2b55670ed447b67d9833f6a5349cc210.yml diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 8a69d22..c7c2346 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -2,6 +2,9 @@ from __future__ import annotations +from typing import Union +from datetime import date + import httpx from ..types import schedule_for_route_retrieve_params @@ -48,7 +51,7 @@ def retrieve( self, route_id: str, *, - date: str | NotGiven = NOT_GIVEN, + date: Union[str, date] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -112,7 +115,7 @@ async def retrieve( self, route_id: str, *, - date: str | NotGiven = NOT_GIVEN, + date: Union[str, date] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py index 0ba5bcf..6d4d029 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -2,13 +2,17 @@ from __future__ import annotations -from typing_extensions import TypedDict +import datetime +from typing import Union +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = ["ScheduleForRouteRetrieveParams"] class ScheduleForRouteRetrieveParams(TypedDict, total=False): - date: str + date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to current date) diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index a7ff884..6973a7e 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -10,6 +10,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type from onebusaway.types import ScheduleForRouteRetrieveResponse +from onebusaway._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +29,7 @@ def test_method_retrieve(self, client: OnebusawaySDK) -> None: def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: schedule_for_route = client.schedule_for_route.retrieve( route_id="1_100223", - date="date", + date=parse_date("2019-12-27"), ) assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @@ -78,7 +79,7 @@ async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_route = await async_client.schedule_for_route.retrieve( route_id="1_100223", - date="date", + date=parse_date("2019-12-27"), ) assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) From 6f5ae5ff93ca33bc26baffb8a72b4af259ee0088 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 20:56:51 +0000 Subject: [PATCH 091/397] release: 1.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 20 ++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fea3454..2601677 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.0.0" + ".": "1.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b96f76b..69b1fb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 1.1.0 (2024-09-11) + +Full Changelog: [v1.0.0...v1.1.0](https://github.com/OneBusAway/python-sdk/compare/v1.0.0...v1.1.0) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#110](https://github.com/OneBusAway/python-sdk/issues/110)) ([6ae5ddf](https://github.com/OneBusAway/python-sdk/commit/6ae5ddf666032f4374abf719b02127326c8b344f)) + + +### Chores + +* add docstrings to raw response properties ([#107](https://github.com/OneBusAway/python-sdk/issues/107)) ([0fecff5](https://github.com/OneBusAway/python-sdk/commit/0fecff5be41b8bc6049a49ed56eb80399eccf775)) +* **internal:** codegen related update ([#105](https://github.com/OneBusAway/python-sdk/issues/105)) ([1c46884](https://github.com/OneBusAway/python-sdk/commit/1c46884dffc5766e2c0b03826b341e658ef4b58b)) +* **internal:** codegen related update ([#109](https://github.com/OneBusAway/python-sdk/issues/109)) ([89d809e](https://github.com/OneBusAway/python-sdk/commit/89d809e01baa6cd1b1b98c45e88853584f8ac8a3)) + + +### Documentation + +* **readme:** add section on determining installed version ([#108](https://github.com/OneBusAway/python-sdk/issues/108)) ([01b74e9](https://github.com/OneBusAway/python-sdk/commit/01b74e91f822fedd4407b5de3d2fca1d03aaecbb)) + ## 1.0.0 (2024-08-28) Full Changelog: [v0.1.0-alpha.19...v1.0.0](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.19...v1.0.0) diff --git a/pyproject.toml b/pyproject.toml index e615040..55dc4fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.0.0" +version = "1.1.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ed64fee..60f755e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.0.0" # x-release-please-version +__version__ = "1.1.0" # x-release-please-version From aedda7824a72d3cfe13a6abcd8a6d956017024a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 23:35:30 +0000 Subject: [PATCH 092/397] chore(internal): codegen related update (#112) --- CONTRIBUTING.md | 8 +-- requirements-dev.lock | 6 +- src/onebusaway/_base_client.py | 111 ++++++++++++++++++-------------- src/onebusaway/_compat.py | 2 + src/onebusaway/_utils/_utils.py | 7 +- tests/test_client.py | 99 ++++++++++++++++++++++++++++ 6 files changed, 175 insertions(+), 58 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d89975..80e86d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,13 +31,13 @@ $ pip install -r requirements-dev.lock ## Modifying/Adding code -Most of the SDK is generated code, and any modified code will be overridden on the next generation. The -`src/onebusaway/lib/` and `examples/` directories are exceptions and will never be overridden. +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may +result in merge conflicts between manual patches and changes from the generator. The generator will never +modify the contents of the `src/onebusaway/lib/` and `examples/` directories. ## Adding and running examples -All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or -added to. +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. ```bash # add an example to examples/.py diff --git a/requirements-dev.lock b/requirements-dev.lock index 2acdbb2..2a4b8d9 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -50,7 +50,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.10.1 +mypy==1.11.2 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 @@ -71,7 +71,7 @@ pydantic-core==2.18.2 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.374 +pyright==1.1.380 pytest==7.1.1 # via pytest-asyncio pytest-asyncio==0.21.1 @@ -81,7 +81,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.20.2 rich==13.7.1 -ruff==0.5.6 +ruff==0.6.5 setuptools==68.2.2 # via nodeenv six==1.16.0 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 30f5672..c9d0d69 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -400,14 +400,7 @@ def _make_status_error( ) -> _exceptions.APIStatusError: raise NotImplementedError() - def _remaining_retries( - self, - remaining_retries: Optional[int], - options: FinalRequestOptions, - ) -> int: - return remaining_retries if remaining_retries is not None else options.get_max_retries(self.max_retries) - - def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers: + def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers: custom_headers = options.headers or {} headers_dict = _merge_mappings(self.default_headers, custom_headers) self._validate_headers(headers_dict, custom_headers) @@ -419,6 +412,11 @@ def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers: if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + # Don't set the retry count header if it was already set or removed by the caller. We check + # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. + if "x-stainless-retry-count" not in (header.lower() for header in custom_headers): + headers["x-stainless-retry-count"] = str(retries_taken) + return headers def _prepare_url(self, url: str) -> URL: @@ -440,6 +438,8 @@ def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder: def _build_request( self, options: FinalRequestOptions, + *, + retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): log.debug("Request options: %s", model_dump(options, exclude_unset=True)) @@ -455,7 +455,7 @@ def _build_request( else: raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") - headers = self._build_headers(options) + headers = self._build_headers(options, retries_taken=retries_taken) params = _merge_mappings(self.default_query, options.params) content_type = headers.get("Content-Type") files = options.files @@ -489,12 +489,17 @@ def _build_request( if not files: files = cast(HttpxRequestFiles, ForceMultipartDict()) + prepared_url = self._prepare_url(options.url) + if "_" in prepared_url.host: + # work around https://github.com/encode/httpx/discussions/2880 + kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + # TODO: report this error to httpx return self._client.build_request( # pyright: ignore[reportUnknownMemberType] headers=headers, timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout, method=options.method, - url=self._prepare_url(options.url), + url=prepared_url, # the `Query` type that we use is incompatible with qs' # `Params` type as it needs to be typed as `Mapping[str, object]` # so that passing a `TypedDict` doesn't cause an error. @@ -933,12 +938,17 @@ def request( stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if remaining_retries is not None: + retries_taken = options.get_max_retries(self.max_retries) - remaining_retries + else: + retries_taken = 0 + return self._request( cast_to=cast_to, options=options, stream=stream, stream_cls=stream_cls, - remaining_retries=remaining_retries, + retries_taken=retries_taken, ) def _request( @@ -946,7 +956,7 @@ def _request( *, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: int | None, + retries_taken: int, stream: bool, stream_cls: type[_StreamT] | None, ) -> ResponseT | _StreamT: @@ -958,8 +968,8 @@ def _request( cast_to = self._maybe_override_cast_to(cast_to, options) options = self._prepare_options(options) - retries = self._remaining_retries(remaining_retries, options) - request = self._build_request(options) + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + request = self._build_request(options, retries_taken=retries_taken) self._prepare_request(request) kwargs: HttpxSendArgs = {} @@ -977,11 +987,11 @@ def _request( except httpx.TimeoutException as err: log.debug("Encountered httpx.TimeoutException", exc_info=True) - if retries > 0: + if remaining_retries > 0: return self._retry_request( input_options, cast_to, - retries, + retries_taken=retries_taken, stream=stream, stream_cls=stream_cls, response_headers=None, @@ -992,11 +1002,11 @@ def _request( except Exception as err: log.debug("Encountered Exception", exc_info=True) - if retries > 0: + if remaining_retries > 0: return self._retry_request( input_options, cast_to, - retries, + retries_taken=retries_taken, stream=stream, stream_cls=stream_cls, response_headers=None, @@ -1019,13 +1029,13 @@ def _request( except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - if retries > 0 and self._should_retry(err.response): + if remaining_retries > 0 and self._should_retry(err.response): err.response.close() return self._retry_request( input_options, cast_to, - retries, - err.response.headers, + retries_taken=retries_taken, + response_headers=err.response.headers, stream=stream, stream_cls=stream_cls, ) @@ -1044,26 +1054,26 @@ def _request( response=response, stream=stream, stream_cls=stream_cls, - retries_taken=options.get_max_retries(self.max_retries) - retries, + retries_taken=retries_taken, ) def _retry_request( self, options: FinalRequestOptions, cast_to: Type[ResponseT], - remaining_retries: int, - response_headers: httpx.Headers | None, *, + retries_taken: int, + response_headers: httpx.Headers | None, stream: bool, stream_cls: type[_StreamT] | None, ) -> ResponseT | _StreamT: - remaining = remaining_retries - 1 - if remaining == 1: + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + if remaining_retries == 1: log.debug("1 retry left") else: - log.debug("%i retries left", remaining) + log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) log.info("Retrying request to %s in %f seconds", options.url, timeout) # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a @@ -1073,7 +1083,7 @@ def _retry_request( return self._request( options=options, cast_to=cast_to, - remaining_retries=remaining, + retries_taken=retries_taken + 1, stream=stream, stream_cls=stream_cls, ) @@ -1491,12 +1501,17 @@ async def request( stream_cls: type[_AsyncStreamT] | None = None, remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: + if remaining_retries is not None: + retries_taken = options.get_max_retries(self.max_retries) - remaining_retries + else: + retries_taken = 0 + return await self._request( cast_to=cast_to, options=options, stream=stream, stream_cls=stream_cls, - remaining_retries=remaining_retries, + retries_taken=retries_taken, ) async def _request( @@ -1506,7 +1521,7 @@ async def _request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None, - remaining_retries: int | None, + retries_taken: int, ) -> ResponseT | _AsyncStreamT: if self._platform is None: # `get_platform` can make blocking IO calls so we @@ -1521,8 +1536,8 @@ async def _request( cast_to = self._maybe_override_cast_to(cast_to, options) options = await self._prepare_options(options) - retries = self._remaining_retries(remaining_retries, options) - request = self._build_request(options) + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + request = self._build_request(options, retries_taken=retries_taken) await self._prepare_request(request) kwargs: HttpxSendArgs = {} @@ -1538,11 +1553,11 @@ async def _request( except httpx.TimeoutException as err: log.debug("Encountered httpx.TimeoutException", exc_info=True) - if retries > 0: + if remaining_retries > 0: return await self._retry_request( input_options, cast_to, - retries, + retries_taken=retries_taken, stream=stream, stream_cls=stream_cls, response_headers=None, @@ -1553,11 +1568,11 @@ async def _request( except Exception as err: log.debug("Encountered Exception", exc_info=True) - if retries > 0: + if retries_taken > 0: return await self._retry_request( input_options, cast_to, - retries, + retries_taken=retries_taken, stream=stream, stream_cls=stream_cls, response_headers=None, @@ -1575,13 +1590,13 @@ async def _request( except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - if retries > 0 and self._should_retry(err.response): + if remaining_retries > 0 and self._should_retry(err.response): await err.response.aclose() return await self._retry_request( input_options, cast_to, - retries, - err.response.headers, + retries_taken=retries_taken, + response_headers=err.response.headers, stream=stream, stream_cls=stream_cls, ) @@ -1600,26 +1615,26 @@ async def _request( response=response, stream=stream, stream_cls=stream_cls, - retries_taken=options.get_max_retries(self.max_retries) - retries, + retries_taken=retries_taken, ) async def _retry_request( self, options: FinalRequestOptions, cast_to: Type[ResponseT], - remaining_retries: int, - response_headers: httpx.Headers | None, *, + retries_taken: int, + response_headers: httpx.Headers | None, stream: bool, stream_cls: type[_AsyncStreamT] | None, ) -> ResponseT | _AsyncStreamT: - remaining = remaining_retries - 1 - if remaining == 1: + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + if remaining_retries == 1: log.debug("1 retry left") else: - log.debug("%i retries left", remaining) + log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) @@ -1627,7 +1642,7 @@ async def _retry_request( return await self._request( options=options, cast_to=cast_to, - remaining_retries=remaining, + retries_taken=retries_taken + 1, stream=stream, stream_cls=stream_cls, ) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 21fe694..162a6fb 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -136,12 +136,14 @@ def model_dump( exclude: IncEx = None, exclude_unset: bool = False, exclude_defaults: bool = False, + warnings: bool = True, ) -> dict[str, Any]: if PYDANTIC_V2: return model.model_dump( exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, + warnings=warnings, ) return cast( "dict[str, Any]", diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 2fc5a1c..0bba17c 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -363,12 +363,13 @@ def file_from_path(path: str) -> FileTypes: def get_required_header(headers: HeadersLike, header: str) -> str: lower_header = header.lower() - if isinstance(headers, Mapping): - for k, v in headers.items(): + if is_mapping_t(headers): + # mypy doesn't understand the type narrowing here + for k, v in headers.items(): # type: ignore if k.lower() == lower_header and isinstance(v, str): return v - """ to deal with the case where the header looks like Stainless-Event-Id """ + # to deal with the case where the header looks like Stainless-Event-Id intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize()) for normalized_header in [header, lower_header, header.upper(), intercaps_header]: diff --git a/tests/test_client.py b/tests/test_client.py index abc4d37..a819e27 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -17,6 +17,7 @@ from pydantic import ValidationError from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError +from onebusaway._types import Omit from onebusaway._models import BaseModel, FinalRequestOptions from onebusaway._constants import RAW_RESPONSE_HEADER from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError @@ -753,6 +754,53 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: response = client.current_time.with_raw_response.retrieve() assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_omit_retry_count_header( + self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": Omit()}) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_overwrite_retry_count_header( + self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" class TestAsyncOnebusawaySDK: @@ -1467,3 +1515,54 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: response = await client.current_time.with_raw_response.retrieve() assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_omit_retry_count_header( + self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = await client.current_time.with_raw_response.retrieve( + extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_overwrite_retry_count_header( + self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) + + response = await client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" From ac780f663ce9cb826171abf5171dff0a3e4aca49 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 23:35:47 +0000 Subject: [PATCH 093/397] release: 1.1.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2601677..b55c11f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.0" + ".": "1.1.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b1fb1..f3ef561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.1 (2024-09-27) + +Full Changelog: [v1.1.0...v1.1.1](https://github.com/OneBusAway/python-sdk/compare/v1.1.0...v1.1.1) + +### Chores + +* **internal:** codegen related update ([#112](https://github.com/OneBusAway/python-sdk/issues/112)) ([646ad67](https://github.com/OneBusAway/python-sdk/commit/646ad67c30929ccb7bc40e6667a93712284c3c30)) + ## 1.1.0 (2024-09-11) Full Changelog: [v1.0.0...v1.1.0](https://github.com/OneBusAway/python-sdk/compare/v1.0.0...v1.1.0) diff --git a/pyproject.toml b/pyproject.toml index 55dc4fa..dc60ebc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.0" +version = "1.1.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 60f755e..c41c593 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.0" # x-release-please-version +__version__ = "1.1.1" # x-release-please-version From 694aa5f7b4644a234ecca2dc681a7984b227b504 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:20:32 +0000 Subject: [PATCH 094/397] chore(internal): codegen related update (#115) --- CONTRIBUTING.md | 44 ++++++++++++++++++++++++-------------------- README.md | 4 ++++ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80e86d6..696c084 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,9 +2,13 @@ ### With Rye -We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version. +We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run: -After installing Rye, you'll just have to run this command: +```sh +$ ./scripts/bootstrap +``` + +Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run: ```sh $ rye sync --all-features @@ -39,17 +43,17 @@ modify the contents of the `src/onebusaway/lib/` and `examples/` directories. All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. -```bash +```ts # add an example to examples/.py #!/usr/bin/env -S rye run python … ``` -``` -chmod +x examples/.py +```sh +$ chmod +x examples/.py # run the example against your api -./examples/.py +$ ./examples/.py ``` ## Using the repository from source @@ -58,8 +62,8 @@ If you’d like to use the repository from source, you can either install from g To install via git: -```bash -pip install git+ssh://git@github.com/OneBusAway/python-sdk.git +```sh +$ pip install git+ssh://git@github.com/OneBusAway/python-sdk.git ``` Alternatively, you can build from source and install the wheel file: @@ -68,29 +72,29 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz To create a distributable version of the library, all you have to do is run this command: -```bash -rye build +```sh +$ rye build # or -python -m build +$ python -m build ``` Then to install: ```sh -pip install ./path-to-wheel-file.whl +$ pip install ./path-to-wheel-file.whl ``` ## Running tests Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. -```bash +```sh # you will need npm installed -npx prism mock path/to/your/openapi.yml +$ npx prism mock path/to/your/openapi.yml ``` -```bash -rye run pytest +```sh +$ ./scripts/test ``` ## Linting and formatting @@ -100,14 +104,14 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and To lint: -```bash -rye run lint +```sh +$ ./scripts/lint ``` To format and fix all ruff issues automatically: -```bash -rye run format +```sh +$ ./scripts/format ``` ## Publishing and releases diff --git a/README.md b/README.md index afe7a67..d4dcabf 100644 --- a/README.md +++ b/README.md @@ -313,3 +313,7 @@ print(onebusaway.__version__) ## Requirements Python 3.7 or higher. + +## Contributing + +See [the contributing documentation](./CONTRIBUTING.md). From 0a6a7a3f2ff02fb44363fc4e2b7683e39b049f4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:20:51 +0000 Subject: [PATCH 095/397] release: 1.1.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b55c11f..9c6a481 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.1" + ".": "1.1.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ef561..8a78439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.2 (2024-10-02) + +Full Changelog: [v1.1.1...v1.1.2](https://github.com/OneBusAway/python-sdk/compare/v1.1.1...v1.1.2) + +### Chores + +* **internal:** codegen related update ([#115](https://github.com/OneBusAway/python-sdk/issues/115)) ([ca402ef](https://github.com/OneBusAway/python-sdk/commit/ca402ef31d5bdba075c4a2888ab72905e14dc2cc)) + ## 1.1.1 (2024-09-27) Full Changelog: [v1.1.0...v1.1.1](https://github.com/OneBusAway/python-sdk/compare/v1.1.0...v1.1.1) diff --git a/pyproject.toml b/pyproject.toml index dc60ebc..af45410 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.1" +version = "1.1.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c41c593..84e7b35 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.1" # x-release-please-version +__version__ = "1.1.2" # x-release-please-version From 452b58089f5bbaeb351cb921d92c21a27ea4b050 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:20:52 +0000 Subject: [PATCH 096/397] chore(internal): codegen related update (#116) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 696c084..3e2474f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ modify the contents of the `src/onebusaway/lib/` and `examples/` directories. All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. -```ts +```py # add an example to examples/.py #!/usr/bin/env -S rye run python From b1e4a4f4eef0f5371f2877f14120ab83fe6c09ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:21:28 +0000 Subject: [PATCH 097/397] release: 1.1.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9c6a481..e7b93c2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.2" + ".": "1.1.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a78439..0dac270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.3 (2024-10-02) + +Full Changelog: [v1.1.2...v1.1.3](https://github.com/OneBusAway/python-sdk/compare/v1.1.2...v1.1.3) + +### Chores + +* **internal:** codegen related update ([#116](https://github.com/OneBusAway/python-sdk/issues/116)) ([2f6a75e](https://github.com/OneBusAway/python-sdk/commit/2f6a75ec99dd716f9bdf2a496e8539c523845501)) + ## 1.1.2 (2024-10-02) Full Changelog: [v1.1.1...v1.1.2](https://github.com/OneBusAway/python-sdk/compare/v1.1.1...v1.1.2) diff --git a/pyproject.toml b/pyproject.toml index af45410..f2900d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.2" +version = "1.1.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 84e7b35..295e04f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.2" # x-release-please-version +__version__ = "1.1.3" # x-release-please-version From e14bd4b69950d4f664ba6f77929ecfeb8bf644fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:38:44 +0000 Subject: [PATCH 098/397] chore(internal): add support for parsing bool response content (#121) --- src/onebusaway/_response.py | 3 +++ tests/test_response.py | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 1191a35..1121cd0 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -192,6 +192,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == float: return cast(R, float(response.text)) + if cast_to == bool: + return cast(R, response.text.lower() == "true") + origin = get_origin(cast_to) or cast_to if origin == APIResponse: diff --git a/tests/test_response.py b/tests/test_response.py index 3d799b5..25c4e74 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -190,6 +190,56 @@ async def test_async_response_parse_annotated_type(async_client: AsyncOnebusaway assert obj.bar == 2 +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +def test_response_parse_bool(client: OnebusawaySDK, content: str, expected: bool) -> None: + response = APIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = response.parse(to=bool) + assert result is expected + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +async def test_async_response_parse_bool(client: AsyncOnebusawaySDK, content: str, expected: bool) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = await response.parse(to=bool) + assert result is expected + + class OtherModel(BaseModel): a: str From 92856a3f5b8f6b46ed7c092d6ab1aeaa6fd90106 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:39:01 +0000 Subject: [PATCH 099/397] release: 1.1.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e7b93c2..741912c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.3" + ".": "1.1.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dac270..b3526c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.4 (2024-10-07) + +Full Changelog: [v1.1.3...v1.1.4](https://github.com/OneBusAway/python-sdk/compare/v1.1.3...v1.1.4) + +### Chores + +* **internal:** add support for parsing bool response content ([#121](https://github.com/OneBusAway/python-sdk/issues/121)) ([390f17a](https://github.com/OneBusAway/python-sdk/commit/390f17a0a9ca9da54dac53982bfd72fa851191ff)) + ## 1.1.3 (2024-10-02) Full Changelog: [v1.1.2...v1.1.3](https://github.com/OneBusAway/python-sdk/compare/v1.1.2...v1.1.3) diff --git a/pyproject.toml b/pyproject.toml index f2900d4..fbd8a01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.3" +version = "1.1.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 295e04f..054f538 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.3" # x-release-please-version +__version__ = "1.1.4" # x-release-please-version From 3b6629046bf3193dd41ac1c04b693dd3606d0368 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:41:27 +0000 Subject: [PATCH 100/397] fix(client): avoid OverflowError with very large retry counts (#124) --- src/onebusaway/_base_client.py | 3 ++- tests/test_client.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index c9d0d69..042f45a 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -689,7 +689,8 @@ def _calculate_retry_timeout( if retry_after is not None and 0 < retry_after <= 60: return retry_after - nb_retries = max_retries - remaining_retries + # Also cap retry count to 1000 to avoid any potential overflows with `pow` + nb_retries = min(max_retries - remaining_retries, 1000) # Apply exponential backoff, but not more than the max. sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY) diff --git a/tests/test_client.py b/tests/test_client.py index a819e27..7c9d2af 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -695,6 +695,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], + [-1100, "", 7.8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @@ -1452,6 +1453,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], + [-1100, "", 7.8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) From 64335853cda511c6eb1618727a8e745ef8654369 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:41:42 +0000 Subject: [PATCH 101/397] release: 1.1.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 741912c..627a385 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.4" + ".": "1.1.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b3526c5..306eb5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.5 (2024-10-07) + +Full Changelog: [v1.1.4...v1.1.5](https://github.com/OneBusAway/python-sdk/compare/v1.1.4...v1.1.5) + +### Bug Fixes + +* **client:** avoid OverflowError with very large retry counts ([#124](https://github.com/OneBusAway/python-sdk/issues/124)) ([5f67626](https://github.com/OneBusAway/python-sdk/commit/5f6762604b6462d1fbac9b72adba324d2e4cc38d)) + ## 1.1.4 (2024-10-07) Full Changelog: [v1.1.3...v1.1.4](https://github.com/OneBusAway/python-sdk/compare/v1.1.3...v1.1.4) diff --git a/pyproject.toml b/pyproject.toml index fbd8a01..e2b621c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.4" +version = "1.1.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 054f538..99595fa 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.4" # x-release-please-version +__version__ = "1.1.5" # x-release-please-version From 8edbbbbb521d054c5fae3722d0783b0a73ef3c9e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:42:12 +0000 Subject: [PATCH 102/397] chore: add repr to PageInfo class (#126) --- src/onebusaway/_base_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 042f45a..79fff06 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -143,6 +143,12 @@ def __init__( self.url = url self.params = params + @override + def __repr__(self) -> str: + if self.url: + return f"{self.__class__.__name__}(url={self.url})" + return f"{self.__class__.__name__}(params={self.params})" + class BasePage(GenericModel, Generic[_T]): """ From 6e1420d8746b90e4ca48cb94d707cdde6de91a05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:42:27 +0000 Subject: [PATCH 103/397] release: 1.1.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 627a385..6dccc2d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.5" + ".": "1.1.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 306eb5a..f31a321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.1.6 (2024-10-07) + +Full Changelog: [v1.1.5...v1.1.6](https://github.com/OneBusAway/python-sdk/compare/v1.1.5...v1.1.6) + +### Chores + +* add repr to PageInfo class ([#126](https://github.com/OneBusAway/python-sdk/issues/126)) ([4904f20](https://github.com/OneBusAway/python-sdk/commit/4904f2016d302d002f08455737f8a76c5784980e)) + ## 1.1.5 (2024-10-07) Full Changelog: [v1.1.4...v1.1.5](https://github.com/OneBusAway/python-sdk/compare/v1.1.4...v1.1.5) diff --git a/pyproject.toml b/pyproject.toml index e2b621c..58d5af8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.5" +version = "1.1.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 99595fa..0ef906e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.5" # x-release-please-version +__version__ = "1.1.6" # x-release-please-version From 1629d2e9e5fb7ffd06f108bef643a1f30690d07b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:50:33 +0000 Subject: [PATCH 104/397] feat(api): api update (#129) --- pyproject.toml | 8 ++------ requirements-dev.lock | 2 +- src/onebusaway/_base_client.py | 2 +- tests/test_client.py | 21 +++++++++++++++++++-- tests/test_models.py | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 58d5af8..e5839e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,11 +63,11 @@ format = { chain = [ "format:ruff", "format:docs", "fix:ruff", + # run formatting again to fix any inconsistencies when imports are stripped + "format:ruff", ]} -"format:black" = "black ." "format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" "format:ruff" = "ruff format" -"format:isort" = "isort ." "lint" = { chain = [ "check:ruff", @@ -125,10 +125,6 @@ path = "README.md" pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' replacement = '[\1](https://github.com/OneBusAway/python-sdk/tree/main/\g<2>)' -[tool.black] -line-length = 120 -target-version = ["py37"] - [tool.pytest.ini_options] testpaths = ["tests"] addopts = "--tb=short" diff --git a/requirements-dev.lock b/requirements-dev.lock index 2a4b8d9..93afe5f 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -81,7 +81,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.20.2 rich==13.7.1 -ruff==0.6.5 +ruff==0.6.9 setuptools==68.2.2 # via nodeenv six==1.16.0 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 79fff06..6685e1c 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1575,7 +1575,7 @@ async def _request( except Exception as err: log.debug("Encountered Exception", exc_info=True) - if retries_taken > 0: + if remaining_retries > 0: return await self._retry_request( input_options, cast_to, diff --git a/tests/test_client.py b/tests/test_client.py index 7c9d2af..a693ce0 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -10,6 +10,7 @@ import tracemalloc from typing import Any, Union, cast from unittest import mock +from typing_extensions import Literal import httpx import pytest @@ -738,7 +739,14 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retries_taken(self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter) -> None: + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + def test_retries_taken( + self, + client: OnebusawaySDK, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: client = client.with_options(max_retries=4) nb_retries = 0 @@ -747,6 +755,8 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: nonlocal nb_retries if nb_retries < failures_before_success: nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -1498,8 +1508,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( - self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOnebusawaySDK, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, ) -> None: client = async_client.with_options(max_retries=4) @@ -1509,6 +1524,8 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: nonlocal nb_retries if nb_retries < failures_before_success: nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) diff --git a/tests/test_models.py b/tests/test_models.py index e210493..c609459 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -245,7 +245,7 @@ class Model(BaseModel): assert m.foo is True m = Model.construct(foo="CARD_HOLDER") - assert m.foo is "CARD_HOLDER" + assert m.foo == "CARD_HOLDER" m = Model.construct(foo={"bar": False}) assert isinstance(m.foo, Submodel1) From 2dfe71927946a25775e159ea0c3fe8158e03afeb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:50:48 +0000 Subject: [PATCH 105/397] release: 1.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6dccc2d..d0ab664 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.6" + ".": "1.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f31a321..d25c3cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.0 (2024-10-22) + +Full Changelog: [v1.1.6...v1.2.0](https://github.com/OneBusAway/python-sdk/compare/v1.1.6...v1.2.0) + +### Features + +* **api:** api update ([#129](https://github.com/OneBusAway/python-sdk/issues/129)) ([fa000a7](https://github.com/OneBusAway/python-sdk/commit/fa000a7c52befc4916757055e2019174bba553f5)) + ## 1.1.6 (2024-10-07) Full Changelog: [v1.1.5...v1.1.6](https://github.com/OneBusAway/python-sdk/compare/v1.1.5...v1.1.6) diff --git a/pyproject.toml b/pyproject.toml index e5839e7..748bd2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.1.6" +version = "1.2.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0ef906e..e3bfa2b 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.1.6" # x-release-please-version +__version__ = "1.2.0" # x-release-please-version From 397a4771557c78a15a70c89867bccc488d6f0f83 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:01:46 +0000 Subject: [PATCH 106/397] chore: rebuild project due to codegen change (#132) --- requirements-dev.lock | 21 +++++++++------------ requirements.lock | 8 ++++---- src/onebusaway/_compat.py | 2 +- src/onebusaway/_models.py | 10 +++++----- src/onebusaway/_types.py | 6 ++++-- tests/conftest.py | 14 ++++++++------ 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 93afe5f..6ebc99c 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -17,8 +17,6 @@ anyio==4.4.0 # via onebusaway argcomplete==3.1.2 # via nox -attrs==23.1.0 - # via pytest certifi==2023.7.22 # via httpcore # via httpx @@ -29,8 +27,9 @@ distlib==0.3.7 # via virtualenv distro==1.8.0 # via onebusaway -exceptiongroup==1.1.3 +exceptiongroup==1.2.2 # via anyio + # via pytest filelock==3.12.4 # via virtualenv h11==0.14.0 @@ -61,20 +60,18 @@ packaging==23.2 # via pytest platformdirs==3.11.0 # via virtualenv -pluggy==1.3.0 - # via pytest -py==1.11.0 +pluggy==1.5.0 # via pytest -pydantic==2.7.1 +pydantic==2.9.2 # via onebusaway -pydantic-core==2.18.2 +pydantic-core==2.23.4 # via pydantic pygments==2.18.0 # via rich pyright==1.1.380 -pytest==7.1.1 +pytest==8.3.3 # via pytest-asyncio -pytest-asyncio==0.21.1 +pytest-asyncio==0.24.0 python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 @@ -91,10 +88,10 @@ sniffio==1.3.0 # via httpx # via onebusaway time-machine==2.9.0 -tomli==2.0.1 +tomli==2.0.2 # via mypy # via pytest -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via anyio # via mypy # via onebusaway diff --git a/requirements.lock b/requirements.lock index 5df36b8..e06c227 100644 --- a/requirements.lock +++ b/requirements.lock @@ -20,7 +20,7 @@ certifi==2023.7.22 # via httpx distro==1.8.0 # via onebusaway -exceptiongroup==1.1.3 +exceptiongroup==1.2.2 # via anyio h11==0.14.0 # via httpcore @@ -31,15 +31,15 @@ httpx==0.25.2 idna==3.4 # via anyio # via httpx -pydantic==2.7.1 +pydantic==2.9.2 # via onebusaway -pydantic-core==2.18.2 +pydantic-core==2.23.4 # via pydantic sniffio==1.3.0 # via anyio # via httpx # via onebusaway -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via anyio # via onebusaway # via pydantic diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 162a6fb..d89920d 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -133,7 +133,7 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: def model_dump( model: pydantic.BaseModel, *, - exclude: IncEx = None, + exclude: IncEx | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, warnings: bool = True, diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index d386eaa..42551b7 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -176,7 +176,7 @@ def __str__(self) -> str: # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. @classmethod @override - def construct( + def construct( # pyright: ignore[reportIncompatibleMethodOverride] cls: Type[ModelT], _fields_set: set[str] | None = None, **values: object, @@ -248,8 +248,8 @@ def model_dump( self, *, mode: Literal["json", "python"] | str = "python", - include: IncEx = None, - exclude: IncEx = None, + include: IncEx | None = None, + exclude: IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, @@ -303,8 +303,8 @@ def model_dump_json( self, *, indent: int | None = None, - include: IncEx = None, - exclude: IncEx = None, + include: IncEx | None = None, + exclude: IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index f554261..0f66e1c 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -16,7 +16,7 @@ Optional, Sequence, ) -from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable import httpx import pydantic @@ -193,7 +193,9 @@ def get(self, __key: str) -> str | None: ... # Note: copied from Pydantic # https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49 -IncEx: TypeAlias = "set[int] | set[str] | dict[int, Any] | dict[str, Any] | None" +IncEx: TypeAlias = Union[ + Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]] +] PostParser = Callable[[Any], Any] diff --git a/tests/conftest.py b/tests/conftest.py index 9be801d..d166173 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,11 @@ from __future__ import annotations import os -import asyncio import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator import pytest +from pytest_asyncio import is_async_test from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK @@ -17,11 +17,13 @@ logging.getLogger("onebusaway").setLevel(logging.DEBUG) -@pytest.fixture(scope="session") -def event_loop() -> Iterator[asyncio.AbstractEventLoop]: - loop = asyncio.new_event_loop() - yield loop - loop.close() +# automatically add `pytest.mark.asyncio()` to all of our async tests +# so we don't have to add that boilerplate everywhere +def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: + pytest_asyncio_tests = (item for item in items if is_async_test(item)) + session_scope_marker = pytest.mark.asyncio(loop_scope="session") + for async_test in pytest_asyncio_tests: + async_test.add_marker(session_scope_marker, append=False) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") From aa979291cf4c1b602bddf974b3e542d1c7dd55c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:02:02 +0000 Subject: [PATCH 107/397] release: 1.2.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d0ab664..d43a621 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.0" + ".": "1.2.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d25c3cb..9637d6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.1 (2024-10-28) + +Full Changelog: [v1.2.0...v1.2.1](https://github.com/OneBusAway/python-sdk/compare/v1.2.0...v1.2.1) + +### Chores + +* rebuild project due to codegen change ([#132](https://github.com/OneBusAway/python-sdk/issues/132)) ([39da39b](https://github.com/OneBusAway/python-sdk/commit/39da39bb4d2e0e644a66a24b199f7b4e506c46fd)) + ## 1.2.0 (2024-10-22) Full Changelog: [v1.1.6...v1.2.0](https://github.com/OneBusAway/python-sdk/compare/v1.1.6...v1.2.0) diff --git a/pyproject.toml b/pyproject.toml index 748bd2d..8999cdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.0" +version = "1.2.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index e3bfa2b..c953824 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.0" # x-release-please-version +__version__ = "1.2.1" # x-release-please-version From ced425869077eaec7a92006a7cd74441a52c2784 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:59:21 +0000 Subject: [PATCH 108/397] chore: rebuild project due to codegen change (#135) --- requirements-dev.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 6ebc99c..90fed7a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -49,7 +49,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.11.2 +mypy==1.13.0 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 From b51a00689b4e1c16ac544398878aa7399d218e9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:59:39 +0000 Subject: [PATCH 109/397] release: 1.2.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d43a621..029e2d7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.1" + ".": "1.2.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9637d6c..5a205be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.2 (2024-11-01) + +Full Changelog: [v1.2.1...v1.2.2](https://github.com/OneBusAway/python-sdk/compare/v1.2.1...v1.2.2) + +### Chores + +* rebuild project due to codegen change ([#135](https://github.com/OneBusAway/python-sdk/issues/135)) ([34f0283](https://github.com/OneBusAway/python-sdk/commit/34f02834030b10d71061287edcdfe7104f5fccbd)) + ## 1.2.1 (2024-10-28) Full Changelog: [v1.2.0...v1.2.1](https://github.com/OneBusAway/python-sdk/compare/v1.2.0...v1.2.1) diff --git a/pyproject.toml b/pyproject.toml index 8999cdb..4e59790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.1" +version = "1.2.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c953824..3f85a20 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.1" # x-release-please-version +__version__ = "1.2.2" # x-release-please-version From d74a95bc5981b3d5fc24beb8278fedfb1720e250 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 03:18:13 +0000 Subject: [PATCH 110/397] chore: rebuild project due to codegen change (#138) --- src/onebusaway/_utils/_transform.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 47e262a..7e9663d 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -173,6 +173,11 @@ def _transform_recursive( # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] From 9fd6584e1d98b6c1d05398804870dcf47ac312c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 03:18:29 +0000 Subject: [PATCH 111/397] release: 1.2.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 029e2d7..a237539 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.2" + ".": "1.2.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a205be..99961de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.3 (2024-11-02) + +Full Changelog: [v1.2.2...v1.2.3](https://github.com/OneBusAway/python-sdk/compare/v1.2.2...v1.2.3) + +### Chores + +* rebuild project due to codegen change ([#138](https://github.com/OneBusAway/python-sdk/issues/138)) ([2b313bd](https://github.com/OneBusAway/python-sdk/commit/2b313bd9f439d8e908a79b5f498e490ce68a06fe)) + ## 1.2.2 (2024-11-01) Full Changelog: [v1.2.1...v1.2.2](https://github.com/OneBusAway/python-sdk/compare/v1.2.1...v1.2.2) diff --git a/pyproject.toml b/pyproject.toml index 4e59790..ac3c836 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.2" +version = "1.2.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 3f85a20..d3f9ffe 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.2" # x-release-please-version +__version__ = "1.2.3" # x-release-please-version From 389e81690ae8e6caa7011bb7feb70e5fb2ee3da2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:48:26 +0000 Subject: [PATCH 112/397] chore: rebuild project due to codegen change (#141) --- src/onebusaway/_compat.py | 6 ++++-- src/onebusaway/_models.py | 9 ++++++--- src/onebusaway/_utils/__init__.py | 1 + src/onebusaway/_utils/_transform.py | 4 ++-- src/onebusaway/_utils/_utils.py | 17 +++++++++++++++++ tests/test_models.py | 21 +++++++-------------- tests/test_transform.py | 15 +++++++++++++++ 7 files changed, 52 insertions(+), 21 deletions(-) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index d89920d..4794129 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self +from typing_extensions import Self, Literal import pydantic from pydantic.fields import FieldInfo @@ -137,9 +137,11 @@ def model_dump( exclude_unset: bool = False, exclude_defaults: bool = False, warnings: bool = True, + mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2: + if PYDANTIC_V2 or hasattr(model, "model_dump"): return model.model_dump( + mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 42551b7..6cb469e 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -37,6 +37,7 @@ PropertyInfo, is_list, is_given, + json_safe, lru_cache, is_mapping, parse_date, @@ -279,8 +280,8 @@ def model_dump( Returns: A dictionary representation of the model. """ - if mode != "python": - raise ValueError("mode is only supported in Pydantic v2") + if mode not in {"json", "python"}: + raise ValueError("mode must be either 'json' or 'python'") if round_trip != False: raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: @@ -289,7 +290,7 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") - return super().dict( # pyright: ignore[reportDeprecated] + dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, by_alias=by_alias, @@ -298,6 +299,8 @@ def model_dump( exclude_none=exclude_none, ) + return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + @override def model_dump_json( self, diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py index 3efe66c..a7cff3c 100644 --- a/src/onebusaway/_utils/__init__.py +++ b/src/onebusaway/_utils/__init__.py @@ -6,6 +6,7 @@ is_list as is_list, is_given as is_given, is_tuple as is_tuple, + json_safe as json_safe, lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 7e9663d..d7c0534 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -191,7 +191,7 @@ def _transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: @@ -329,7 +329,7 @@ async def _async_transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 0bba17c..e5811bb 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -16,6 +16,7 @@ overload, ) from pathlib import Path +from datetime import date, datetime from typing_extensions import TypeGuard import sniffio @@ -395,3 +396,19 @@ def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: maxsize=maxsize, ) return cast(Any, wrapper) # type: ignore[no-any-return] + + +def json_safe(data: object) -> object: + """Translates a mapping / sequence recursively in the same fashion + as `pydantic` v2's `model_dump(mode="json")`. + """ + if is_mapping(data): + return {json_safe(key): json_safe(value) for key, value in data.items()} + + if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)): + return [json_safe(item) for item in data] + + if isinstance(data, (datetime, date)): + return data.isoformat() + + return data diff --git a/tests/test_models.py b/tests/test_models.py index c609459..dd618a4 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -520,19 +520,15 @@ class Model(BaseModel): assert m3.to_dict(exclude_none=True) == {} assert m3.to_dict(exclude_defaults=True) == {} - if PYDANTIC_V2: - - class Model2(BaseModel): - created_at: datetime + class Model2(BaseModel): + created_at: datetime - time_str = "2024-03-21T11:39:01.275859" - m4 = Model2.construct(created_at=time_str) - assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} - assert m4.to_dict(mode="json") == {"created_at": time_str} - else: - with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): - m.to_dict(mode="json") + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + if not PYDANTIC_V2: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -558,9 +554,6 @@ class Model(BaseModel): assert m3.model_dump(exclude_none=True) == {} if not PYDANTIC_V2: - with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): - m.model_dump(mode="json") - with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) diff --git a/tests/test_transform.py b/tests/test_transform.py index 1f3bbdd..1ace66d 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -177,17 +177,32 @@ class DateDict(TypedDict, total=False): foo: Annotated[date, PropertyInfo(format="iso8601")] +class DatetimeModel(BaseModel): + foo: datetime + + +class DateModel(BaseModel): + foo: Optional[date] + + @parametrize @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + tz = "Z" if PYDANTIC_V2 else "+00:00" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] @parametrize From 7d57b5d2565b29301d1edc7c8317eb3798b7e9dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:48:42 +0000 Subject: [PATCH 113/397] release: 1.2.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a237539..862a05b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.3" + ".": "1.2.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 99961de..673b71d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.4 (2024-11-04) + +Full Changelog: [v1.2.3...v1.2.4](https://github.com/OneBusAway/python-sdk/compare/v1.2.3...v1.2.4) + +### Chores + +* rebuild project due to codegen change ([#141](https://github.com/OneBusAway/python-sdk/issues/141)) ([d52c16a](https://github.com/OneBusAway/python-sdk/commit/d52c16af30fdfb61b324c5d83f4052726f2eacd8)) + ## 1.2.3 (2024-11-02) Full Changelog: [v1.2.2...v1.2.3](https://github.com/OneBusAway/python-sdk/compare/v1.2.2...v1.2.3) diff --git a/pyproject.toml b/pyproject.toml index ac3c836..59973c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.3" +version = "1.2.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index d3f9ffe..5150626 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.3" # x-release-please-version +__version__ = "1.2.4" # x-release-please-version From 8a06a1eb978f762a36d17dc9ff83fbc8a13493a8 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 6 Nov 2024 17:01:46 +0000 Subject: [PATCH 114/397] chore: rebuild project due to codegen change (#144) --- README.md | 6 ++++-- pyproject.toml | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d4dcabf..0a5dd07 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ [![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg)](https://pypi.org/project/onebusaway/) -The OneBusAway SDK Python library provides convenient access to the OneBusAway SDK REST API from any Python 3.7+ + +The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.8+ + application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -312,7 +314,7 @@ print(onebusaway.__version__) ## Requirements -Python 3.7 or higher. +Python 3.8 or higher. ## Contributing diff --git a/pyproject.toml b/pyproject.toml index 59973c2..1afab7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,11 +16,10 @@ dependencies = [ "sniffio", "cached-property; python_version < '3.8'", ] -requires-python = ">= 3.7" +requires-python = ">= 3.8" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -139,7 +138,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.7" +pythonVersion = "3.8" exclude = [ "_dev", From 2dcaaffbd9de815c6a1b26091e142c1f94bb5e4e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:54:49 +0000 Subject: [PATCH 115/397] chore: rebuild project due to codegen change (#146) --- tests/test_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index a693ce0..5d5bd65 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -696,7 +696,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], - [-1100, "", 7.8], # test large number potentially overflowing + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @@ -1463,7 +1463,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], - [-1100, "", 7.8], # test large number potentially overflowing + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) From c838cdf94877ff1d63268764fbc6ec9fb646fe33 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 17:02:03 +0000 Subject: [PATCH 116/397] release: 1.2.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 862a05b..642b9c6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.4" + ".": "1.2.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 673b71d..ecb50b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.2.5 (2024-11-06) + +Full Changelog: [v1.2.4...v1.2.5](https://github.com/OneBusAway/python-sdk/compare/v1.2.4...v1.2.5) + +### Chores + +* rebuild project due to codegen change ([#144](https://github.com/OneBusAway/python-sdk/issues/144)) ([8a06a1e](https://github.com/OneBusAway/python-sdk/commit/8a06a1eb978f762a36d17dc9ff83fbc8a13493a8)) +* rebuild project due to codegen change ([#146](https://github.com/OneBusAway/python-sdk/issues/146)) ([2dcaaff](https://github.com/OneBusAway/python-sdk/commit/2dcaaffbd9de815c6a1b26091e142c1f94bb5e4e)) + ## 1.2.4 (2024-11-04) Full Changelog: [v1.2.3...v1.2.4](https://github.com/OneBusAway/python-sdk/compare/v1.2.3...v1.2.4) diff --git a/pyproject.toml b/pyproject.toml index 1afab7c..3cb08e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.4" +version = "1.2.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 5150626..353a91b 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.4" # x-release-please-version +__version__ = "1.2.5" # x-release-please-version From 2fa3dac4624ff9925d3dc3c508d15977caeed836 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:58:25 +0000 Subject: [PATCH 117/397] chore: rebuild project due to codegen change (#149) --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0a5dd07..76c5214 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,7 @@ import os from onebusaway import OnebusawaySDK client = OnebusawaySDK( - # This is the default and can be omitted - api_key=os.environ.get("ONEBUSAWAY_API_KEY"), + api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted ) current_time = client.current_time.retrieve() @@ -52,8 +51,7 @@ import asyncio from onebusaway import AsyncOnebusawaySDK client = AsyncOnebusawaySDK( - # This is the default and can be omitted - api_key=os.environ.get("ONEBUSAWAY_API_KEY"), + api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted ) From 900b00c71989e8aeb2060c792d6657e7463beb5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:58:44 +0000 Subject: [PATCH 118/397] release: 1.2.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 642b9c6..9077417 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.5" + ".": "1.2.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ecb50b3..0524b69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.6 (2024-11-12) + +Full Changelog: [v1.2.5...v1.2.6](https://github.com/OneBusAway/python-sdk/compare/v1.2.5...v1.2.6) + +### Chores + +* rebuild project due to codegen change ([#149](https://github.com/OneBusAway/python-sdk/issues/149)) ([a4f5f5c](https://github.com/OneBusAway/python-sdk/commit/a4f5f5c8374fd0882ec00d8fbd79d1ddb8ecf684)) + ## 1.2.5 (2024-11-06) Full Changelog: [v1.2.4...v1.2.5](https://github.com/OneBusAway/python-sdk/compare/v1.2.4...v1.2.5) diff --git a/pyproject.toml b/pyproject.toml index 3cb08e7..cfdef91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.5" +version = "1.2.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 353a91b..f8f659a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.5" # x-release-please-version +__version__ = "1.2.6" # x-release-please-version From 65e675dad7120a81dd7fd7773837378470d40720 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:21:50 +0000 Subject: [PATCH 119/397] chore: rebuild project due to codegen change (#152) --- src/onebusaway/_utils/_transform.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index d7c0534..a6b62ca 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -316,6 +316,11 @@ async def _async_transform_recursive( # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] From dc53a49bfd78a6f67080bbf471b9843c7c33e89e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:22:07 +0000 Subject: [PATCH 120/397] release: 1.2.7 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9077417..5f7dfd4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.6" + ".": "1.2.7" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0524b69..754ddd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.7 (2024-11-12) + +Full Changelog: [v1.2.6...v1.2.7](https://github.com/OneBusAway/python-sdk/compare/v1.2.6...v1.2.7) + +### Chores + +* rebuild project due to codegen change ([#152](https://github.com/OneBusAway/python-sdk/issues/152)) ([0ccfcf3](https://github.com/OneBusAway/python-sdk/commit/0ccfcf34a65fe87d1b226598585022c305ffc41f)) + ## 1.2.6 (2024-11-12) Full Changelog: [v1.2.5...v1.2.6](https://github.com/OneBusAway/python-sdk/compare/v1.2.5...v1.2.6) diff --git a/pyproject.toml b/pyproject.toml index cfdef91..23a503a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.6" +version = "1.2.7" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f8f659a..b9743bc 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.6" # x-release-please-version +__version__ = "1.2.7" # x-release-please-version From 8de70d662d900440764c83f043ee05ff500490fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:57:13 +0000 Subject: [PATCH 121/397] chore: rebuild project due to codegen change (#155) --- pyproject.toml | 1 + requirements-dev.lock | 1 + src/onebusaway/_utils/_sync.py | 90 +++++++++++++++------------------- tests/test_client.py | 38 ++++++++++++++ 4 files changed, 80 insertions(+), 50 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 23a503a..bd1b3e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", + "nest_asyncio==1.6.0" ] [tool.rye.scripts] diff --git a/requirements-dev.lock b/requirements-dev.lock index 90fed7a..25e1348 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -52,6 +52,7 @@ mdurl==0.1.2 mypy==1.13.0 mypy-extensions==1.0.0 # via mypy +nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py index d0d8103..8b3aaf2 100644 --- a/src/onebusaway/_utils/_sync.py +++ b/src/onebusaway/_utils/_sync.py @@ -1,56 +1,62 @@ from __future__ import annotations +import sys +import asyncio import functools -from typing import TypeVar, Callable, Awaitable +import contextvars +from typing import Any, TypeVar, Callable, Awaitable from typing_extensions import ParamSpec -import anyio -import anyio.to_thread - -from ._reflection import function_has_argument - T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") -# copied from `asyncer`, https://github.com/tiangolo/asyncer -def asyncify( - function: Callable[T_ParamSpec, T_Retval], - *, - cancellable: bool = False, - limiter: anyio.CapacityLimiter | None = None, -) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: +if sys.version_info >= (3, 9): + to_thread = asyncio.to_thread +else: + # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread + # for Python 3.8 support + async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs + ) -> Any: + """Asynchronously run function *func* in a separate thread. + + Any *args and **kwargs supplied for this function are directly passed + to *func*. Also, the current :class:`contextvars.Context` is propagated, + allowing context variables from the main thread to be accessed in the + separate thread. + + Returns a coroutine that can be awaited to get the eventual result of *func*. + """ + loop = asyncio.events.get_running_loop() + ctx = contextvars.copy_context() + func_call = functools.partial(ctx.run, func, *args, **kwargs) + return await loop.run_in_executor(None, func_call) + + +# inspired by `asyncer`, https://github.com/tiangolo/asyncer +def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments, and that when called, calls the original function - in a worker thread using `anyio.to_thread.run_sync()`. Internally, - `asyncer.asyncify()` uses the same `anyio.to_thread.run_sync()`, but it supports - keyword arguments additional to positional arguments and it adds better support for - autocompletion and inline errors for the arguments of the function called and the - return value. - - If the `cancellable` option is enabled and the task waiting for its completion is - cancelled, the thread will still run its course but its return value (or any raised - exception) will be ignored. + positional and keyword arguments. For python version 3.9 and above, it uses + asyncio.to_thread to run the function in a separate thread. For python version + 3.8, it uses locally defined copy of the asyncio.to_thread function which was + introduced in python 3.9. - Use it like this: + Usage: - ```Python - def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: - # Do work - return "Some result" + ```python + def blocking_func(arg1, arg2, kwarg1=None): + # blocking code + return result - result = await to_thread.asyncify(do_work)("spam", "ham", kwarg1="a", kwarg2="b") - print(result) + result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1) ``` ## Arguments `function`: a blocking regular callable (e.g. a function) - `cancellable`: `True` to allow cancellation of the operation - `limiter`: capacity limiter to use to limit the total amount of threads running - (if omitted, the default limiter is used) ## Return @@ -60,22 +66,6 @@ def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: """ async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: - partial_f = functools.partial(function, *args, **kwargs) - - # In `v4.1.0` anyio added the `abandon_on_cancel` argument and deprecated the old - # `cancellable` argument, so we need to use the new `abandon_on_cancel` to avoid - # surfacing deprecation warnings. - if function_has_argument(anyio.to_thread.run_sync, "abandon_on_cancel"): - return await anyio.to_thread.run_sync( - partial_f, - abandon_on_cancel=cancellable, - limiter=limiter, - ) - - return await anyio.to_thread.run_sync( - partial_f, - cancellable=cancellable, - limiter=limiter, - ) + return await to_thread(function, *args, **kwargs) return wrapper diff --git a/tests/test_client.py b/tests/test_client.py index 5d5bd65..9f090e1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -4,11 +4,14 @@ import gc import os +import sys import json import asyncio import inspect +import subprocess import tracemalloc from typing import Any, Union, cast +from textwrap import dedent from unittest import mock from typing_extensions import Literal @@ -1585,3 +1588,38 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: response = await client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + def test_get_platform(self) -> None: + # A previous implementation of asyncify could leave threads unterminated when + # used with nest_asyncio. + # + # Since nest_asyncio.apply() is global and cannot be un-applied, this + # test is run in a separate process to avoid affecting other tests. + test_code = dedent(""" + import asyncio + import nest_asyncio + import threading + + from onebusaway._utils import asyncify + from onebusaway._base_client import get_platform + + async def test_main() -> None: + result = await asyncify(get_platform)() + print(result) + for thread in threading.enumerate(): + print(thread.name) + + nest_asyncio.apply() + asyncio.run(test_main()) + """) + with subprocess.Popen( + [sys.executable, "-c", test_code], + text=True, + ) as process: + try: + process.wait(2) + if process.returncode: + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + except subprocess.TimeoutExpired as e: + process.kill() + raise AssertionError("calling get_platform using asyncify resulted in a hung process") from e From 5b60f059e748a2b81279842430764af6aff943b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 12:57:35 +0000 Subject: [PATCH 122/397] release: 1.2.8 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5f7dfd4..2653b8f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.7" + ".": "1.2.8" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 754ddd1..2cb66c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.8 (2024-11-18) + +Full Changelog: [v1.2.7...v1.2.8](https://github.com/OneBusAway/python-sdk/compare/v1.2.7...v1.2.8) + +### Chores + +* rebuild project due to codegen change ([#155](https://github.com/OneBusAway/python-sdk/issues/155)) ([a1206f8](https://github.com/OneBusAway/python-sdk/commit/a1206f8cc69bef31c4932b8160bdb64a1458597d)) + ## 1.2.7 (2024-11-12) Full Changelog: [v1.2.6...v1.2.7](https://github.com/OneBusAway/python-sdk/compare/v1.2.6...v1.2.7) diff --git a/pyproject.toml b/pyproject.toml index bd1b3e3..59a90c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.7" +version = "1.2.8" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index b9743bc..69905b8 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.7" # x-release-please-version +__version__ = "1.2.8" # x-release-please-version From 479e8782c1f45ecaa419c61749eebae342598da2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 20:05:59 +0000 Subject: [PATCH 123/397] chore(internal): fix compat model_dump method when warnings are passed (#158) --- src/onebusaway/_compat.py | 3 ++- tests/test_models.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 4794129..df173f8 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -145,7 +145,8 @@ def model_dump( exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, - warnings=warnings, + # warnings are not supported in Pydantic v1 + warnings=warnings if PYDANTIC_V2 else True, ) return cast( "dict[str, Any]", diff --git a/tests/test_models.py b/tests/test_models.py index dd618a4..b1c88ed 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -561,6 +561,14 @@ class Model(BaseModel): m.model_dump(warnings=False) +def test_compat_method_no_error_for_warnings() -> None: + class Model(BaseModel): + foo: Optional[str] + + m = Model(foo="hello") + assert isinstance(model_dump(m, warnings=False), dict) + + def test_to_json() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) From 8509eeb0ec8f43368a98ff9eb7fe9ed96ab5fb04 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 20:06:17 +0000 Subject: [PATCH 124/397] release: 1.2.9 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2653b8f..8d58a58 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.8" + ".": "1.2.9" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb66c8..ebf0a86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.9 (2024-11-22) + +Full Changelog: [v1.2.8...v1.2.9](https://github.com/OneBusAway/python-sdk/compare/v1.2.8...v1.2.9) + +### Chores + +* **internal:** fix compat model_dump method when warnings are passed ([#158](https://github.com/OneBusAway/python-sdk/issues/158)) ([699d488](https://github.com/OneBusAway/python-sdk/commit/699d4889cf96d12c9fc0c538e228daaab97084be)) + ## 1.2.8 (2024-11-18) Full Changelog: [v1.2.7...v1.2.8](https://github.com/OneBusAway/python-sdk/compare/v1.2.7...v1.2.8) diff --git a/pyproject.toml b/pyproject.toml index 59a90c0..3f079a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.8" +version = "1.2.9" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 69905b8..499f851 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.8" # x-release-please-version +__version__ = "1.2.9" # x-release-please-version From 01ce55e62282857be2836d4810001608b92e5643 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 20:07:45 +0000 Subject: [PATCH 125/397] docs: add info log level to readme (#161) --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76c5214..557c3a0 100644 --- a/README.md +++ b/README.md @@ -168,12 +168,14 @@ Note that requests that time out are [retried twice by default](#retries). We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `ONEBUSAWAY_SDK_LOG` to `debug`. +You can enable logging by setting the environment variable `ONEBUSAWAY_SDK_LOG` to `info`. ```shell -$ export ONEBUSAWAY_SDK_LOG=debug +$ export ONEBUSAWAY_SDK_LOG=info ``` +Or to `debug` for more verbose logging. + ### How to tell whether `None` means `null` or missing In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`: From 3d20f157b1a14f032e1e3ade7d0a48200528dbeb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 20:08:02 +0000 Subject: [PATCH 126/397] release: 1.2.10 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8d58a58..afadec2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.9" + ".": "1.2.10" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ebf0a86..7e160eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.10 (2024-11-22) + +Full Changelog: [v1.2.9...v1.2.10](https://github.com/OneBusAway/python-sdk/compare/v1.2.9...v1.2.10) + +### Documentation + +* add info log level to readme ([#161](https://github.com/OneBusAway/python-sdk/issues/161)) ([4b74a14](https://github.com/OneBusAway/python-sdk/commit/4b74a1477b8492d102775395bd688fb2cefd17fa)) + ## 1.2.9 (2024-11-22) Full Changelog: [v1.2.8...v1.2.9](https://github.com/OneBusAway/python-sdk/compare/v1.2.8...v1.2.9) diff --git a/pyproject.toml b/pyproject.toml index 3f079a8..4b80bca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.9" +version = "1.2.10" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 499f851..1fd9312 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.9" # x-release-please-version +__version__ = "1.2.10" # x-release-please-version From 46bd5df8378cb70e0a2c827d4ee1e67a2e273d32 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 07:19:35 +0000 Subject: [PATCH 127/397] chore: remove now unused `cached-property` dep (#164) --- pyproject.toml | 1 - src/onebusaway/_compat.py | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4b80bca..19ad59c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ dependencies = [ "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", - "cached-property; python_version < '3.8'", ] requires-python = ">= 3.8" classifiers = [ diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index df173f8..92d9ee6 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -214,9 +214,6 @@ def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable def __set__(self, instance: object, value: _T) -> None: ... else: - try: - from functools import cached_property as cached_property - except ImportError: - from cached_property import cached_property as cached_property + from functools import cached_property as cached_property typed_cached_property = cached_property From e796432c5f53d9137c73e1b5ab0fa4dd825285a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 07:19:50 +0000 Subject: [PATCH 128/397] release: 1.2.11 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index afadec2..cec5428 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.10" + ".": "1.2.11" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e160eb..1ef7db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.11 (2024-11-26) + +Full Changelog: [v1.2.10...v1.2.11](https://github.com/OneBusAway/python-sdk/compare/v1.2.10...v1.2.11) + +### Chores + +* remove now unused `cached-property` dep ([#164](https://github.com/OneBusAway/python-sdk/issues/164)) ([327cdeb](https://github.com/OneBusAway/python-sdk/commit/327cdeb051074bbdb55fe9848c714e46d4c0f22b)) + ## 1.2.10 (2024-11-22) Full Changelog: [v1.2.9...v1.2.10](https://github.com/OneBusAway/python-sdk/compare/v1.2.9...v1.2.10) diff --git a/pyproject.toml b/pyproject.toml index 19ad59c..1ead629 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.10" +version = "1.2.11" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 1fd9312..987880b 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.10" # x-release-please-version +__version__ = "1.2.11" # x-release-please-version From 13ea0e196484daba2221ca47823ef93208afe7c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:25:47 +0000 Subject: [PATCH 129/397] chore(internal): exclude mypy from running on tests (#167) --- mypy.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 635eec8..4db4836 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,7 +5,10 @@ show_error_codes = True # Exclude _files.py because mypy isn't smart enough to apply # the correct type narrowing and as this is an internal module # it's fine to just use Pyright. -exclude = ^(src/onebusaway/_files\.py|_dev/.*\.py)$ +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ^(src/onebusaway/_files\.py|_dev/.*\.py|tests/.*)$ strict_equality = True implicit_reexport = True From dfa8ee75857e2e1280a8c9cc3fd165ce06939132 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:26:03 +0000 Subject: [PATCH 130/397] release: 1.2.12 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cec5428..c68ec31 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.11" + ".": "1.2.12" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ef7db0..ea03a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.12 (2024-11-28) + +Full Changelog: [v1.2.11...v1.2.12](https://github.com/OneBusAway/python-sdk/compare/v1.2.11...v1.2.12) + +### Chores + +* **internal:** exclude mypy from running on tests ([#167](https://github.com/OneBusAway/python-sdk/issues/167)) ([e5a89a4](https://github.com/OneBusAway/python-sdk/commit/e5a89a4ded2e8cedee272429a77c6edd921bc55d)) + ## 1.2.11 (2024-11-26) Full Changelog: [v1.2.10...v1.2.11](https://github.com/OneBusAway/python-sdk/compare/v1.2.10...v1.2.11) diff --git a/pyproject.toml b/pyproject.toml index 1ead629..a894ead 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.11" +version = "1.2.12" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 987880b..fcc366b 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.11" # x-release-please-version +__version__ = "1.2.12" # x-release-please-version From ffd946272943385fa7c6049f3ced8bfe6764b0fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:11:18 +0000 Subject: [PATCH 131/397] fix(client): compat with new httpx 0.28.0 release (#170) --- src/onebusaway/_base_client.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 6685e1c..3eb1d07 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -792,6 +792,7 @@ def __init__( custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: + kwargs: dict[str, Any] = {} if limits is not None: warnings.warn( "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", @@ -804,6 +805,7 @@ def __init__( limits = DEFAULT_CONNECTION_LIMITS if transport is not None: + kwargs["transport"] = transport warnings.warn( "The `transport` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -813,6 +815,7 @@ def __init__( raise ValueError("The `http_client` argument is mutually exclusive with `transport`") if proxies is not None: + kwargs["proxies"] = proxies warnings.warn( "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -856,10 +859,9 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, limits=limits, follow_redirects=True, + **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -1358,6 +1360,7 @@ def __init__( custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: + kwargs: dict[str, Any] = {} if limits is not None: warnings.warn( "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", @@ -1370,6 +1373,7 @@ def __init__( limits = DEFAULT_CONNECTION_LIMITS if transport is not None: + kwargs["transport"] = transport warnings.warn( "The `transport` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -1379,6 +1383,7 @@ def __init__( raise ValueError("The `http_client` argument is mutually exclusive with `transport`") if proxies is not None: + kwargs["proxies"] = proxies warnings.warn( "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", category=DeprecationWarning, @@ -1422,10 +1427,9 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, limits=limits, follow_redirects=True, + **kwargs, # type: ignore ) def is_closed(self) -> bool: From 75ea594b5471a9b7f0d91d4a76631b542aa44d0d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:11:58 +0000 Subject: [PATCH 132/397] release: 1.2.13 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c68ec31..9a5343c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.12" + ".": "1.2.13" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ea03a40..d1f6cf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.13 (2024-11-28) + +Full Changelog: [v1.2.12...v1.2.13](https://github.com/OneBusAway/python-sdk/compare/v1.2.12...v1.2.13) + +### Bug Fixes + +* **client:** compat with new httpx 0.28.0 release ([#170](https://github.com/OneBusAway/python-sdk/issues/170)) ([0409197](https://github.com/OneBusAway/python-sdk/commit/0409197d1a693e5882a4553bb5ce223c12d42966)) + ## 1.2.12 (2024-11-28) Full Changelog: [v1.2.11...v1.2.12](https://github.com/OneBusAway/python-sdk/compare/v1.2.11...v1.2.12) diff --git a/pyproject.toml b/pyproject.toml index a894ead..12832c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.12" +version = "1.2.13" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index fcc366b..5bf58b8 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.12" # x-release-please-version +__version__ = "1.2.13" # x-release-please-version From f3b2c1129297883ec99cb4eff6aaac6983734fe4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:04:31 +0000 Subject: [PATCH 133/397] feat(api): api update (#173) --- .stats.yml | 2 +- .../types/schedule_for_route_retrieve_response.py | 14 +++++++------- .../types/search_for_stop_list_response.py | 14 +++++++------- src/onebusaway/types/shared/references.py | 14 +++++++------- src/onebusaway/types/stop_retrieve_response.py | 14 +++++++------- .../types/stops_for_location_list_response.py | 2 ++ 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0ebc21b..acd4ac2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-d04668d97c66a80708cb1896ce9638dc2b55670ed447b67d9833f6a5349cc210.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 17f04e0..8266786 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -22,23 +22,23 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): id: str - code: str - lat: float lon: float name: str - direction: Optional[str] = None + parent: str - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + route_ids: List[str] = FieldInfo(alias="routeIds") - parent: Optional[str] = None + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + code: Optional[str] = None - static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index e5a4e29..502455c 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -14,23 +14,23 @@ class SearchForStopListResponseDataList(BaseModel): id: str - code: str - lat: float lon: float name: str - direction: Optional[str] = None + parent: str - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + route_ids: List[str] = FieldInfo(alias="routeIds") - parent: Optional[str] = None + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + code: Optional[str] = None - static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 98e9026..8c6deab 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -197,23 +197,23 @@ class Situation(BaseModel): class Stop(BaseModel): id: str - code: str - lat: float lon: float name: str - direction: Optional[str] = None + parent: str - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + route_ids: List[str] = FieldInfo(alias="routeIds") - parent: Optional[str] = None + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + code: Optional[str] = None - static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 105a50c..6a69553 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -14,23 +14,23 @@ class StopRetrieveResponseDataEntry(BaseModel): id: str - code: str - lat: float lon: float name: str - direction: Optional[str] = None + parent: str - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + route_ids: List[str] = FieldInfo(alias="routeIds") - parent: Optional[str] = None + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) + code: Optional[str] = None - static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index a74aea4..e075eb1 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -42,6 +42,8 @@ class StopsForLocationListResponseData(BaseModel): references: References + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + class StopsForLocationListResponse(ResponseWrapper): data: StopsForLocationListResponseData From 74179dc2bc564355593ab6a117f656566f060084 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:04:47 +0000 Subject: [PATCH 134/397] release: 1.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9a5343c..2a8f4ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.13" + ".": "1.3.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f6cf6..0b9234f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.3.0 (2024-11-29) + +Full Changelog: [v1.2.13...v1.3.0](https://github.com/OneBusAway/python-sdk/compare/v1.2.13...v1.3.0) + +### Features + +* **api:** api update ([#173](https://github.com/OneBusAway/python-sdk/issues/173)) ([91ac1e7](https://github.com/OneBusAway/python-sdk/commit/91ac1e776ed5f17d523bb61ec78d9aa9f037c5c4)) + ## 1.2.13 (2024-11-28) Full Changelog: [v1.2.12...v1.2.13](https://github.com/OneBusAway/python-sdk/compare/v1.2.12...v1.2.13) diff --git a/pyproject.toml b/pyproject.toml index 12832c3..92bbca8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.2.13" +version = "1.3.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 5bf58b8..4c4bbc1 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.2.13" # x-release-please-version +__version__ = "1.3.0" # x-release-please-version From c5b914cbe5e4bee20639ad6bac71ab4f791b8f7c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:05:58 +0000 Subject: [PATCH 135/397] feat(api): api update (#176) --- .stats.yml | 2 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/stops_for_agency.py | 163 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/stops_for_agency_list_response.py | 45 +++++ tests/api_resources/test_stops_for_agency.py | 98 +++++++++++ 8 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 src/onebusaway/resources/stops_for_agency.py create mode 100644 src/onebusaway/types/stops_for_agency_list_response.py create mode 100644 tests/api_resources/test_stops_for_agency.py diff --git a/.stats.yml b/.stats.yml index acd4ac2..d4b713b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 28 +configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml diff --git a/api.md b/api.md index 2a318ed..7a627ca 100644 --- a/api.md +++ b/api.md @@ -88,6 +88,18 @@ Methods: - client.stops_for_route.list(route_id, \*\*params) -> StopsForRouteListResponse +# StopsForAgency + +Types: + +```python +from onebusaway.types import StopsForAgencyListResponse +``` + +Methods: + +- client.stops_for_agency.list(agency_id) -> StopsForAgencyListResponse + # Stop Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 9907b34..207684b 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -53,6 +53,7 @@ class OnebusawaySDK(SyncAPIClient): current_time: resources.CurrentTimeResource stops_for_location: resources.StopsForLocationResource stops_for_route: resources.StopsForRouteResource + stops_for_agency: resources.StopsForAgencyResource stop: resources.StopResource stop_ids_for_agency: resources.StopIDsForAgencyResource schedule_for_stop: resources.ScheduleForStopResource @@ -137,6 +138,7 @@ def __init__( self.current_time = resources.CurrentTimeResource(self) self.stops_for_location = resources.StopsForLocationResource(self) self.stops_for_route = resources.StopsForRouteResource(self) + self.stops_for_agency = resources.StopsForAgencyResource(self) self.stop = resources.StopResource(self) self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self) self.schedule_for_stop = resources.ScheduleForStopResource(self) @@ -281,6 +283,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): current_time: resources.AsyncCurrentTimeResource stops_for_location: resources.AsyncStopsForLocationResource stops_for_route: resources.AsyncStopsForRouteResource + stops_for_agency: resources.AsyncStopsForAgencyResource stop: resources.AsyncStopResource stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource schedule_for_stop: resources.AsyncScheduleForStopResource @@ -365,6 +368,7 @@ def __init__( self.current_time = resources.AsyncCurrentTimeResource(self) self.stops_for_location = resources.AsyncStopsForLocationResource(self) self.stops_for_route = resources.AsyncStopsForRouteResource(self) + self.stops_for_agency = resources.AsyncStopsForAgencyResource(self) self.stop = resources.AsyncStopResource(self) self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self) self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) @@ -512,6 +516,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time) self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route) + self.stops_for_agency = resources.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = resources.StopResourceWithRawResponse(client.stop) self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) @@ -549,6 +554,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time) self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) + self.stops_for_agency = resources.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = resources.AsyncStopResourceWithRawResponse(client.stop) self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) @@ -588,6 +594,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time) self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stops_for_agency = resources.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = resources.StopResourceWithStreamingResponse(client.stop) self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) @@ -633,6 +640,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.stops_for_location ) self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stops_for_agency = resources.AsyncStopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse( client.stop_ids_for_agency diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index d72f3d6..0a958d2 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -104,6 +104,14 @@ SearchForRouteResourceWithStreamingResponse, AsyncSearchForRouteResourceWithStreamingResponse, ) +from .stops_for_agency import ( + StopsForAgencyResource, + AsyncStopsForAgencyResource, + StopsForAgencyResourceWithRawResponse, + AsyncStopsForAgencyResourceWithRawResponse, + StopsForAgencyResourceWithStreamingResponse, + AsyncStopsForAgencyResourceWithStreamingResponse, +) from .trip_for_vehicle import ( TripForVehicleResource, AsyncTripForVehicleResource, @@ -260,6 +268,12 @@ "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", + "StopsForAgencyResource", + "AsyncStopsForAgencyResource", + "StopsForAgencyResourceWithRawResponse", + "AsyncStopsForAgencyResourceWithRawResponse", + "StopsForAgencyResourceWithStreamingResponse", + "AsyncStopsForAgencyResourceWithStreamingResponse", "StopResource", "AsyncStopResource", "StopResourceWithRawResponse", diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py new file mode 100644 index 0000000..0aa3acc --- /dev/null +++ b/src/onebusaway/resources/stops_for_agency.py @@ -0,0 +1,163 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stops_for_agency_list_response import StopsForAgencyListResponse + +__all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] + + +class StopsForAgencyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StopsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return StopsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StopsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return StopsForAgencyResourceWithStreamingResponse(self) + + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForAgencyListResponse: + """ + Get stops for a specific agency + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return self._get( + f"/api/where/stops-for-agency/{agency_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StopsForAgencyListResponse, + ) + + +class AsyncStopsForAgencyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStopsForAgencyResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return AsyncStopsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStopsForAgencyResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return AsyncStopsForAgencyResourceWithStreamingResponse(self) + + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForAgencyListResponse: + """ + Get stops for a specific agency + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not agency_id: + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + return await self._get( + f"/api/where/stops-for-agency/{agency_id}.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StopsForAgencyListResponse, + ) + + +class StopsForAgencyResourceWithRawResponse: + def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: + self._stops_for_agency = stops_for_agency + + self.list = to_raw_response_wrapper( + stops_for_agency.list, + ) + + +class AsyncStopsForAgencyResourceWithRawResponse: + def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: + self._stops_for_agency = stops_for_agency + + self.list = async_to_raw_response_wrapper( + stops_for_agency.list, + ) + + +class StopsForAgencyResourceWithStreamingResponse: + def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: + self._stops_for_agency = stops_for_agency + + self.list = to_streamed_response_wrapper( + stops_for_agency.list, + ) + + +class AsyncStopsForAgencyResourceWithStreamingResponse: + def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: + self._stops_for_agency = stops_for_agency + + self.list = async_to_streamed_response_wrapper( + stops_for_agency.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 3d9dab0..a4bb996 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -21,6 +21,7 @@ from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse +from .stops_for_agency_list_response import StopsForAgencyListResponse as StopsForAgencyListResponse from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py new file mode 100644 index 0000000..422c5ee --- /dev/null +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] + + +class StopsForAgencyListResponseList(BaseModel): + id: str + + lat: float + + lon: float + + name: str + + parent: str + + route_ids: List[str] = FieldInfo(alias="routeIds") + + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + + code: Optional[str] = None + + direction: Optional[str] = None + + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + + +class StopsForAgencyListResponse(ResponseWrapper): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[StopsForAgencyListResponseList] + + references: References + + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py new file mode 100644 index 0000000..7c6538e --- /dev/null +++ b/tests/api_resources/test_stops_for_agency.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import StopsForAgencyListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStopsForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + stops_for_agency = client.stops_for_agency.list( + "agencyID", + ) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stops_for_agency = response.parse() + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.stops_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stops_for_agency = response.parse() + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + client.stops_for_agency.with_raw_response.list( + "", + ) + + +class TestAsyncStopsForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_agency = await async_client.stops_for_agency.list( + "agencyID", + ) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_agency.with_raw_response.list( + "agencyID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stops_for_agency = await response.parse() + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.stops_for_agency.with_streaming_response.list( + "agencyID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stops_for_agency = await response.parse() + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): + await async_client.stops_for_agency.with_raw_response.list( + "", + ) From a77708af21a4aa6d0043b4e3350b8ba45ecefe5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 22:06:13 +0000 Subject: [PATCH 136/397] release: 1.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ff..3e9af1b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "1.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9234f..4c7d8d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.0 (2024-11-29) + +Full Changelog: [v1.3.0...v1.4.0](https://github.com/OneBusAway/python-sdk/compare/v1.3.0...v1.4.0) + +### Features + +* **api:** api update ([#176](https://github.com/OneBusAway/python-sdk/issues/176)) ([b66eab7](https://github.com/OneBusAway/python-sdk/commit/b66eab729a4ace0919b928169f793e5ffdb62a47)) + ## 1.3.0 (2024-11-29) Full Changelog: [v1.2.13...v1.3.0](https://github.com/OneBusAway/python-sdk/compare/v1.2.13...v1.3.0) diff --git a/pyproject.toml b/pyproject.toml index 92bbca8..c991f12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.3.0" +version = "1.4.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4c4bbc1..0aba9b9 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.3.0" # x-release-please-version +__version__ = "1.4.0" # x-release-please-version From f0f0c67cc6b5a2473d7b24510796d88373d71b74 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 07:17:51 +0000 Subject: [PATCH 137/397] chore(internal): codegen related update (#179) --- requirements-dev.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 25e1348..ed3481f 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -69,7 +69,7 @@ pydantic-core==2.23.4 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.380 +pyright==1.1.389 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 @@ -98,6 +98,7 @@ typing-extensions==4.12.2 # via onebusaway # via pydantic # via pydantic-core + # via pyright virtualenv==20.24.5 # via nox zipp==3.17.0 From b3fa0439e473ba68972a9a36af54f2ac2a1d6690 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 07:18:08 +0000 Subject: [PATCH 138/397] release: 1.4.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3e9af1b..7325798 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.0" + ".": "1.4.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7d8d4..1775e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.1 (2024-12-03) + +Full Changelog: [v1.4.0...v1.4.1](https://github.com/OneBusAway/python-sdk/compare/v1.4.0...v1.4.1) + +### Chores + +* **internal:** codegen related update ([#179](https://github.com/OneBusAway/python-sdk/issues/179)) ([113387e](https://github.com/OneBusAway/python-sdk/commit/113387ece3ec8ba6cfa09f9097c083e8858a7a2c)) + ## 1.4.0 (2024-11-29) Full Changelog: [v1.3.0...v1.4.0](https://github.com/OneBusAway/python-sdk/compare/v1.3.0...v1.4.0) diff --git a/pyproject.toml b/pyproject.toml index c991f12..0d90d34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.0" +version = "1.4.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0aba9b9..6fa525e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.0" # x-release-please-version +__version__ = "1.4.1" # x-release-please-version From cd0f27e796d255cf20b23b6418c200faec5b35d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:27:45 +0000 Subject: [PATCH 139/397] chore: make the `Omit` type public (#182) --- src/onebusaway/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index b078fea..2e0349f 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from . import types -from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path from ._client import ( Client, @@ -46,6 +46,7 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "Omit", "OnebusawaySDKError", "APIError", "APIStatusError", From 34e83cf657ff09a3e6a538b83114fe5497154868 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:28:01 +0000 Subject: [PATCH 140/397] release: 1.4.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7325798..3ed3ffc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.1" + ".": "1.4.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1775e29..cd5152b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.2 (2024-12-04) + +Full Changelog: [v1.4.1...v1.4.2](https://github.com/OneBusAway/python-sdk/compare/v1.4.1...v1.4.2) + +### Chores + +* make the `Omit` type public ([#182](https://github.com/OneBusAway/python-sdk/issues/182)) ([cd0f27e](https://github.com/OneBusAway/python-sdk/commit/cd0f27e796d255cf20b23b6418c200faec5b35d0)) + ## 1.4.1 (2024-12-03) Full Changelog: [v1.4.0...v1.4.1](https://github.com/OneBusAway/python-sdk/compare/v1.4.0...v1.4.1) diff --git a/pyproject.toml b/pyproject.toml index 0d90d34..3abab78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.1" +version = "1.4.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6fa525e..4bae195 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.1" # x-release-please-version +__version__ = "1.4.2" # x-release-please-version From e0f85ec136299ddb088fa7d0b05a7b4f6708ca46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:16:36 +0000 Subject: [PATCH 141/397] chore(internal): bump pydantic dependency (#185) --- requirements-dev.lock | 4 ++-- requirements.lock | 4 ++-- src/onebusaway/_types.py | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index ed3481f..47e0b7c 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -63,9 +63,9 @@ platformdirs==3.11.0 # via virtualenv pluggy==1.5.0 # via pytest -pydantic==2.9.2 +pydantic==2.10.3 # via onebusaway -pydantic-core==2.23.4 +pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich diff --git a/requirements.lock b/requirements.lock index e06c227..74aed81 100644 --- a/requirements.lock +++ b/requirements.lock @@ -31,9 +31,9 @@ httpx==0.25.2 idna==3.4 # via anyio # via httpx -pydantic==2.9.2 +pydantic==2.10.3 # via onebusaway -pydantic-core==2.23.4 +pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 0f66e1c..a457723 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -192,10 +192,8 @@ def get(self, __key: str) -> str | None: ... StrBytesIntFloat = Union[str, bytes, int, float] # Note: copied from Pydantic -# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49 -IncEx: TypeAlias = Union[ - Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]] -] +# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79 +IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]] PostParser = Callable[[Any], Any] From c474f1c837872a57f02ec3d1c6197e2b475d6d72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:16:55 +0000 Subject: [PATCH 142/397] release: 1.4.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3ed3ffc..d16b30c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.2" + ".": "1.4.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cd5152b..18bf960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.3 (2024-12-10) + +Full Changelog: [v1.4.2...v1.4.3](https://github.com/OneBusAway/python-sdk/compare/v1.4.2...v1.4.3) + +### Chores + +* **internal:** bump pydantic dependency ([#185](https://github.com/OneBusAway/python-sdk/issues/185)) ([592e261](https://github.com/OneBusAway/python-sdk/commit/592e2619ae0d6b486c14c25812f7e0c5402fe068)) + ## 1.4.2 (2024-12-04) Full Changelog: [v1.4.1...v1.4.2](https://github.com/OneBusAway/python-sdk/compare/v1.4.1...v1.4.2) diff --git a/pyproject.toml b/pyproject.toml index 3abab78..87a7bac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.2" +version = "1.4.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4bae195..8a1a7ae 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.2" # x-release-please-version +__version__ = "1.4.3" # x-release-please-version From 49ece4859dbb17c94bc6bb3cdf0bc4aec14cf9a6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:18:13 +0000 Subject: [PATCH 143/397] chore(internal): codegen related update (#188) --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 557c3a0..72dd05b 100644 --- a/README.md +++ b/README.md @@ -262,18 +262,19 @@ can also get all the extra fields on the Pydantic model as a dict with You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including: -- Support for proxies -- Custom transports +- Support for [proxies](https://www.python-httpx.org/advanced/proxies/) +- Custom [transports](https://www.python-httpx.org/advanced/transports/) - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality ```python +import httpx from onebusaway import OnebusawaySDK, DefaultHttpxClient client = OnebusawaySDK( # Or use the `ONEBUSAWAY_SDK_BASE_URL` env var base_url="http://my.test.server.example.com:8083", http_client=DefaultHttpxClient( - proxies="http://my.test.proxy.example.com", + proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) From 1ba3e030eadf5127a91af4153bce43de701dce72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:18:29 +0000 Subject: [PATCH 144/397] release: 1.4.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d16b30c..3404c7f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.3" + ".": "1.4.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 18bf960..8e69861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.4 (2024-12-10) + +Full Changelog: [v1.4.3...v1.4.4](https://github.com/OneBusAway/python-sdk/compare/v1.4.3...v1.4.4) + +### Chores + +* **internal:** codegen related update ([#188](https://github.com/OneBusAway/python-sdk/issues/188)) ([6a5ace1](https://github.com/OneBusAway/python-sdk/commit/6a5ace19835fb7d3ebe9dc8c29883b5002b9967a)) + ## 1.4.3 (2024-12-10) Full Changelog: [v1.4.2...v1.4.3](https://github.com/OneBusAway/python-sdk/compare/v1.4.2...v1.4.3) diff --git a/pyproject.toml b/pyproject.toml index 87a7bac..b09cbfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.3" +version = "1.4.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8a1a7ae..313a3ea 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.3" # x-release-please-version +__version__ = "1.4.4" # x-release-please-version From c6f6a26c7d00578b0fb68401fd6239e45a19ef1a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:07:51 +0000 Subject: [PATCH 145/397] chore(internal): codegen related update (#191) --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- src/onebusaway/_models.py | 3 +++ src/onebusaway/_response.py | 20 ++++++++++---------- src/onebusaway/_utils/__init__.py | 1 + src/onebusaway/_utils/_typing.py | 31 ++++++++++++++++++++++++++++++- tests/test_models.py | 18 +++++++++++++++++- tests/utils.py | 4 ++++ 8 files changed, 67 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b09cbfe..693fbd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.7, <5", + "typing-extensions>=4.10, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 47e0b7c..c27541f 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -69,7 +69,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.389 +pyright==1.1.390 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 6cb469e..7a547ce 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -46,6 +46,7 @@ strip_not_given, extract_type_arg, is_annotated_type, + is_type_alias_type, strip_annotated_type, ) from ._compat import ( @@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object: # we allow `object` as the input type because otherwise, passing things like # `Literal['value']` will be reported as a type error by type checkers type_ = cast("type[object]", type_) + if is_type_alias_type(type_): + type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` if is_annotated_type(type_): diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 1121cd0..3cc5c5b 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -25,7 +25,7 @@ import pydantic from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type @@ -126,9 +126,15 @@ def __repr__(self) -> str: ) def _parse(self, *, to: type[_T] | None = None) -> R | _T: + cast_to = to if to is not None else self._cast_to + + # unwrap `TypeAlias('Name', T)` -> `T` + if is_type_alias_type(cast_to): + cast_to = cast_to.__value__ # type: ignore[unreachable] + # unwrap `Annotated[T, ...]` -> `T` - if to and is_annotated_type(to): - to = extract_type_arg(to, 0) + if cast_to and is_annotated_type(cast_to): + cast_to = extract_type_arg(cast_to, 0) if self._is_sse_stream: if to: @@ -164,18 +170,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: return cast( R, stream_cls( - cast_to=self._cast_to, + cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), ), ) - cast_to = to if to is not None else self._cast_to - - # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(cast_to): - cast_to = extract_type_arg(cast_to, 0) - if cast_to is NoneType: return cast(R, None) diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py index a7cff3c..d4fda26 100644 --- a/src/onebusaway/_utils/__init__.py +++ b/src/onebusaway/_utils/__init__.py @@ -39,6 +39,7 @@ is_iterable_type as is_iterable_type, is_required_type as is_required_type, is_annotated_type as is_annotated_type, + is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, extract_type_var_from_base as extract_type_var_from_base, ) diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index c036991..278749b 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -1,8 +1,17 @@ from __future__ import annotations +import sys +import typing +import typing_extensions from typing import Any, TypeVar, Iterable, cast from collections import abc as _c_abc -from typing_extensions import Required, Annotated, get_args, get_origin +from typing_extensions import ( + TypeIs, + Required, + Annotated, + get_args, + get_origin, +) from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool: return type(typ) == TypeVar # type: ignore +_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,) +if sys.version_info >= (3, 12): + _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) + + +def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: + """Return whether the provided argument is an instance of `TypeAliasType`. + + ```python + type Int = int + is_type_alias_type(Int) + # > True + Str = TypeAliasType("Str", str) + is_type_alias_type(Str) + # > True + ``` + """ + return isinstance(tp, _TYPE_ALIAS_TYPES) + + # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): diff --git a/tests/test_models.py b/tests/test_models.py index b1c88ed..8a7807e 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,7 +1,7 @@ import json from typing import Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone -from typing_extensions import Literal, Annotated +from typing_extensions import Literal, Annotated, TypeAliasType import pytest import pydantic @@ -828,3 +828,19 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache assert UnionType.__discriminator__ is discriminator + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_type_alias_type() -> None: + Alias = TypeAliasType("Alias", str) + + class Model(BaseModel): + alias: Alias + union: Union[int, Alias] + + m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.alias, str) + assert m.alias == "foo" + assert isinstance(m.union, str) + assert m.union == "bar" diff --git a/tests/utils.py b/tests/utils.py index dd259a5..37ee5d0 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -16,6 +16,7 @@ is_union_type, extract_type_arg, is_annotated_type, + is_type_alias_type, ) from onebusaway._compat import PYDANTIC_V2, field_outer_type, get_model_fields from onebusaway._models import BaseModel @@ -51,6 +52,9 @@ def assert_matches_type( path: list[str], allow_none: bool = False, ) -> None: + if is_type_alias_type(type_): + type_ = type_.__value__ + # unwrap `Annotated[T, ...]` -> `T` if is_annotated_type(type_): type_ = extract_type_arg(type_, 0) From 466b2349eb175aa424712e26474f785aca365e56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:08:08 +0000 Subject: [PATCH 146/397] release: 1.4.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3404c7f..c768a6a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.4" + ".": "1.4.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e69861..3bed81b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.5 (2024-12-13) + +Full Changelog: [v1.4.4...v1.4.5](https://github.com/OneBusAway/python-sdk/compare/v1.4.4...v1.4.5) + +### Chores + +* **internal:** codegen related update ([#191](https://github.com/OneBusAway/python-sdk/issues/191)) ([7bd6b7d](https://github.com/OneBusAway/python-sdk/commit/7bd6b7dd25b58fcc1e995086a380975f25535065)) + ## 1.4.4 (2024-12-10) Full Changelog: [v1.4.3...v1.4.4](https://github.com/OneBusAway/python-sdk/compare/v1.4.3...v1.4.4) diff --git a/pyproject.toml b/pyproject.toml index 693fbd3..29723a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.4" +version = "1.4.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 313a3ea..006d07c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.4" # x-release-please-version +__version__ = "1.4.5" # x-release-please-version From b87dc0c38c2621c0dc823ea68dab05ad35d2fa78 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Dec 2024 07:09:38 +0000 Subject: [PATCH 147/397] chore(internal): codegen related update (#194) --- src/onebusaway/_client.py | 539 ++++++++++++++++++++++---------------- 1 file changed, 311 insertions(+), 228 deletions(-) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 207684b..dd3c800 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -8,7 +8,7 @@ import httpx -from . import resources, _exceptions +from . import _exceptions from ._qs import Querystring from ._types import ( NOT_GIVEN, @@ -24,6 +24,36 @@ get_async_library, ) from ._version import __version__ +from .resources import ( + stop, + trip, + block, + route, + shape, + agency, + config, + current_time, + trip_details, + search_for_stop, + stops_for_route, + trips_for_route, + search_for_route, + stops_for_agency, + trip_for_vehicle, + routes_for_agency, + schedule_for_stop, + schedule_for_route, + stops_for_location, + trips_for_location, + routes_for_location, + stop_ids_for_agency, + vehicles_for_agency, + route_ids_for_agency, + arrival_and_departure, + agencies_with_coverage, + report_problem_with_stop, + report_problem_with_trip, +) from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError, OnebusawaySDKError from ._base_client import ( @@ -37,7 +67,6 @@ "Transport", "ProxiesTypes", "RequestOptions", - "resources", "OnebusawaySDK", "AsyncOnebusawaySDK", "Client", @@ -46,34 +75,34 @@ class OnebusawaySDK(SyncAPIClient): - agencies_with_coverage: resources.AgenciesWithCoverageResource - agency: resources.AgencyResource - vehicles_for_agency: resources.VehiclesForAgencyResource - config: resources.ConfigResource - current_time: resources.CurrentTimeResource - stops_for_location: resources.StopsForLocationResource - stops_for_route: resources.StopsForRouteResource - stops_for_agency: resources.StopsForAgencyResource - stop: resources.StopResource - stop_ids_for_agency: resources.StopIDsForAgencyResource - schedule_for_stop: resources.ScheduleForStopResource - route: resources.RouteResource - route_ids_for_agency: resources.RouteIDsForAgencyResource - routes_for_location: resources.RoutesForLocationResource - routes_for_agency: resources.RoutesForAgencyResource - schedule_for_route: resources.ScheduleForRouteResource - arrival_and_departure: resources.ArrivalAndDepartureResource - trip: resources.TripResource - trips_for_location: resources.TripsForLocationResource - trip_details: resources.TripDetailsResource - trip_for_vehicle: resources.TripForVehicleResource - trips_for_route: resources.TripsForRouteResource - report_problem_with_stop: resources.ReportProblemWithStopResource - report_problem_with_trip: resources.ReportProblemWithTripResource - search_for_stop: resources.SearchForStopResource - search_for_route: resources.SearchForRouteResource - block: resources.BlockResource - shape: resources.ShapeResource + agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource + agency: agency.AgencyResource + vehicles_for_agency: vehicles_for_agency.VehiclesForAgencyResource + config: config.ConfigResource + current_time: current_time.CurrentTimeResource + stops_for_location: stops_for_location.StopsForLocationResource + stops_for_route: stops_for_route.StopsForRouteResource + stops_for_agency: stops_for_agency.StopsForAgencyResource + stop: stop.StopResource + stop_ids_for_agency: stop_ids_for_agency.StopIDsForAgencyResource + schedule_for_stop: schedule_for_stop.ScheduleForStopResource + route: route.RouteResource + route_ids_for_agency: route_ids_for_agency.RouteIDsForAgencyResource + routes_for_location: routes_for_location.RoutesForLocationResource + routes_for_agency: routes_for_agency.RoutesForAgencyResource + schedule_for_route: schedule_for_route.ScheduleForRouteResource + arrival_and_departure: arrival_and_departure.ArrivalAndDepartureResource + trip: trip.TripResource + trips_for_location: trips_for_location.TripsForLocationResource + trip_details: trip_details.TripDetailsResource + trip_for_vehicle: trip_for_vehicle.TripForVehicleResource + trips_for_route: trips_for_route.TripsForRouteResource + report_problem_with_stop: report_problem_with_stop.ReportProblemWithStopResource + report_problem_with_trip: report_problem_with_trip.ReportProblemWithTripResource + search_for_stop: search_for_stop.SearchForStopResource + search_for_route: search_for_route.SearchForRouteResource + block: block.BlockResource + shape: shape.ShapeResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -131,34 +160,34 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self) - self.agency = resources.AgencyResource(self) - self.vehicles_for_agency = resources.VehiclesForAgencyResource(self) - self.config = resources.ConfigResource(self) - self.current_time = resources.CurrentTimeResource(self) - self.stops_for_location = resources.StopsForLocationResource(self) - self.stops_for_route = resources.StopsForRouteResource(self) - self.stops_for_agency = resources.StopsForAgencyResource(self) - self.stop = resources.StopResource(self) - self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self) - self.schedule_for_stop = resources.ScheduleForStopResource(self) - self.route = resources.RouteResource(self) - self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self) - self.routes_for_location = resources.RoutesForLocationResource(self) - self.routes_for_agency = resources.RoutesForAgencyResource(self) - self.schedule_for_route = resources.ScheduleForRouteResource(self) - self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) - self.trip = resources.TripResource(self) - self.trips_for_location = resources.TripsForLocationResource(self) - self.trip_details = resources.TripDetailsResource(self) - self.trip_for_vehicle = resources.TripForVehicleResource(self) - self.trips_for_route = resources.TripsForRouteResource(self) - self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) - self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) - self.search_for_stop = resources.SearchForStopResource(self) - self.search_for_route = resources.SearchForRouteResource(self) - self.block = resources.BlockResource(self) - self.shape = resources.ShapeResource(self) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResource(self) + self.agency = agency.AgencyResource(self) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResource(self) + self.config = config.ConfigResource(self) + self.current_time = current_time.CurrentTimeResource(self) + self.stops_for_location = stops_for_location.StopsForLocationResource(self) + self.stops_for_route = stops_for_route.StopsForRouteResource(self) + self.stops_for_agency = stops_for_agency.StopsForAgencyResource(self) + self.stop = stop.StopResource(self) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResource(self) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResource(self) + self.route = route.RouteResource(self) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResource(self) + self.routes_for_location = routes_for_location.RoutesForLocationResource(self) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResource(self) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResource(self) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResource(self) + self.trip = trip.TripResource(self) + self.trips_for_location = trips_for_location.TripsForLocationResource(self) + self.trip_details = trip_details.TripDetailsResource(self) + self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResource(self) + self.trips_for_route = trips_for_route.TripsForRouteResource(self) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResource(self) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResource(self) + self.search_for_stop = search_for_stop.SearchForStopResource(self) + self.search_for_route = search_for_route.SearchForRouteResource(self) + self.block = block.BlockResource(self) + self.shape = shape.ShapeResource(self) self.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -276,34 +305,34 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): - agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource - agency: resources.AsyncAgencyResource - vehicles_for_agency: resources.AsyncVehiclesForAgencyResource - config: resources.AsyncConfigResource - current_time: resources.AsyncCurrentTimeResource - stops_for_location: resources.AsyncStopsForLocationResource - stops_for_route: resources.AsyncStopsForRouteResource - stops_for_agency: resources.AsyncStopsForAgencyResource - stop: resources.AsyncStopResource - stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource - schedule_for_stop: resources.AsyncScheduleForStopResource - route: resources.AsyncRouteResource - route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource - routes_for_location: resources.AsyncRoutesForLocationResource - routes_for_agency: resources.AsyncRoutesForAgencyResource - schedule_for_route: resources.AsyncScheduleForRouteResource - arrival_and_departure: resources.AsyncArrivalAndDepartureResource - trip: resources.AsyncTripResource - trips_for_location: resources.AsyncTripsForLocationResource - trip_details: resources.AsyncTripDetailsResource - trip_for_vehicle: resources.AsyncTripForVehicleResource - trips_for_route: resources.AsyncTripsForRouteResource - report_problem_with_stop: resources.AsyncReportProblemWithStopResource - report_problem_with_trip: resources.AsyncReportProblemWithTripResource - search_for_stop: resources.AsyncSearchForStopResource - search_for_route: resources.AsyncSearchForRouteResource - block: resources.AsyncBlockResource - shape: resources.AsyncShapeResource + agencies_with_coverage: agencies_with_coverage.AsyncAgenciesWithCoverageResource + agency: agency.AsyncAgencyResource + vehicles_for_agency: vehicles_for_agency.AsyncVehiclesForAgencyResource + config: config.AsyncConfigResource + current_time: current_time.AsyncCurrentTimeResource + stops_for_location: stops_for_location.AsyncStopsForLocationResource + stops_for_route: stops_for_route.AsyncStopsForRouteResource + stops_for_agency: stops_for_agency.AsyncStopsForAgencyResource + stop: stop.AsyncStopResource + stop_ids_for_agency: stop_ids_for_agency.AsyncStopIDsForAgencyResource + schedule_for_stop: schedule_for_stop.AsyncScheduleForStopResource + route: route.AsyncRouteResource + route_ids_for_agency: route_ids_for_agency.AsyncRouteIDsForAgencyResource + routes_for_location: routes_for_location.AsyncRoutesForLocationResource + routes_for_agency: routes_for_agency.AsyncRoutesForAgencyResource + schedule_for_route: schedule_for_route.AsyncScheduleForRouteResource + arrival_and_departure: arrival_and_departure.AsyncArrivalAndDepartureResource + trip: trip.AsyncTripResource + trips_for_location: trips_for_location.AsyncTripsForLocationResource + trip_details: trip_details.AsyncTripDetailsResource + trip_for_vehicle: trip_for_vehicle.AsyncTripForVehicleResource + trips_for_route: trips_for_route.AsyncTripsForRouteResource + report_problem_with_stop: report_problem_with_stop.AsyncReportProblemWithStopResource + report_problem_with_trip: report_problem_with_trip.AsyncReportProblemWithTripResource + search_for_stop: search_for_stop.AsyncSearchForStopResource + search_for_route: search_for_route.AsyncSearchForRouteResource + block: block.AsyncBlockResource + shape: shape.AsyncShapeResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -361,34 +390,34 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self) - self.agency = resources.AsyncAgencyResource(self) - self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self) - self.config = resources.AsyncConfigResource(self) - self.current_time = resources.AsyncCurrentTimeResource(self) - self.stops_for_location = resources.AsyncStopsForLocationResource(self) - self.stops_for_route = resources.AsyncStopsForRouteResource(self) - self.stops_for_agency = resources.AsyncStopsForAgencyResource(self) - self.stop = resources.AsyncStopResource(self) - self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self) - self.schedule_for_stop = resources.AsyncScheduleForStopResource(self) - self.route = resources.AsyncRouteResource(self) - self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self) - self.routes_for_location = resources.AsyncRoutesForLocationResource(self) - self.routes_for_agency = resources.AsyncRoutesForAgencyResource(self) - self.schedule_for_route = resources.AsyncScheduleForRouteResource(self) - self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) - self.trip = resources.AsyncTripResource(self) - self.trips_for_location = resources.AsyncTripsForLocationResource(self) - self.trip_details = resources.AsyncTripDetailsResource(self) - self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) - self.trips_for_route = resources.AsyncTripsForRouteResource(self) - self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) - self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) - self.search_for_stop = resources.AsyncSearchForStopResource(self) - self.search_for_route = resources.AsyncSearchForRouteResource(self) - self.block = resources.AsyncBlockResource(self) - self.shape = resources.AsyncShapeResource(self) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResource(self) + self.agency = agency.AsyncAgencyResource(self) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResource(self) + self.config = config.AsyncConfigResource(self) + self.current_time = current_time.AsyncCurrentTimeResource(self) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResource(self) + self.stops_for_route = stops_for_route.AsyncStopsForRouteResource(self) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResource(self) + self.stop = stop.AsyncStopResource(self) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResource(self) + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResource(self) + self.route = route.AsyncRouteResource(self) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResource(self) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResource(self) + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResource(self) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResource(self) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResource(self) + self.trip = trip.AsyncTripResource(self) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResource(self) + self.trip_details = trip_details.AsyncTripDetailsResource(self) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResource(self) + self.trips_for_route = trips_for_route.AsyncTripsForRouteResource(self) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResource(self) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResource(self) + self.search_for_stop = search_for_stop.AsyncSearchForStopResource(self) + self.search_for_route = search_for_route.AsyncSearchForRouteResource(self) + self.block = block.AsyncBlockResource(self) + self.shape = shape.AsyncShapeResource(self) self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -507,176 +536,230 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse( + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse( client.agencies_with_coverage ) - self.agency = resources.AgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) - self.config = resources.ConfigResourceWithRawResponse(client.config) - self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location) - self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route) - self.stops_for_agency = resources.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) - self.stop = resources.StopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) - self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) - self.route = resources.RouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) - self.routes_for_location = resources.RoutesForLocationResourceWithRawResponse(client.routes_for_location) - self.routes_for_agency = resources.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = resources.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) - self.trip = resources.TripResourceWithRawResponse(client.trip) - self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) - self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details) - self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) - self.trips_for_route = resources.TripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( + self.agency = agency.AgencyResourceWithRawResponse(client.agency) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse( + client.vehicles_for_agency + ) + self.config = config.ConfigResourceWithRawResponse(client.config) + self.current_time = current_time.CurrentTimeResourceWithRawResponse(client.current_time) + self.stops_for_location = stops_for_location.StopsForLocationResourceWithRawResponse(client.stops_for_location) + self.stops_for_route = stops_for_route.StopsForRouteResourceWithRawResponse(client.stops_for_route) + self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) + self.stop = stop.StopResourceWithRawResponse(client.stop) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse( + client.stop_ids_for_agency + ) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) + self.route = route.RouteResourceWithRawResponse(client.route) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse( + client.routes_for_location + ) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse( + client.arrival_and_departure + ) + self.trip = trip.TripResourceWithRawResponse(client.trip) + self.trips_for_location = trips_for_location.TripsForLocationResourceWithRawResponse(client.trips_for_location) + self.trip_details = trip_details.TripDetailsResourceWithRawResponse(client.trip_details) + self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = trips_for_route.TripsForRouteResourceWithRawResponse(client.trips_for_route) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) - self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithRawResponse( + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse( client.report_problem_with_trip ) - self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop) - self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route) - self.block = resources.BlockResourceWithRawResponse(client.block) - self.shape = resources.ShapeResourceWithRawResponse(client.shape) + self.search_for_stop = search_for_stop.SearchForStopResourceWithRawResponse(client.search_for_stop) + self.search_for_route = search_for_route.SearchForRouteResourceWithRawResponse(client.search_for_route) + self.block = block.BlockResourceWithRawResponse(client.block) + self.shape = shape.ShapeResourceWithRawResponse(client.shape) class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse( + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse( client.agencies_with_coverage ) - self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) - self.config = resources.AsyncConfigResourceWithRawResponse(client.config) - self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) - self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) - self.stops_for_agency = resources.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) - self.stop = resources.AsyncStopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) - self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) - self.route = resources.AsyncRouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) - self.routes_for_location = resources.AsyncRoutesForLocationResourceWithRawResponse(client.routes_for_location) - self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( + self.agency = agency.AsyncAgencyResourceWithRawResponse(client.agency) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse( + client.vehicles_for_agency + ) + self.config = config.AsyncConfigResourceWithRawResponse(client.config) + self.current_time = current_time.AsyncCurrentTimeResourceWithRawResponse(client.current_time) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse( + client.stops_for_location + ) + self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) + self.stop = stop.AsyncStopResourceWithRawResponse(client.stop) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse( + client.stop_ids_for_agency + ) + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) + self.route = route.AsyncRouteResourceWithRawResponse(client.route) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse( + client.routes_for_location + ) + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse( + client.schedule_for_route + ) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure ) - self.trip = resources.AsyncTripResourceWithRawResponse(client.trip) - self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) - self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details) - self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) - self.trips_for_route = resources.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( + self.trip = trip.AsyncTripResourceWithRawResponse(client.trip) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse( + client.trips_for_location + ) + self.trip_details = trip_details.AsyncTripDetailsResourceWithRawResponse(client.trip_details) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) - self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithRawResponse( + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse( client.report_problem_with_trip ) - self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) - self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) - self.block = resources.AsyncBlockResourceWithRawResponse(client.block) - self.shape = resources.AsyncShapeResourceWithRawResponse(client.shape) + self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) + self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) + self.block = block.AsyncBlockResourceWithRawResponse(client.block) + self.shape = shape.AsyncShapeResourceWithRawResponse(client.shape) class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse( + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse( client.agencies_with_coverage ) - self.agency = resources.AgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) - self.config = resources.ConfigResourceWithStreamingResponse(client.config) - self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) - self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = resources.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) - self.stop = resources.StopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) - self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) - self.route = resources.RouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithStreamingResponse( + self.agency = agency.AgencyResourceWithStreamingResponse(client.agency) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse( + client.vehicles_for_agency + ) + self.config = config.ConfigResourceWithStreamingResponse(client.config) + self.current_time = current_time.CurrentTimeResourceWithStreamingResponse(client.current_time) + self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse( + client.stops_for_location + ) + self.stops_for_route = stops_for_route.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) + self.stop = stop.StopResourceWithStreamingResponse(client.stop) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse( + client.stop_ids_for_agency + ) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse( + client.schedule_for_stop + ) + self.route = route.RouteResourceWithStreamingResponse(client.route) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) - self.routes_for_location = resources.RoutesForLocationResourceWithStreamingResponse(client.routes_for_location) - self.routes_for_agency = resources.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) - self.schedule_for_route = resources.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) - self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse( + client.routes_for_location + ) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse( + client.routes_for_agency + ) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse( + client.schedule_for_route + ) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) - self.trip = resources.TripResourceWithStreamingResponse(client.trip) - self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) - self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) - self.trips_for_route = resources.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( + self.trip = trip.TripResourceWithStreamingResponse(client.trip) + self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse( + client.trips_for_location + ) + self.trip_details = trip_details.TripDetailsResourceWithStreamingResponse(client.trip_details) + self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = trips_for_route.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) - self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithStreamingResponse( + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse( client.report_problem_with_trip ) - self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route) - self.block = resources.BlockResourceWithStreamingResponse(client.block) - self.shape = resources.ShapeResourceWithStreamingResponse(client.shape) + self.search_for_stop = search_for_stop.SearchForStopResourceWithStreamingResponse(client.search_for_stop) + self.search_for_route = search_for_route.SearchForRouteResourceWithStreamingResponse(client.search_for_route) + self.block = block.BlockResourceWithStreamingResponse(client.block) + self.shape = shape.ShapeResourceWithStreamingResponse(client.shape) class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse( + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse( client.agencies_with_coverage ) - self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse( + self.agency = agency.AsyncAgencyResourceWithStreamingResponse(client.agency) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse( client.vehicles_for_agency ) - self.config = resources.AsyncConfigResourceWithStreamingResponse(client.config) - self.current_time = resources.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = resources.AsyncStopsForLocationResourceWithStreamingResponse( + self.config = config.AsyncConfigResourceWithStreamingResponse(client.config) + self.current_time = current_time.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse( client.stops_for_location ) - self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = resources.AsyncStopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) - self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse( + self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse( + client.stops_for_agency + ) + self.stop = stop.AsyncStopResourceWithStreamingResponse(client.stop) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse( client.stop_ids_for_agency ) - self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) - self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithStreamingResponse( + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse( + client.schedule_for_stop + ) + self.route = route.AsyncRouteResourceWithStreamingResponse(client.route) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse( client.route_ids_for_agency ) - self.routes_for_location = resources.AsyncRoutesForLocationResourceWithStreamingResponse( + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse( client.routes_for_location ) - self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) - self.schedule_for_route = resources.AsyncScheduleForRouteResourceWithStreamingResponse( + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse( + client.routes_for_agency + ) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse( client.schedule_for_route ) - self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse( + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure ) - self.trip = resources.AsyncTripResourceWithStreamingResponse(client.trip) - self.trips_for_location = resources.AsyncTripsForLocationResourceWithStreamingResponse( + self.trip = trip.AsyncTripResourceWithStreamingResponse(client.trip) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse( client.trips_for_location ) - self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) - self.trips_for_route = resources.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop + self.trip_details = trip_details.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse( + client.trip_for_vehicle ) - self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip + self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) + self.report_problem_with_stop = ( + report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse( + client.report_problem_with_stop + ) + ) + self.report_problem_with_trip = ( + report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse( + client.report_problem_with_trip + ) + ) + self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) + self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse( + client.search_for_route ) - self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) - self.block = resources.AsyncBlockResourceWithStreamingResponse(client.block) - self.shape = resources.AsyncShapeResourceWithStreamingResponse(client.shape) + self.block = block.AsyncBlockResourceWithStreamingResponse(client.block) + self.shape = shape.AsyncShapeResourceWithStreamingResponse(client.shape) Client = OnebusawaySDK From 00228d9920530854fd3e7006a7f207ec18a6c279 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Dec 2024 07:09:54 +0000 Subject: [PATCH 148/397] release: 1.4.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c768a6a..6bbc0bb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.5" + ".": "1.4.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bed81b..c7020cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.6 (2024-12-14) + +Full Changelog: [v1.4.5...v1.4.6](https://github.com/OneBusAway/python-sdk/compare/v1.4.5...v1.4.6) + +### Chores + +* **internal:** codegen related update ([#194](https://github.com/OneBusAway/python-sdk/issues/194)) ([7e10c0d](https://github.com/OneBusAway/python-sdk/commit/7e10c0d81a717032bc6f10ff61ea49c6057f5610)) + ## 1.4.5 (2024-12-13) Full Changelog: [v1.4.4...v1.4.5](https://github.com/OneBusAway/python-sdk/compare/v1.4.4...v1.4.5) diff --git a/pyproject.toml b/pyproject.toml index 29723a0..79ca5a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.5" +version = "1.4.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 006d07c..950c434 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.5" # x-release-please-version +__version__ = "1.4.6" # x-release-please-version From dd560420a6b8b4f3acf6a013760492107f9b1a42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:10:07 +0000 Subject: [PATCH 149/397] chore(internal): codegen related update (#197) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 72dd05b..4542b2a 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,16 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. +```py +from onebusaway import OnebusawaySDK + +with OnebusawaySDK() as client: + # make requests here + ... + +# HTTP client is now closed +``` + ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: From cc59821c795b8c71f6c2be41eceb0ab57e37aebb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:10:54 +0000 Subject: [PATCH 150/397] release: 1.4.7 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6bbc0bb..3b10f07 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.6" + ".": "1.4.7" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c7020cb..0ea9121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.7 (2024-12-17) + +Full Changelog: [v1.4.6...v1.4.7](https://github.com/OneBusAway/python-sdk/compare/v1.4.6...v1.4.7) + +### Chores + +* **internal:** codegen related update ([#197](https://github.com/OneBusAway/python-sdk/issues/197)) ([12f69d6](https://github.com/OneBusAway/python-sdk/commit/12f69d6a786450bdb2c8588775ba05709b61de79)) + ## 1.4.6 (2024-12-14) Full Changelog: [v1.4.5...v1.4.6](https://github.com/OneBusAway/python-sdk/compare/v1.4.5...v1.4.6) diff --git a/pyproject.toml b/pyproject.toml index 79ca5a5..b6df811 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.6" +version = "1.4.7" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 950c434..1937112 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.6" # x-release-please-version +__version__ = "1.4.7" # x-release-please-version From 2eca98faaa94d922e0a943dda2d0c58f6b5032b9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:10:54 +0000 Subject: [PATCH 151/397] chore(internal): codegen related update (#198) --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 4542b2a..72dd05b 100644 --- a/README.md +++ b/README.md @@ -290,16 +290,6 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. -```py -from onebusaway import OnebusawaySDK - -with OnebusawaySDK() as client: - # make requests here - ... - -# HTTP client is now closed -``` - ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: From e6b2bca3a93e207e6f2690ac4146fdc79a1f3036 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:11:34 +0000 Subject: [PATCH 152/397] release: 1.4.8 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b10f07..ae48f1a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.7" + ".": "1.4.8" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea9121..c52d0de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.8 (2024-12-17) + +Full Changelog: [v1.4.7...v1.4.8](https://github.com/OneBusAway/python-sdk/compare/v1.4.7...v1.4.8) + +### Chores + +* **internal:** codegen related update ([#198](https://github.com/OneBusAway/python-sdk/issues/198)) ([2210e02](https://github.com/OneBusAway/python-sdk/commit/2210e02b9e700135b282629389534a2ec064ef0d)) + ## 1.4.7 (2024-12-17) Full Changelog: [v1.4.6...v1.4.7](https://github.com/OneBusAway/python-sdk/compare/v1.4.6...v1.4.7) diff --git a/pyproject.toml b/pyproject.toml index b6df811..37c2c42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.7" +version = "1.4.8" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 1937112..57cbee4 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.7" # x-release-please-version +__version__ = "1.4.8" # x-release-please-version From 6cb186400e5e597a37c28038998ab1f49d3e6f6e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:13:41 +0000 Subject: [PATCH 153/397] chore(internal): codegen related update (#201) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 72dd05b..4542b2a 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,16 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. +```py +from onebusaway import OnebusawaySDK + +with OnebusawaySDK() as client: + # make requests here + ... + +# HTTP client is now closed +``` + ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: From 480460693b9fcc415fd7983af8e20be7fc442b86 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 07:14:02 +0000 Subject: [PATCH 154/397] release: 1.4.9 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ae48f1a..19c2487 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.8" + ".": "1.4.9" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c52d0de..c65a4b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.9 (2024-12-17) + +Full Changelog: [v1.4.8...v1.4.9](https://github.com/OneBusAway/python-sdk/compare/v1.4.8...v1.4.9) + +### Chores + +* **internal:** codegen related update ([#201](https://github.com/OneBusAway/python-sdk/issues/201)) ([a8bf61b](https://github.com/OneBusAway/python-sdk/commit/a8bf61bad113e964dd82013827ae3e3968a41527)) + ## 1.4.8 (2024-12-17) Full Changelog: [v1.4.7...v1.4.8](https://github.com/OneBusAway/python-sdk/compare/v1.4.7...v1.4.8) diff --git a/pyproject.toml b/pyproject.toml index 37c2c42..fc9bc18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.8" +version = "1.4.9" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 57cbee4..eb5ea4e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.8" # x-release-please-version +__version__ = "1.4.9" # x-release-please-version From 1e0f427d183174c21fa4bddaec76778af5283c04 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 05:23:54 +0000 Subject: [PATCH 155/397] chore(internal): fix some typos (#205) --- tests/test_client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 9f090e1..0487050 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -345,11 +345,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden", "key": api_key} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1109,11 +1109,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden", "key": api_key}, + params={"foo": "baz", "query_param": "overridden", "key": api_key}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden", "key": api_key} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1601,7 +1601,7 @@ def test_get_platform(self) -> None: import threading from onebusaway._utils import asyncify - from onebusaway._base_client import get_platform + from onebusaway._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)() From d77ed888d77d3a54b1bbd683e57253288881b8dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 05:24:09 +0000 Subject: [PATCH 156/397] release: 1.4.10 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19c2487..8999756 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.9" + ".": "1.4.10" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c65a4b0..6b2dfd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.10 (2024-12-21) + +Full Changelog: [v1.4.9...v1.4.10](https://github.com/OneBusAway/python-sdk/compare/v1.4.9...v1.4.10) + +### Chores + +* **internal:** fix some typos ([#205](https://github.com/OneBusAway/python-sdk/issues/205)) ([c539ec3](https://github.com/OneBusAway/python-sdk/commit/c539ec33bb73497f8f16ec7b5868f761cd0c3cb6)) + ## 1.4.9 (2024-12-17) Full Changelog: [v1.4.8...v1.4.9](https://github.com/OneBusAway/python-sdk/compare/v1.4.8...v1.4.9) diff --git a/pyproject.toml b/pyproject.toml index fc9bc18..d5d8b55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.9" +version = "1.4.10" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index eb5ea4e..c61801a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.9" # x-release-please-version +__version__ = "1.4.10" # x-release-please-version From fd43fabadddae37b5a6c22c754b63a3d05cb9e51 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 06:56:49 +0000 Subject: [PATCH 157/397] chore(internal): codegen related update (#209) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9e6f6ec..443d70c 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Onebusaway SDK + Copyright 2025 Onebusaway SDK Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 22026b40f0d988c342f7bc29f92f9f6f853c27de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 06:57:05 +0000 Subject: [PATCH 158/397] release: 1.4.11 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8999756..c1e6a6d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.10" + ".": "1.4.11" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2dfd0..97be473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.11 (2025-01-02) + +Full Changelog: [v1.4.10...v1.4.11](https://github.com/OneBusAway/python-sdk/compare/v1.4.10...v1.4.11) + +### Chores + +* **internal:** codegen related update ([#209](https://github.com/OneBusAway/python-sdk/issues/209)) ([922f218](https://github.com/OneBusAway/python-sdk/commit/922f218506637cff878bdd44b64a886323371ea2)) + ## 1.4.10 (2024-12-21) Full Changelog: [v1.4.9...v1.4.10](https://github.com/OneBusAway/python-sdk/compare/v1.4.9...v1.4.10) diff --git a/pyproject.toml b/pyproject.toml index d5d8b55..9af765e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.10" +version = "1.4.11" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c61801a..10d9b23 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.10" # x-release-please-version +__version__ = "1.4.11" # x-release-please-version From 298e9bac225678fd485eac368f299d8856d21665 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 07:00:39 +0000 Subject: [PATCH 159/397] chore: add missing isclass check (#212) --- src/onebusaway/_models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 7a547ce..d56ea1d 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -488,7 +488,11 @@ def construct_type(*, value: object, type_: object) -> object: _, items_type = get_args(type_) # Dict[_, items_type] return {key: construct_type(value=item, type_=items_type) for key, item in value.items()} - if not is_literal_type(type_) and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)): + if ( + not is_literal_type(type_) + and inspect.isclass(origin) + and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)) + ): if is_list(value): return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value] From 80a1d9c5ac47b1bdb990bfb20119774e980b1945 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 07:00:59 +0000 Subject: [PATCH 160/397] release: 1.4.12 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c1e6a6d..179f9cd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.11" + ".": "1.4.12" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 97be473..ae9e583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.12 (2025-01-07) + +Full Changelog: [v1.4.11...v1.4.12](https://github.com/OneBusAway/python-sdk/compare/v1.4.11...v1.4.12) + +### Chores + +* add missing isclass check ([#212](https://github.com/OneBusAway/python-sdk/issues/212)) ([989d621](https://github.com/OneBusAway/python-sdk/commit/989d6218de97f5515ec741b5cc424cb8d7901362)) + ## 1.4.11 (2025-01-02) Full Changelog: [v1.4.10...v1.4.11](https://github.com/OneBusAway/python-sdk/compare/v1.4.10...v1.4.11) diff --git a/pyproject.toml b/pyproject.toml index 9af765e..490b6eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.11" +version = "1.4.12" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 10d9b23..a6eb1bb 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.11" # x-release-please-version +__version__ = "1.4.12" # x-release-please-version From ad003b828ffa42ddb8bf1d7c394b86bf4a09bf7d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 06:54:57 +0000 Subject: [PATCH 161/397] chore(internal): codegen related update (#215) --- pyproject.toml | 2 +- requirements-dev.lock | 5 ++--- requirements.lock | 3 +-- src/onebusaway/_base_client.py | 6 ++++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 490b6eb..1877731 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0" + "nest_asyncio==1.6.0", ] [tool.rye.scripts] diff --git a/requirements-dev.lock b/requirements-dev.lock index c27541f..6c36e0f 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -36,7 +36,7 @@ h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx -httpx==0.25.2 +httpx==0.28.1 # via onebusaway # via respx idna==3.4 @@ -77,7 +77,7 @@ python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 # via dirty-equals -respx==0.20.2 +respx==0.22.0 rich==13.7.1 ruff==0.6.9 setuptools==68.2.2 @@ -86,7 +86,6 @@ six==1.16.0 # via python-dateutil sniffio==1.3.0 # via anyio - # via httpx # via onebusaway time-machine==2.9.0 tomli==2.0.2 diff --git a/requirements.lock b/requirements.lock index 74aed81..cf5c8e0 100644 --- a/requirements.lock +++ b/requirements.lock @@ -26,7 +26,7 @@ h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx -httpx==0.25.2 +httpx==0.28.1 # via onebusaway idna==3.4 # via anyio @@ -37,7 +37,6 @@ pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio - # via httpx # via onebusaway typing-extensions==4.12.2 # via anyio diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 3eb1d07..ab71ec6 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -767,6 +767,9 @@ def __init__(self, **kwargs: Any) -> None: class SyncHttpxClientWrapper(DefaultHttpxClient): def __del__(self) -> None: + if self.is_closed: + return + try: self.close() except Exception: @@ -1334,6 +1337,9 @@ def __init__(self, **kwargs: Any) -> None: class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): def __del__(self) -> None: + if self.is_closed: + return + try: # TODO(someday): support non asyncio runtimes here asyncio.get_running_loop().create_task(self.aclose()) From f0894b59d35cb1cea6933be2fa7505900abb6192 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 06:55:17 +0000 Subject: [PATCH 162/397] release: 1.4.13 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 179f9cd..ed012d5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.12" + ".": "1.4.13" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ae9e583..33a67ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.13 (2025-01-08) + +Full Changelog: [v1.4.12...v1.4.13](https://github.com/OneBusAway/python-sdk/compare/v1.4.12...v1.4.13) + +### Chores + +* **internal:** codegen related update ([#215](https://github.com/OneBusAway/python-sdk/issues/215)) ([f3ecad9](https://github.com/OneBusAway/python-sdk/commit/f3ecad9cbd05c928200b9ee53c2a3a0615f99822)) + ## 1.4.12 (2025-01-07) Full Changelog: [v1.4.11...v1.4.12](https://github.com/OneBusAway/python-sdk/compare/v1.4.11...v1.4.12) diff --git a/pyproject.toml b/pyproject.toml index 1877731..959fea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.12" +version = "1.4.13" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index a6eb1bb..39b4d71 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.12" # x-release-please-version +__version__ = "1.4.13" # x-release-please-version From 345f5184cfac33fa7736b48df16695a714300055 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 06:57:56 +0000 Subject: [PATCH 163/397] docs: fix typos (#218) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4542b2a..cc75b02 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ except onebusaway.APIStatusError as e: print(e.response) ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | @@ -232,8 +232,7 @@ If you need to access undocumented endpoints, params, or response properties, th #### Undocumented endpoints To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other -http verbs. Options on the client will be respected (such as retries) will be respected when making this -request. +http verbs. Options on the client will be respected (such as retries) when making this request. ```py import httpx From 9b96a123d4f4af0738af44978587660224d134fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 06:58:18 +0000 Subject: [PATCH 164/397] release: 1.4.14 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ed012d5..63a9115 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.13" + ".": "1.4.14" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 33a67ad..daf367e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.14 (2025-01-09) + +Full Changelog: [v1.4.13...v1.4.14](https://github.com/OneBusAway/python-sdk/compare/v1.4.13...v1.4.14) + +### Documentation + +* fix typos ([#218](https://github.com/OneBusAway/python-sdk/issues/218)) ([b66f7dd](https://github.com/OneBusAway/python-sdk/commit/b66f7dd5482920dfb986bd3e6c09c62b3fdfafb3)) + ## 1.4.13 (2025-01-08) Full Changelog: [v1.4.12...v1.4.13](https://github.com/OneBusAway/python-sdk/compare/v1.4.12...v1.4.13) diff --git a/pyproject.toml b/pyproject.toml index 959fea9..f76ad13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.13" +version = "1.4.14" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 39b4d71..4ae7151 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.13" # x-release-please-version +__version__ = "1.4.14" # x-release-please-version From 89e9bb71065d0272c79ca7fd34c734a5cf2f3d46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 06:59:12 +0000 Subject: [PATCH 165/397] chore(internal): codegen related update (#220) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc75b02..1e31e79 100644 --- a/README.md +++ b/README.md @@ -304,7 +304,7 @@ with OnebusawaySDK() as client: This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: 1. Changes that only affect static types, without breaking runtime behavior. -2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ 3. Changes that we do not expect to impact the vast majority of users in practice. We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. From 77588da34baaf4f76af78ee062d0a99030be977a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 06:59:31 +0000 Subject: [PATCH 166/397] release: 1.4.15 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 63a9115..36867f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.14" + ".": "1.4.15" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index daf367e..4ad73ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.15 (2025-01-09) + +Full Changelog: [v1.4.14...v1.4.15](https://github.com/OneBusAway/python-sdk/compare/v1.4.14...v1.4.15) + +### Chores + +* **internal:** codegen related update ([#220](https://github.com/OneBusAway/python-sdk/issues/220)) ([d78e83a](https://github.com/OneBusAway/python-sdk/commit/d78e83aea265d25d3a37e2fc0c1ec3aa8ea3c9f5)) + ## 1.4.14 (2025-01-09) Full Changelog: [v1.4.13...v1.4.14](https://github.com/OneBusAway/python-sdk/compare/v1.4.13...v1.4.14) diff --git a/pyproject.toml b/pyproject.toml index f76ad13..ace5a3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.14" +version = "1.4.15" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4ae7151..cdc9f97 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.14" # x-release-please-version +__version__ = "1.4.15" # x-release-please-version From a902d10197a7671e9a5afcdad347095704945ef9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 07:01:24 +0000 Subject: [PATCH 167/397] fix: correctly handle deserialising `cls` fields (#223) --- src/onebusaway/_models.py | 8 ++++---- tests/test_models.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index d56ea1d..9a918aa 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -179,14 +179,14 @@ def __str__(self) -> str: @classmethod @override def construct( # pyright: ignore[reportIncompatibleMethodOverride] - cls: Type[ModelT], + __cls: Type[ModelT], _fields_set: set[str] | None = None, **values: object, ) -> ModelT: - m = cls.__new__(cls) + m = __cls.__new__(__cls) fields_values: dict[str, object] = {} - config = get_model_config(cls) + config = get_model_config(__cls) populate_by_name = ( config.allow_population_by_field_name if isinstance(config, _ConfigProtocol) @@ -196,7 +196,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if _fields_set is None: _fields_set = set() - model_fields = get_model_fields(cls) + model_fields = get_model_fields(__cls) for name, field in model_fields.items(): key = field.alias if key is None or (key not in values and populate_by_name): diff --git a/tests/test_models.py b/tests/test_models.py index 8a7807e..95fa41d 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -844,3 +844,13 @@ class Model(BaseModel): assert m.alias == "foo" assert isinstance(m.union, str) assert m.union == "bar" + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_field_named_cls() -> None: + class Model(BaseModel): + cls: str + + m = construct_type(value={"cls": "foo"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.cls, str) From f8b971d373d385d99cc8d30d0c92ac81eecef330 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 07:01:44 +0000 Subject: [PATCH 168/397] release: 1.4.16 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 36867f9..1054662 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.15" + ".": "1.4.16" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ad73ef..2a24f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.16 (2025-01-10) + +Full Changelog: [v1.4.15...v1.4.16](https://github.com/OneBusAway/python-sdk/compare/v1.4.15...v1.4.16) + +### Bug Fixes + +* correctly handle deserialising `cls` fields ([#223](https://github.com/OneBusAway/python-sdk/issues/223)) ([33d5ab7](https://github.com/OneBusAway/python-sdk/commit/33d5ab7fc1366619e6db0a2ab30390ee3249bf52)) + ## 1.4.15 (2025-01-09) Full Changelog: [v1.4.14...v1.4.15](https://github.com/OneBusAway/python-sdk/compare/v1.4.14...v1.4.15) diff --git a/pyproject.toml b/pyproject.toml index ace5a3d..c994aa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.15" +version = "1.4.16" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index cdc9f97..89bc4ad 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.15" # x-release-please-version +__version__ = "1.4.16" # x-release-please-version From 3b27f4f6c38466d069c4c7e0ca4705275214189a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 06:55:53 +0000 Subject: [PATCH 169/397] chore(internal): codegen related update (#226) --- mypy.ini | 2 +- requirements-dev.lock | 4 ++-- src/onebusaway/_response.py | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mypy.ini b/mypy.ini index 4db4836..97658a5 100644 --- a/mypy.ini +++ b/mypy.ini @@ -41,7 +41,7 @@ cache_fine_grained = True # ``` # Changing this codegen to make mypy happy would increase complexity # and would not be worth it. -disable_error_code = func-returns-value +disable_error_code = func-returns-value,overload-cannot-match # https://github.com/python/mypy/issues/12162 [mypy.overrides] diff --git a/requirements-dev.lock b/requirements-dev.lock index 6c36e0f..146d5d8 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -49,7 +49,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.13.0 +mypy==1.14.1 mypy-extensions==1.0.0 # via mypy nest-asyncio==1.6.0 @@ -69,7 +69,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.390 +pyright==1.1.392.post0 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 3cc5c5b..4aa5900 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -210,7 +210,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError( "Pydantic models must subclass our base model type, e.g. `from onebusaway import BaseModel`" ) From cda62eb9e9c535a087a51f4c20be48f1e51040b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 06:56:13 +0000 Subject: [PATCH 170/397] release: 1.4.17 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1054662..644b63e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.16" + ".": "1.4.17" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a24f78..19953ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.17 (2025-01-17) + +Full Changelog: [v1.4.16...v1.4.17](https://github.com/OneBusAway/python-sdk/compare/v1.4.16...v1.4.17) + +### Chores + +* **internal:** codegen related update ([#226](https://github.com/OneBusAway/python-sdk/issues/226)) ([69f99d3](https://github.com/OneBusAway/python-sdk/commit/69f99d32d95b5256685d68874c73b2647cc8e900)) + ## 1.4.16 (2025-01-10) Full Changelog: [v1.4.15...v1.4.16](https://github.com/OneBusAway/python-sdk/compare/v1.4.15...v1.4.16) diff --git a/pyproject.toml b/pyproject.toml index c994aa1..07e4d89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.16" +version = "1.4.17" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 89bc4ad..b9440b3 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.16" # x-release-please-version +__version__ = "1.4.17" # x-release-please-version From f33ce686c1cd144971d23dac5a9b35fcdaccaf5e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:09:49 +0000 Subject: [PATCH 171/397] docs(raw responses): fix duplicate `the` (#229) --- src/onebusaway/resources/agencies_with_coverage.py | 4 ++-- src/onebusaway/resources/agency.py | 4 ++-- src/onebusaway/resources/arrival_and_departure.py | 4 ++-- src/onebusaway/resources/block.py | 4 ++-- src/onebusaway/resources/config.py | 4 ++-- src/onebusaway/resources/current_time.py | 4 ++-- src/onebusaway/resources/report_problem_with_stop.py | 4 ++-- src/onebusaway/resources/report_problem_with_trip.py | 4 ++-- src/onebusaway/resources/route.py | 4 ++-- src/onebusaway/resources/route_ids_for_agency.py | 4 ++-- src/onebusaway/resources/routes_for_agency.py | 4 ++-- src/onebusaway/resources/routes_for_location.py | 4 ++-- src/onebusaway/resources/schedule_for_route.py | 4 ++-- src/onebusaway/resources/schedule_for_stop.py | 4 ++-- src/onebusaway/resources/search_for_route.py | 4 ++-- src/onebusaway/resources/search_for_stop.py | 4 ++-- src/onebusaway/resources/shape.py | 4 ++-- src/onebusaway/resources/stop.py | 4 ++-- src/onebusaway/resources/stop_ids_for_agency.py | 4 ++-- src/onebusaway/resources/stops_for_agency.py | 4 ++-- src/onebusaway/resources/stops_for_location.py | 4 ++-- src/onebusaway/resources/stops_for_route.py | 4 ++-- src/onebusaway/resources/trip.py | 4 ++-- src/onebusaway/resources/trip_details.py | 4 ++-- src/onebusaway/resources/trip_for_vehicle.py | 4 ++-- src/onebusaway/resources/trips_for_location.py | 4 ++-- src/onebusaway/resources/trips_for_route.py | 4 ++-- src/onebusaway/resources/vehicles_for_agency.py | 4 ++-- 28 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index 3e4cdb3..f543a88 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -23,7 +23,7 @@ class AgenciesWithCoverageResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -66,7 +66,7 @@ class AsyncAgenciesWithCoverageResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 955614b..9141792 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -23,7 +23,7 @@ class AgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 20437d5..8323a51 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -32,7 +32,7 @@ class ArrivalAndDepartureResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ArrivalAndDepartureResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -157,7 +157,7 @@ class AsyncArrivalAndDepartureResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncArrivalAndDepartureResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index 8e0f23f..cbee583 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -23,7 +23,7 @@ class BlockResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BlockResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncBlockResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 56b30af..4b3de23 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -23,7 +23,7 @@ class ConfigResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -63,7 +63,7 @@ class AsyncConfigResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 1923f27..1dcc9a8 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -23,7 +23,7 @@ class CurrentTimeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CurrentTimeResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -63,7 +63,7 @@ class AsyncCurrentTimeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCurrentTimeResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index b10f43f..d1614f6 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -30,7 +30,7 @@ class ReportProblemWithStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ class AsyncReportProblemWithStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index 140dab7..d0f9733 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -30,7 +30,7 @@ class ReportProblemWithTripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -140,7 +140,7 @@ class AsyncReportProblemWithTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 110f91b..62ae14a 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -23,7 +23,7 @@ class RouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index 69c45d9..e5ddfa3 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -23,7 +23,7 @@ class RouteIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncRouteIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index cc20b2d..ff7a8cd 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -23,7 +23,7 @@ class RoutesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncRoutesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index 4eab85b..d315909 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -28,7 +28,7 @@ class RoutesForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -99,7 +99,7 @@ class AsyncRoutesForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index c7c2346..3d5509d 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -31,7 +31,7 @@ class ScheduleForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -95,7 +95,7 @@ class AsyncScheduleForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index fccd5d5..78b4d36 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -31,7 +31,7 @@ class ScheduleForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -93,7 +93,7 @@ class AsyncScheduleForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index 5d21094..fe1d9a2 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -28,7 +28,7 @@ class SearchForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -95,7 +95,7 @@ class AsyncSearchForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 78cf27b..8efb8ad 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -28,7 +28,7 @@ class SearchForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -95,7 +95,7 @@ class AsyncSearchForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index c1bb6f7..0b4c291 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -23,7 +23,7 @@ class ShapeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ShapeResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncShapeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 2fec702..502f8ce 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -23,7 +23,7 @@ class StopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index e1146b1..3850d16 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -23,7 +23,7 @@ class StopIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncStopIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 0aa3acc..834ab5c 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -23,7 +23,7 @@ class StopsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncStopsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index a4fa7c8..80322e3 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -28,7 +28,7 @@ class StopsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -107,7 +107,7 @@ class AsyncStopsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 3d1b92a..36f7514 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -28,7 +28,7 @@ class StopsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -98,7 +98,7 @@ class AsyncStopsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index 2484425..9b7e137 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -23,7 +23,7 @@ class TripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -77,7 +77,7 @@ class AsyncTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index a75d05a..71092c9 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -28,7 +28,7 @@ class TripDetailsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripDetailsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ class AsyncTripDetailsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index fdd77a2..4417b48 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -28,7 +28,7 @@ class TripForVehicleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -109,7 +109,7 @@ class AsyncTripForVehicleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 2b8369c..84958f9 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -28,7 +28,7 @@ class TripsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -117,7 +117,7 @@ class AsyncTripsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index 2f715ba..a5ca21d 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -28,7 +28,7 @@ class TripsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -103,7 +103,7 @@ class AsyncTripsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index b423def..3f8697d 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -28,7 +28,7 @@ class VehiclesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers @@ -89,7 +89,7 @@ class AsyncVehiclesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers From 699caddf48134cfd39a16e75b644b3fa55316156 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:10:09 +0000 Subject: [PATCH 172/397] release: 1.4.18 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 644b63e..d11b8b2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.17" + ".": "1.4.18" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 19953ba..0b21256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.18 (2025-01-21) + +Full Changelog: [v1.4.17...v1.4.18](https://github.com/OneBusAway/python-sdk/compare/v1.4.17...v1.4.18) + +### Documentation + +* **raw responses:** fix duplicate `the` ([#229](https://github.com/OneBusAway/python-sdk/issues/229)) ([3eb85fa](https://github.com/OneBusAway/python-sdk/commit/3eb85fa39efc772ba9175c5a281e19c2e22b62d4)) + ## 1.4.17 (2025-01-17) Full Changelog: [v1.4.16...v1.4.17](https://github.com/OneBusAway/python-sdk/compare/v1.4.16...v1.4.17) diff --git a/pyproject.toml b/pyproject.toml index 07e4d89..2f91870 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.17" +version = "1.4.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index b9440b3..6a712a7 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.17" # x-release-please-version +__version__ = "1.4.18" # x-release-please-version From ff31e828faa9cf3e762c78a98d87001b92cd3220 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 06:54:23 +0000 Subject: [PATCH 173/397] chore(internal): codegen related update (#233) --- pyproject.toml | 1 + tests/test_client.py | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2f91870..bae654d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,6 +129,7 @@ testpaths = ["tests"] addopts = "--tb=short" xfail_strict = true asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] diff --git a/tests/test_client.py b/tests/test_client.py index 0487050..3784b51 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,6 +6,7 @@ import os import sys import json +import time import asyncio import inspect import subprocess @@ -1616,10 +1617,20 @@ async def test_main() -> None: [sys.executable, "-c", test_code], text=True, ) as process: - try: - process.wait(2) - if process.returncode: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - except subprocess.TimeoutExpired as e: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") from e + timeout = 10 # seconds + + start_time = time.monotonic() + while True: + return_code = process.poll() + if return_code is not None: + if return_code != 0: + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + + # success + break + + if time.monotonic() - start_time > timeout: + process.kill() + raise AssertionError("calling get_platform using asyncify resulted in a hung process") + + time.sleep(0.1) From be07d64dcc5cd8f6d350048b5d4fb87cbddcba74 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 06:54:42 +0000 Subject: [PATCH 174/397] release: 1.4.19 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d11b8b2..909ceaa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.18" + ".": "1.4.19" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b21256..885a089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.19 (2025-01-22) + +Full Changelog: [v1.4.18...v1.4.19](https://github.com/OneBusAway/python-sdk/compare/v1.4.18...v1.4.19) + +### Chores + +* **internal:** codegen related update ([#233](https://github.com/OneBusAway/python-sdk/issues/233)) ([2ee9813](https://github.com/OneBusAway/python-sdk/commit/2ee9813f5d3b4a4f3036f2cce685f1e2c4adaa71)) + ## 1.4.18 (2025-01-21) Full Changelog: [v1.4.17...v1.4.18](https://github.com/OneBusAway/python-sdk/compare/v1.4.17...v1.4.18) diff --git a/pyproject.toml b/pyproject.toml index bae654d..34af6f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.18" +version = "1.4.19" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6a712a7..c88a352 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.18" # x-release-please-version +__version__ = "1.4.19" # x-release-please-version From 9610505a0a1144355a4a0af5d8746ba78c329819 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 04:52:21 +0000 Subject: [PATCH 175/397] chore(internal): codegen related update (#236) --- src/onebusaway/_response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 4aa5900..16b6f2b 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to and is_annotated_type(cast_to): cast_to = extract_type_arg(cast_to, 0) + origin = get_origin(cast_to) or cast_to + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") From f98bc3b1f6fe46f79ba4b3d662f5976c092e3372 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 04:52:40 +0000 Subject: [PATCH 176/397] release: 1.4.20 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 909ceaa..0d92d1d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.19" + ".": "1.4.20" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 885a089..85548a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.20 (2025-01-23) + +Full Changelog: [v1.4.19...v1.4.20](https://github.com/OneBusAway/python-sdk/compare/v1.4.19...v1.4.20) + +### Chores + +* **internal:** codegen related update ([#236](https://github.com/OneBusAway/python-sdk/issues/236)) ([efffa87](https://github.com/OneBusAway/python-sdk/commit/efffa87da71fe633d206c9816f6ee79ecd564276)) + ## 1.4.19 (2025-01-22) Full Changelog: [v1.4.18...v1.4.19](https://github.com/OneBusAway/python-sdk/compare/v1.4.18...v1.4.19) diff --git a/pyproject.toml b/pyproject.toml index 34af6f2..3b16097 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.19" +version = "1.4.20" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c88a352..205dbb3 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.19" # x-release-please-version +__version__ = "1.4.20" # x-release-please-version From 52f620624ef0bd22e7a7451e58e32194f84d7087 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 05:13:56 +0000 Subject: [PATCH 177/397] chore(internal): minor formatting changes (#239) --- .github/workflows/ci.yml | 3 +-- scripts/bootstrap | 2 +- scripts/lint | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4029396..c8a8a4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -30,6 +29,7 @@ jobs: - name: Run lints run: ./scripts/lint + test: name: test runs-on: ubuntu-latest @@ -50,4 +50,3 @@ jobs: - name: Run tests run: ./scripts/test - diff --git a/scripts/bootstrap b/scripts/bootstrap index 8c5c60e..e84fe62 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle diff --git a/scripts/lint b/scripts/lint index 4656dbb..67032eb 100755 --- a/scripts/lint +++ b/scripts/lint @@ -9,4 +9,3 @@ rye run lint echo "==> Making sure it imports" rye run python -c 'import onebusaway' - From ff8a94970700c53e535f17a80ace6a05a1c9c9c5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 05:14:15 +0000 Subject: [PATCH 178/397] release: 1.4.21 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0d92d1d..dbd98db 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.20" + ".": "1.4.21" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 85548a3..cdcb50a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.21 (2025-01-24) + +Full Changelog: [v1.4.20...v1.4.21](https://github.com/OneBusAway/python-sdk/compare/v1.4.20...v1.4.21) + +### Chores + +* **internal:** minor formatting changes ([#239](https://github.com/OneBusAway/python-sdk/issues/239)) ([c4753be](https://github.com/OneBusAway/python-sdk/commit/c4753be98ddcd9ef1821bf155715366a13de4542)) + ## 1.4.20 (2025-01-23) Full Changelog: [v1.4.19...v1.4.20](https://github.com/OneBusAway/python-sdk/compare/v1.4.19...v1.4.20) diff --git a/pyproject.toml b/pyproject.toml index 3b16097..fc67d3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.20" +version = "1.4.21" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 205dbb3..8dd02da 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.20" # x-release-please-version +__version__ = "1.4.21" # x-release-please-version From 1cde701b167334706c3a966b4bcdb2796ce9679d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:20:02 +0000 Subject: [PATCH 179/397] chore(internal): change default timeout to an int (#242) --- src/onebusaway/_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py index a2ac3b6..6ddf2c7 100644 --- a/src/onebusaway/_constants.py +++ b/src/onebusaway/_constants.py @@ -6,7 +6,7 @@ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" # default timeout is 1 minute -DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0) +DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) DEFAULT_MAX_RETRIES = 2 DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) From f3eb38f7db815234caf911d02e7f2300cb85c9f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:20:29 +0000 Subject: [PATCH 180/397] release: 1.4.22 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dbd98db..86865ea 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.21" + ".": "1.4.22" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcb50a..e37252b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.22 (2025-02-04) + +Full Changelog: [v1.4.21...v1.4.22](https://github.com/OneBusAway/python-sdk/compare/v1.4.21...v1.4.22) + +### Chores + +* **internal:** change default timeout to an int ([#242](https://github.com/OneBusAway/python-sdk/issues/242)) ([7a6abd4](https://github.com/OneBusAway/python-sdk/commit/7a6abd4930719c6451e3701f745f028999bf00b0)) + ## 1.4.21 (2025-01-24) Full Changelog: [v1.4.20...v1.4.21](https://github.com/OneBusAway/python-sdk/compare/v1.4.20...v1.4.21) diff --git a/pyproject.toml b/pyproject.toml index fc67d3e..854618d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.21" +version = "1.4.22" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8dd02da..faa9e7a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.21" # x-release-please-version +__version__ = "1.4.22" # x-release-please-version From 0065927d77dc21cb2fe0c996219dff27cff08601 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:22:19 +0000 Subject: [PATCH 181/397] chore(internal): bummp ruff dependency (#245) --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- scripts/utils/ruffen-docs.py | 4 ++-- src/onebusaway/_models.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 854618d..62b02de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,7 +177,7 @@ select = [ "T201", "T203", # misuse of typing.TYPE_CHECKING - "TCH004", + "TC004", # import rules "TID251", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index 146d5d8..e00b078 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -79,7 +79,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.22.0 rich==13.7.1 -ruff==0.6.9 +ruff==0.9.4 setuptools==68.2.2 # via nodeenv six==1.16.0 diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py index 37b3d94..0cf2bd2 100644 --- a/scripts/utils/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 9a918aa..12c34b7 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -172,7 +172,7 @@ def to_json( @override def __str__(self) -> str: # mypy complains about an invalid self arg - return f'{self.__repr_name__()}({self.__repr_str__(", ")})' # type: ignore[misc] + return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc] # Override the 'construct' method in a way that supports recursive parsing without validation. # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. From 924847c5d01d1bf107157a944995a359886c8b10 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 03:22:37 +0000 Subject: [PATCH 182/397] release: 1.4.23 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 86865ea..121014d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.22" + ".": "1.4.23" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e37252b..395780d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.4.23 (2025-02-04) + +Full Changelog: [v1.4.22...v1.4.23](https://github.com/OneBusAway/python-sdk/compare/v1.4.22...v1.4.23) + +### Chores + +* **internal:** bummp ruff dependency ([#245](https://github.com/OneBusAway/python-sdk/issues/245)) ([b8d6007](https://github.com/OneBusAway/python-sdk/commit/b8d6007b83f20484c4172901a262414247712972)) + ## 1.4.22 (2025-02-04) Full Changelog: [v1.4.21...v1.4.22](https://github.com/OneBusAway/python-sdk/compare/v1.4.21...v1.4.22) diff --git a/pyproject.toml b/pyproject.toml index 62b02de..4f23b96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.22" +version = "1.4.23" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index faa9e7a..7ef0e3c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.22" # x-release-please-version +__version__ = "1.4.23" # x-release-please-version From adad1dafe5d857cba809d6e70fdb8a1c3dedefe7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 03:42:52 +0000 Subject: [PATCH 183/397] feat(client): send `X-Stainless-Read-Timeout` header (#248) --- src/onebusaway/_base_client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index ab71ec6..5d6342c 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -418,10 +418,17 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key or self._idempotency_key() - # Don't set the retry count header if it was already set or removed by the caller. We check + # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. - if "x-stainless-retry-count" not in (header.lower() for header in custom_headers): + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) return headers From eb97f7eb30e3e56e17bfd098284a379f84119b6d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 03:43:10 +0000 Subject: [PATCH 184/397] release: 1.5.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 121014d..fbd9082 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.23" + ".": "1.5.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 395780d..6e820ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.5.0 (2025-02-06) + +Full Changelog: [v1.4.23...v1.5.0](https://github.com/OneBusAway/python-sdk/compare/v1.4.23...v1.5.0) + +### Features + +* **client:** send `X-Stainless-Read-Timeout` header ([#248](https://github.com/OneBusAway/python-sdk/issues/248)) ([2bdb366](https://github.com/OneBusAway/python-sdk/commit/2bdb366dbde6c2c9ad5e5cd89cf07b24410ca472)) + ## 1.4.23 (2025-02-04) Full Changelog: [v1.4.22...v1.4.23](https://github.com/OneBusAway/python-sdk/compare/v1.4.22...v1.4.23) diff --git a/pyproject.toml b/pyproject.toml index 4f23b96..880892d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.23" +version = "1.5.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 7ef0e3c..f0d7514 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.4.23" # x-release-please-version +__version__ = "1.5.0" # x-release-please-version From 1f16f7e76f17f4e98c8adb2536199468bfe97428 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 03:28:49 +0000 Subject: [PATCH 185/397] chore(internal): fix type traversing dictionary params (#251) --- src/onebusaway/_utils/_transform.py | 12 +++++++++++- tests/test_transform.py | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index a6b62ca..18afd9d 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -25,7 +25,7 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import model_dump, is_typeddict +from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -164,9 +164,14 @@ def _transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return _transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) @@ -307,9 +312,14 @@ async def _async_transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return await _async_transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) diff --git a/tests/test_transform.py b/tests/test_transform.py index 1ace66d..352d7ae 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -2,7 +2,7 @@ import io import pathlib -from typing import Any, List, Union, TypeVar, Iterable, Optional, cast +from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict @@ -388,6 +388,15 @@ def my_iter() -> Iterable[Baz8]: } +@parametrize +@pytest.mark.asyncio +async def test_dictionary_items(use_async: bool) -> None: + class DictItems(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + + class TypedDictIterableUnionStr(TypedDict): foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")] From b023224ead264aafdd6b1270a094ce44595e1c02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 03:29:08 +0000 Subject: [PATCH 186/397] release: 1.5.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fbd9082..4a2f7e6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.0" + ".": "1.5.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e820ce..0e56e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.5.1 (2025-02-07) + +Full Changelog: [v1.5.0...v1.5.1](https://github.com/OneBusAway/python-sdk/compare/v1.5.0...v1.5.1) + +### Chores + +* **internal:** fix type traversing dictionary params ([#251](https://github.com/OneBusAway/python-sdk/issues/251)) ([6dc1d57](https://github.com/OneBusAway/python-sdk/commit/6dc1d570d4fa8f1391755af3431ae2cdda088d9e)) + ## 1.5.0 (2025-02-06) Full Changelog: [v1.4.23...v1.5.0](https://github.com/OneBusAway/python-sdk/compare/v1.4.23...v1.5.0) diff --git a/pyproject.toml b/pyproject.toml index 880892d..8ed41fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.5.0" +version = "1.5.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f0d7514..1b8a904 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.5.0" # x-release-please-version +__version__ = "1.5.1" # x-release-please-version From b3a9fd524cb4aac73eb39b3a7096e58e6d639b42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 03:32:22 +0000 Subject: [PATCH 187/397] chore(internal): minor type handling changes (#254) --- src/onebusaway/_models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 12c34b7..c4401ff 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object: If the given value does not match the expected type then it is returned as-is. """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + # we allow `object` as the input type because otherwise, passing things like # `Literal['value']` will be reported as a type error by type checkers type_ = cast("type[object]", type_) if is_type_alias_type(type_): + original_type = type_ # type: ignore[unreachable] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` @@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object: if is_union(origin): try: - return validate_type(type_=cast("type[object]", type_), value=value) + return validate_type(type_=cast("type[object]", original_type or type_), value=value) except Exception: pass From 2a5068e98d2f2cb7bd3b6c0aed9a407757c9c07d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 03:32:45 +0000 Subject: [PATCH 188/397] release: 1.5.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4a2f7e6..4130df0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.1" + ".": "1.5.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e56e2f..14a057b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.5.2 (2025-02-07) + +Full Changelog: [v1.5.1...v1.5.2](https://github.com/OneBusAway/python-sdk/compare/v1.5.1...v1.5.2) + +### Chores + +* **internal:** minor type handling changes ([#254](https://github.com/OneBusAway/python-sdk/issues/254)) ([401146a](https://github.com/OneBusAway/python-sdk/commit/401146a94806dba8c0aa14252aadd09089c590b9)) + ## 1.5.1 (2025-02-07) Full Changelog: [v1.5.0...v1.5.1](https://github.com/OneBusAway/python-sdk/compare/v1.5.0...v1.5.1) diff --git a/pyproject.toml b/pyproject.toml index 8ed41fc..b5eef14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.5.1" +version = "1.5.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 1b8a904..598fdd1 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.5.1" # x-release-please-version +__version__ = "1.5.2" # x-release-please-version From 38c9be3bfd33e80effdfb84694081d3c533bc9d2 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Sat, 8 Feb 2025 23:52:31 +0200 Subject: [PATCH 189/397] fix(tests): use urllib.parse.quote_plus for API key encoding in expected URLs --- tests/test_client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 3784b51..4b74438 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -34,6 +34,7 @@ ) from .utils import update_env +import urllib.parse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -573,7 +574,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - expected_url = f"http://localhost:5000/custom/path/foo?key={client.api_key}" + expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url @pytest.mark.parametrize( @@ -599,7 +600,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - expected_url = f"http://localhost:5000/custom/path/foo?key={client.api_key}" + expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url @pytest.mark.parametrize( @@ -625,7 +626,7 @@ def test_absolute_request_url(self, client: OnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - expected_url = f"https://myapi.com/foo?key={client.api_key}" + expected_url = f"https://myapi.com/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url def test_copied_client_does_not_close_http(self) -> None: @@ -1336,7 +1337,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - excepted_url = f"http://localhost:5000/custom/path/foo?key={client.api_key}" + excepted_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == excepted_url @pytest.mark.parametrize( @@ -1363,7 +1364,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ), ) - expected_url = f"http://localhost:5000/custom/path/foo?key={client.api_key}" + expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url @pytest.mark.parametrize( @@ -1389,7 +1390,7 @@ def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - expected_url = f"https://myapi.com/foo?key={client.api_key}" + expected_url = f"https://myapi.com/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url async def test_copied_client_does_not_close_http(self) -> None: From 4d3e5d24936bcdce680605eb88b279c54449b835 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2025 21:52:53 +0000 Subject: [PATCH 190/397] release: 1.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4130df0..7deae33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.2" + ".": "1.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a057b..cfc67d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.6.0 (2025-02-08) + +Full Changelog: [v1.5.2...v1.6.0](https://github.com/OneBusAway/python-sdk/compare/v1.5.2...v1.6.0) + +### Features + +* fix(tests): use urllib.parse.quote_plus for API key encoding in expected URLs ([41dfd84](https://github.com/OneBusAway/python-sdk/commit/41dfd84d5c705825fa4b0dea4d52b964b08921d0)) + ## 1.5.2 (2025-02-07) Full Changelog: [v1.5.1...v1.5.2](https://github.com/OneBusAway/python-sdk/compare/v1.5.1...v1.5.2) diff --git a/pyproject.toml b/pyproject.toml index b5eef14..b6726fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.5.2" +version = "1.6.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 598fdd1..2e9cdc6 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.5.2" # x-release-please-version +__version__ = "1.6.0" # x-release-please-version From fe1e84bc7bfdfe5fa272fb7412d61d6e976b0877 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Sat, 8 Feb 2025 23:54:42 +0200 Subject: [PATCH 191/397] chore(tests): formatting --- tests/test_client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 4b74438..7b650cc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -11,6 +11,7 @@ import inspect import subprocess import tracemalloc +import urllib.parse from typing import Any, Union, cast from textwrap import dedent from unittest import mock @@ -34,7 +35,6 @@ ) from .utils import update_env -import urllib.parse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -992,7 +992,6 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic frame.filename.endswith(fragment) for fragment in [ # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - # removing the decorator fixes the leak for reasons we don't understand. "onebusaway/_legacy_response.py", "onebusaway/_response.py", From be1fdd99722397145152de5663ea4596062279ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2025 21:55:00 +0000 Subject: [PATCH 192/397] release: 1.7.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7deae33..cce9d1c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.6.0" + ".": "1.7.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cfc67d0..2a7d4e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.7.0 (2025-02-08) + +Full Changelog: [v1.6.0...v1.7.0](https://github.com/OneBusAway/python-sdk/compare/v1.6.0...v1.7.0) + +### Features + +* chore(tests): formatting ([dbb3cd7](https://github.com/OneBusAway/python-sdk/commit/dbb3cd78e5059a2e34efe2b323376abe7e544ac9)) + ## 1.6.0 (2025-02-08) Full Changelog: [v1.5.2...v1.6.0](https://github.com/OneBusAway/python-sdk/compare/v1.5.2...v1.6.0) diff --git a/pyproject.toml b/pyproject.toml index b6726fe..5197443 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.6.0" +version = "1.7.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 2e9cdc6..655905f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.6.0" # x-release-please-version +__version__ = "1.7.0" # x-release-please-version From 5d5e5310af6acf2accc87d2d3479bbaf4f90d6e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2025 04:03:12 +0000 Subject: [PATCH 193/397] fix: asyncify on non-asyncio runtimes (#261) --- src/onebusaway/_utils/_sync.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py index 8b3aaf2..ad7ec71 100644 --- a/src/onebusaway/_utils/_sync.py +++ b/src/onebusaway/_utils/_sync.py @@ -7,16 +7,20 @@ from typing import Any, TypeVar, Callable, Awaitable from typing_extensions import ParamSpec +import anyio +import sniffio +import anyio.to_thread + T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") if sys.version_info >= (3, 9): - to_thread = asyncio.to_thread + _asyncio_to_thread = asyncio.to_thread else: # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread # for Python 3.8 support - async def to_thread( + async def _asyncio_to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> Any: """Asynchronously run function *func* in a separate thread. @@ -34,6 +38,17 @@ async def to_thread( return await loop.run_in_executor(None, func_call) +async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs +) -> T_Retval: + if sniffio.current_async_library() == "asyncio": + return await _asyncio_to_thread(func, *args, **kwargs) + + return await anyio.to_thread.run_sync( + functools.partial(func, *args, **kwargs), + ) + + # inspired by `asyncer`, https://github.com/tiangolo/asyncer def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ From cd79e9dcdc74c8e868980b1ee434961f75a09289 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2025 04:03:33 +0000 Subject: [PATCH 194/397] release: 1.7.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cce9d1c..5660725 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.7.0" + ".": "1.7.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7d4e7..96b5a77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.7.1 (2025-02-14) + +Full Changelog: [v1.7.0...v1.7.1](https://github.com/OneBusAway/python-sdk/compare/v1.7.0...v1.7.1) + +### Bug Fixes + +* asyncify on non-asyncio runtimes ([#261](https://github.com/OneBusAway/python-sdk/issues/261)) ([5d5e531](https://github.com/OneBusAway/python-sdk/commit/5d5e5310af6acf2accc87d2d3479bbaf4f90d6e0)) + ## 1.7.0 (2025-02-08) Full Changelog: [v1.6.0...v1.7.0](https://github.com/OneBusAway/python-sdk/compare/v1.6.0...v1.7.0) diff --git a/pyproject.toml b/pyproject.toml index 5197443..d0d2698 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.7.0" +version = "1.7.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 655905f..8d84887 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.7.0" # x-release-please-version +__version__ = "1.7.1" # x-release-please-version From a4b3083b2276f1b14efc2c1dc8067218fade420e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 06:16:02 +0000 Subject: [PATCH 195/397] feat(client): allow passing `NotGiven` for body (#264) fix(client): mark some request bodies as optional --- src/onebusaway/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 5d6342c..606b4a6 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -518,7 +518,7 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data, + json=json_data if is_given(json_data) else None, files=files, **kwargs, ) From 5fbea7d5b435c9e20304e6ebb57f739703a2c093 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 06:16:27 +0000 Subject: [PATCH 196/397] release: 1.8.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5660725..c523ce1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.7.1" + ".": "1.8.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b5a77..fc7dfbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.8.0 (2025-02-21) + +Full Changelog: [v1.7.1...v1.8.0](https://github.com/OneBusAway/python-sdk/compare/v1.7.1...v1.8.0) + +### Features + +* **client:** allow passing `NotGiven` for body ([#264](https://github.com/OneBusAway/python-sdk/issues/264)) ([a4b3083](https://github.com/OneBusAway/python-sdk/commit/a4b3083b2276f1b14efc2c1dc8067218fade420e)) + + +### Bug Fixes + +* **client:** mark some request bodies as optional ([a4b3083](https://github.com/OneBusAway/python-sdk/commit/a4b3083b2276f1b14efc2c1dc8067218fade420e)) + ## 1.7.1 (2025-02-14) Full Changelog: [v1.7.0...v1.7.1](https://github.com/OneBusAway/python-sdk/compare/v1.7.0...v1.7.1) diff --git a/pyproject.toml b/pyproject.toml index d0d2698..d582d31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.7.1" +version = "1.8.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8d84887..cbc7f2d 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.7.1" # x-release-please-version +__version__ = "1.8.0" # x-release-please-version From aaa9050c599ae62cfa24ba579c5a6b864a7adb73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 04:38:17 +0000 Subject: [PATCH 197/397] chore(internal): fix devcontainers setup (#267) --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ac9a2e7..55d2025 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,4 +6,4 @@ USER vscode RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH -RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc +RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bbeb30b..c17fdc1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,9 @@ } } } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} } // Features to add to the dev container. More info: https://containers.dev/features. From e15eb89ec25485ee7b3d87f9231f27869046c319 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 04:38:37 +0000 Subject: [PATCH 198/397] release: 1.8.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c523ce1..7e334b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.0" + ".": "1.8.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7dfbd..9a8b5a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.8.1 (2025-02-22) + +Full Changelog: [v1.8.0...v1.8.1](https://github.com/OneBusAway/python-sdk/compare/v1.8.0...v1.8.1) + +### Chores + +* **internal:** fix devcontainers setup ([#267](https://github.com/OneBusAway/python-sdk/issues/267)) ([aaa9050](https://github.com/OneBusAway/python-sdk/commit/aaa9050c599ae62cfa24ba579c5a6b864a7adb73)) + ## 1.8.0 (2025-02-21) Full Changelog: [v1.7.1...v1.8.0](https://github.com/OneBusAway/python-sdk/compare/v1.7.1...v1.8.0) diff --git a/pyproject.toml b/pyproject.toml index d582d31..7e769e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.0" +version = "1.8.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index cbc7f2d..0ed96cd 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.0" # x-release-please-version +__version__ = "1.8.1" # x-release-please-version From b14c2b5b6f6bf376fcf0aeb6c3ae0536a222c131 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 03:53:35 +0000 Subject: [PATCH 199/397] chore(internal): properly set __pydantic_private__ (#270) --- src/onebusaway/_base_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 606b4a6..6e1aea6 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -63,7 +63,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import model_copy, model_dump +from ._compat import PYDANTIC_V2, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -207,6 +207,9 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -292,6 +295,9 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options From b24606875bfb4374b3d655e3d3ebbc9dbb5a5aa9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 03:53:54 +0000 Subject: [PATCH 200/397] release: 1.8.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7e334b0..262c3b7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.1" + ".": "1.8.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8b5a1..2a8399e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.8.2 (2025-02-26) + +Full Changelog: [v1.8.1...v1.8.2](https://github.com/OneBusAway/python-sdk/compare/v1.8.1...v1.8.2) + +### Chores + +* **internal:** properly set __pydantic_private__ ([#270](https://github.com/OneBusAway/python-sdk/issues/270)) ([b14c2b5](https://github.com/OneBusAway/python-sdk/commit/b14c2b5b6f6bf376fcf0aeb6c3ae0536a222c131)) + ## 1.8.1 (2025-02-22) Full Changelog: [v1.8.0...v1.8.1](https://github.com/OneBusAway/python-sdk/compare/v1.8.0...v1.8.1) diff --git a/pyproject.toml b/pyproject.toml index 7e769e5..1865f07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.1" +version = "1.8.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0ed96cd..8502f2c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.1" # x-release-please-version +__version__ = "1.8.2" # x-release-please-version From 362a2f95e074ad28da196fc58a10df96ca7bc9e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 03:12:09 +0000 Subject: [PATCH 201/397] docs: update URLs from stainlessapi.com to stainless.com (#273) More details at https://www.stainless.com/changelog/stainless-com --- README.md | 2 +- SECURITY.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e31e79..8bc5b4e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The Onebusaway SDK Python library provides convenient access to the Onebusaway S application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). -It is generated with [Stainless](https://www.stainlessapi.com/). +It is generated with [Stainless](https://www.stainless.com/). ## Documentation diff --git a/SECURITY.md b/SECURITY.md index 62ac016..8be07dc 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure From cd68881b35a8a1d83ff1de64bca8e8dea8494ebd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 03:12:50 +0000 Subject: [PATCH 202/397] chore(docs): update client docstring (#274) --- src/onebusaway/_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index dd3c800..e14128b 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -132,7 +132,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous onebusaway-sdk client instance. + """Construct a new synchronous OnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ @@ -362,7 +362,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async onebusaway-sdk client instance. + """Construct a new async AsyncOnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ From 7b2e2e505c7d440daa02464839512ee309113b02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 04:49:57 +0000 Subject: [PATCH 203/397] chore(internal): remove unused http client options forwarding (#276) --- src/onebusaway/_base_client.py | 97 +--------------------------------- 1 file changed, 1 insertion(+), 96 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 6e1aea6..8ee4250 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -9,7 +9,6 @@ import inspect import logging import platform -import warnings import email.utils from types import TracebackType from random import random @@ -36,7 +35,7 @@ import httpx import distro import pydantic -from httpx import URL, Limits +from httpx import URL from pydantic import PrivateAttr from . import _exceptions @@ -51,13 +50,10 @@ Timeout, NotGiven, ResponseT, - Transport, AnyMapping, PostParser, - ProxiesTypes, RequestFiles, HttpxSendArgs, - AsyncTransport, RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, @@ -337,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): _base_url: URL max_retries: int timeout: Union[float, Timeout, None] - _limits: httpx.Limits - _proxies: ProxiesTypes | None - _transport: Transport | AsyncTransport | None _strict_response_validation: bool _idempotency_header: str | None _default_stream_cls: type[_DefaultStreamT] | None = None @@ -352,9 +345,6 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, - limits: httpx.Limits, - transport: Transport | AsyncTransport | None, - proxies: ProxiesTypes | None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: @@ -362,9 +352,6 @@ def __init__( self._base_url = self._enforce_trailing_slash(URL(base_url)) self.max_retries = max_retries self.timeout = timeout - self._limits = limits - self._proxies = proxies - self._transport = transport self._custom_headers = custom_headers or {} self._custom_query = custom_query or {} self._strict_response_validation = _strict_response_validation @@ -800,46 +787,11 @@ def __init__( base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: Transport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -860,12 +812,9 @@ def __init__( super().__init__( version=version, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, base_url=base_url, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -875,9 +824,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -1372,45 +1318,10 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: AsyncTransport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -1432,11 +1343,8 @@ def __init__( super().__init__( version=version, base_url=base_url, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -1446,9 +1354,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: From d0b525ed8312ec043e43116f86eebaeb92fd47c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 04:50:21 +0000 Subject: [PATCH 204/397] release: 1.8.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 262c3b7..9ffa609 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.2" + ".": "1.8.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8399e..879b685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 1.8.3 (2025-03-04) + +Full Changelog: [v1.8.2...v1.8.3](https://github.com/OneBusAway/python-sdk/compare/v1.8.2...v1.8.3) + +### Chores + +* **docs:** update client docstring ([#274](https://github.com/OneBusAway/python-sdk/issues/274)) ([cd68881](https://github.com/OneBusAway/python-sdk/commit/cd68881b35a8a1d83ff1de64bca8e8dea8494ebd)) +* **internal:** remove unused http client options forwarding ([#276](https://github.com/OneBusAway/python-sdk/issues/276)) ([7b2e2e5](https://github.com/OneBusAway/python-sdk/commit/7b2e2e505c7d440daa02464839512ee309113b02)) + + +### Documentation + +* update URLs from stainlessapi.com to stainless.com ([#273](https://github.com/OneBusAway/python-sdk/issues/273)) ([362a2f9](https://github.com/OneBusAway/python-sdk/commit/362a2f95e074ad28da196fc58a10df96ca7bc9e9)) + ## 1.8.2 (2025-02-26) Full Changelog: [v1.8.1...v1.8.2](https://github.com/OneBusAway/python-sdk/compare/v1.8.1...v1.8.2) diff --git a/pyproject.toml b/pyproject.toml index 1865f07..1f496a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.2" +version = "1.8.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8502f2c..af5f659 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.2" # x-release-please-version +__version__ = "1.8.3" # x-release-please-version From 9948164ca18b145729396023df5d59937ad9b2d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 08:35:51 +0000 Subject: [PATCH 205/397] test: add DEFER_PYDANTIC_BUILD=false flag to tests (#278) --- scripts/test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/test b/scripts/test index 4fa5698..2b87845 100755 --- a/scripts/test +++ b/scripts/test @@ -52,6 +52,8 @@ else echo fi +export DEFER_PYDANTIC_BUILD=false + echo "==> Running tests" rye run pytest "$@" From 3ca5c734669aad9252aca2761537f2cf6dc9cfab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 06:12:28 +0000 Subject: [PATCH 206/397] chore(internal): remove extra empty newlines (#280) --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1f496a3..3e5c730 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ Homepage = "https://github.com/OneBusAway/python-sdk" Repository = "https://github.com/OneBusAway/python-sdk" - [tool.rye] managed = true # version pins are in requirements-dev.lock @@ -152,7 +151,6 @@ reportImplicitOverride = true reportImportCycles = false reportPrivateUsage = false - [tool.ruff] line-length = 120 output-format = "grouped" From 217ce3f97be80d4861ffc277336ec196c6873788 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 05:03:37 +0000 Subject: [PATCH 207/397] chore(internal): bump rye to 0.44.0 (#282) --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-pypi.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 55d2025..ff261ba 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} USER vscode -RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a8a4f..3b286e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Install dependencies @@ -42,7 +42,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Bootstrap diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 3e178a6..13dc1e5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Publish to PyPI From d55c08ad0ff636bf899c7a989185f30f431649bb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 05:23:00 +0000 Subject: [PATCH 208/397] fix(types): handle more discriminated union shapes (#283) --- src/onebusaway/_models.py | 7 +++++-- tests/test_models.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index c4401ff..b51a1bf 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -65,7 +65,7 @@ from ._constants import RAW_RESPONSE_HEADER if TYPE_CHECKING: - from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema __all__ = ["BaseModel", "GenericModel"] @@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + if schema["type"] != "model": return None + schema = cast("ModelSchema", schema) fields_schema = schema["schema"] if fields_schema["type"] != "model-fields": return None fields_schema = cast("ModelFieldsSchema", fields_schema) - field = fields_schema["fields"].get(field_name) if not field: return None diff --git a/tests/test_models.py b/tests/test_models.py index 95fa41d..d3499d2 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -854,3 +854,35 @@ class Model(BaseModel): m = construct_type(value={"cls": "foo"}, type_=Model) assert isinstance(m, Model) assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) From 959d15edcf912b2742e3598a35396041492ecbb7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:22:58 +0000 Subject: [PATCH 209/397] fix(ci): ensure pip is always available (#284) --- bin/publish-pypi | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/publish-pypi b/bin/publish-pypi index 05bfccb..ebebf91 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -5,5 +5,6 @@ mkdir -p dist rye build --clean # Patching importlib-metadata version until upstream library version is updated # https://github.com/pypa/twine/issues/977#issuecomment-2189800841 +"$HOME/.rye/self/bin/python3" -m ensurepip "$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN From 43691e0b16c2c885b8e75d07e82f1ff26d961ac8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:42:50 +0000 Subject: [PATCH 210/397] fix(ci): remove publishing patch (#285) --- bin/publish-pypi | 4 ---- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/publish-pypi b/bin/publish-pypi index ebebf91..826054e 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -3,8 +3,4 @@ set -eux mkdir -p dist rye build --clean -# Patching importlib-metadata version until upstream library version is updated -# https://github.com/pypa/twine/issues/977#issuecomment-2189800841 -"$HOME/.rye/self/bin/python3" -m ensurepip -"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN diff --git a/pyproject.toml b/pyproject.toml index 3e5c730..0051400 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ typecheck = { chain = [ "typecheck:mypy" = "mypy ." [build-system] -requires = ["hatchling", "hatch-fancy-pypi-readme"] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [tool.hatch.build] From e45e04798e64b912d4ba598ebc3ef0cdaf031203 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 04:05:35 +0000 Subject: [PATCH 211/397] chore: fix typos (#286) --- src/onebusaway/_models.py | 2 +- src/onebusaway/_utils/_transform.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index b51a1bf..3493571 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -681,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: setattr(typ, "__pydantic_config__", config) # noqa: B010 -# our use of subclasssing here causes weirdness for type checkers, +# our use of subclassing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: GenericModel = BaseModel diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 18afd9d..7ac2e17 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: """Transform the given `data` based on the annotations provided in `type_`. - Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. """ annotated_type = _get_annotated_type(type_) if annotated_type is None: From 0ddb7696b599edd9c7c15d90161d7e59f9487599 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 04:06:37 +0000 Subject: [PATCH 212/397] codegen metadata --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index d4b713b..2de8424 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml +openapi_spec_hash: 84d082f35446d29c7db3cfcd259e9859 +config_hash: c7e112ec9853ad18fe92551ae0d97656 From 370fd6526364c20ceb86667a99cad24d88b98b8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 04:06:58 +0000 Subject: [PATCH 213/397] release: 1.8.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9ffa609..dc8ed9b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.3" + ".": "1.8.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 879b685..3934b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 1.8.4 (2025-03-27) + +Full Changelog: [v1.8.3...v1.8.4](https://github.com/OneBusAway/python-sdk/compare/v1.8.3...v1.8.4) + +### Bug Fixes + +* **ci:** ensure pip is always available ([#284](https://github.com/OneBusAway/python-sdk/issues/284)) ([959d15e](https://github.com/OneBusAway/python-sdk/commit/959d15edcf912b2742e3598a35396041492ecbb7)) +* **ci:** remove publishing patch ([#285](https://github.com/OneBusAway/python-sdk/issues/285)) ([43691e0](https://github.com/OneBusAway/python-sdk/commit/43691e0b16c2c885b8e75d07e82f1ff26d961ac8)) +* **types:** handle more discriminated union shapes ([#283](https://github.com/OneBusAway/python-sdk/issues/283)) ([d55c08a](https://github.com/OneBusAway/python-sdk/commit/d55c08ad0ff636bf899c7a989185f30f431649bb)) + + +### Chores + +* fix typos ([#286](https://github.com/OneBusAway/python-sdk/issues/286)) ([e45e047](https://github.com/OneBusAway/python-sdk/commit/e45e04798e64b912d4ba598ebc3ef0cdaf031203)) +* **internal:** bump rye to 0.44.0 ([#282](https://github.com/OneBusAway/python-sdk/issues/282)) ([217ce3f](https://github.com/OneBusAway/python-sdk/commit/217ce3f97be80d4861ffc277336ec196c6873788)) +* **internal:** remove extra empty newlines ([#280](https://github.com/OneBusAway/python-sdk/issues/280)) ([3ca5c73](https://github.com/OneBusAway/python-sdk/commit/3ca5c734669aad9252aca2761537f2cf6dc9cfab)) + ## 1.8.3 (2025-03-04) Full Changelog: [v1.8.2...v1.8.3](https://github.com/OneBusAway/python-sdk/compare/v1.8.2...v1.8.3) diff --git a/pyproject.toml b/pyproject.toml index 0051400..6b048b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.3" +version = "1.8.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index af5f659..e4402cd 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.3" # x-release-please-version +__version__ = "1.8.4" # x-release-please-version From d301a0cf24104ff0d791046c99093f3c47365bf3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 16:36:22 +0000 Subject: [PATCH 214/397] chore(internal): codegen related update (#288) --- README.md | 21 +- requirements-dev.lock | 12 +- requirements.lock | 12 +- scripts/utils/ruffen-docs.py | 4 +- src/onebusaway/__init__.py | 84 +-- src/onebusaway/_base_client.py | 13 +- src/onebusaway/_client.py | 527 ++++--------- src/onebusaway/_constants.py | 2 +- src/onebusaway/_exceptions.py | 46 +- src/onebusaway/_resource.py | 12 +- src/onebusaway/_response.py | 11 +- src/onebusaway/_streaming.py | 12 +- src/onebusaway/_types.py | 4 + src/onebusaway/_utils/_typing.py | 7 +- src/onebusaway/resources/__init__.py | 451 ++--------- .../resources/agencies_with_coverage.py | 73 +- src/onebusaway/resources/agency.py | 85 +-- .../resources/arrival_and_departure.py | 258 +++---- src/onebusaway/resources/block.py | 85 +-- src/onebusaway/resources/config.py | 73 +- src/onebusaway/resources/current_time.py | 73 +- .../resources/report_problem_with_stop.py | 157 ++-- .../resources/report_problem_with_trip.py | 211 +++--- src/onebusaway/resources/route.py | 85 +-- .../resources/route_ids_for_agency.py | 85 +-- src/onebusaway/resources/routes_for_agency.py | 85 +-- .../resources/routes_for_location.py | 147 ++-- .../resources/schedule_for_route.py | 120 ++- src/onebusaway/resources/schedule_for_stop.py | 118 ++- src/onebusaway/resources/search_for_route.py | 115 ++- src/onebusaway/resources/search_for_stop.py | 115 ++- src/onebusaway/resources/shape.py | 85 +-- src/onebusaway/resources/stop.py | 85 +-- .../resources/stop_ids_for_agency.py | 85 +-- src/onebusaway/resources/stops_for_agency.py | 85 +-- .../resources/stops_for_location.py | 147 ++-- src/onebusaway/resources/stops_for_route.py | 127 ++-- src/onebusaway/resources/trip.py | 85 +-- src/onebusaway/resources/trip_details.py | 151 ++-- src/onebusaway/resources/trip_for_vehicle.py | 143 ++-- .../resources/trips_for_location.py | 155 ++-- src/onebusaway/resources/trips_for_route.py | 135 ++-- .../resources/vehicles_for_agency.py | 111 ++- src/onebusaway/types/__init__.py | 78 +- .../agencies_with_coverage_list_response.py | 26 +- .../types/agency_retrieve_response.py | 20 +- .../arrival_and_departure_list_params.py | 13 +- .../arrival_and_departure_list_response.py | 138 ++-- .../arrival_and_departure_retrieve_params.py | 9 +- ...arrival_and_departure_retrieve_response.py | 132 ++-- .../types/block_retrieve_response.py | 58 +- .../types/config_retrieve_response.py | 68 +- .../types/current_time_retrieve_response.py | 16 +- ...eport_problem_with_stop_retrieve_params.py | 9 +- ...eport_problem_with_trip_retrieve_params.py | 18 +- .../route_ids_for_agency_list_response.py | 15 +- .../types/route_retrieve_response.py | 24 +- .../types/routes_for_agency_list_response.py | 26 +- .../types/routes_for_location_list_params.py | 9 +- .../routes_for_location_list_response.py | 32 +- .../schedule_for_route_retrieve_params.py | 13 +- .../schedule_for_route_retrieve_response.py | 99 +-- .../schedule_for_stop_retrieve_params.py | 13 +- .../schedule_for_stop_retrieve_response.py | 72 +- .../types/search_for_route_list_params.py | 9 +- .../types/search_for_route_list_response.py | 28 +- .../types/search_for_stop_list_params.py | 9 +- .../types/search_for_stop_list_response.py | 26 +- .../types/shape_retrieve_response.py | 12 +- src/onebusaway/types/shared/__init__.py | 2 +- src/onebusaway/types/shared/references.py | 144 ++-- .../types/shared/response_wrapper.py | 10 +- .../stop_ids_for_agency_list_response.py | 15 +- .../types/stop_retrieve_response.py | 22 +- .../types/stops_for_agency_list_response.py | 23 +- .../types/stops_for_location_list_params.py | 9 +- .../types/stops_for_location_list_response.py | 26 +- .../types/stops_for_route_list_params.py | 9 +- .../types/stops_for_route_list_response.py | 36 +- .../types/trip_detail_retrieve_params.py | 9 +- .../types/trip_detail_retrieve_response.py | 98 +-- .../types/trip_for_vehicle_retrieve_params.py | 9 +- .../trip_for_vehicle_retrieve_response.py | 98 +-- .../types/trip_retrieve_response.py | 34 +- .../types/trips_for_location_list_params.py | 9 +- .../types/trips_for_location_list_response.py | 102 ++- .../types/trips_for_route_list_params.py | 9 +- .../types/trips_for_route_list_response.py | 100 ++- .../types/vehicles_for_agency_list_params.py | 7 +- .../vehicles_for_agency_list_response.py | 88 +-- tests/__init__.py | 2 +- tests/api_resources/__init__.py | 2 +- .../test_agencies_with_coverage.py | 50 +- tests/api_resources/test_agency.py | 60 +- .../test_arrival_and_departure.py | 120 +-- tests/api_resources/test_block.py | 60 +- tests/api_resources/test_config.py | 50 +- tests/api_resources/test_current_time.py | 50 +- .../test_report_problem_with_stop.py | 65 +- .../test_report_problem_with_trip.py | 65 +- tests/api_resources/test_route.py | 60 +- .../test_route_ids_for_agency.py | 60 +- tests/api_resources/test_routes_for_agency.py | 60 +- .../api_resources/test_routes_for_location.py | 55 +- .../api_resources/test_schedule_for_route.py | 66 +- tests/api_resources/test_schedule_for_stop.py | 66 +- tests/api_resources/test_search_for_route.py | 55 +- tests/api_resources/test_search_for_stop.py | 55 +- tests/api_resources/test_shape.py | 60 +- tests/api_resources/test_stop.py | 60 +- .../api_resources/test_stop_ids_for_agency.py | 60 +- tests/api_resources/test_stops_for_agency.py | 60 +- .../api_resources/test_stops_for_location.py | 55 +- tests/api_resources/test_stops_for_route.py | 65 +- tests/api_resources/test_trip.py | 60 +- tests/api_resources/test_trip_details.py | 65 +- tests/api_resources/test_trip_for_vehicle.py | 65 +- .../api_resources/test_trips_for_location.py | 55 +- tests/api_resources/test_trips_for_route.py | 65 +- .../api_resources/test_vehicles_for_agency.py | 65 +- tests/conftest.py | 22 +- tests/test_client.py | 713 +++++++----------- tests/test_models.py | 11 +- tests/test_streaming.py | 20 +- tests/test_transform.py | 16 +- 125 files changed, 3805 insertions(+), 5041 deletions(-) diff --git a/README.md b/README.md index 8bc5b4e..fdae5e7 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,8 @@ client = AsyncOnebusawaySDK( api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted ) - async def main() -> None: - current_time = await client.current_time.retrieve() - + current_time = await client.current_time.retrieve() asyncio.run(main()) ``` @@ -92,7 +90,7 @@ try: client.current_time.retrieve() except onebusaway.APIConnectionError as e: print("The server could not be reached") - print(e.__cause__) # an underlying Exception, likely raised within httpx. + print(e.__cause__) # an underlying Exception, likely raised within httpx. except onebusaway.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") except onebusaway.APIStatusError as e: @@ -132,7 +130,7 @@ client = OnebusawaySDK( ) # Or, configure per-request: -client.with_options(max_retries=5).current_time.retrieve() +client.with_options(max_retries = 5).current_time.retrieve() ``` ### Timeouts @@ -155,7 +153,7 @@ client = OnebusawaySDK( ) # Override per-request: -client.with_options(timeout=5.0).current_time.retrieve() +client.with_options(timeout = 5.0).current_time.retrieve() ``` On timeout, an `APITimeoutError` is thrown. @@ -214,11 +212,11 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.current_time.with_streaming_response.retrieve() as response: - print(response.headers.get("X-My-Header")) +with client.current_time.with_streaming_response.retrieve() as response : + print(response.headers.get('X-My-Header')) for line in response.iter_lines(): - print(line) + print(line) ``` The context manager is required so that the response will reliably be closed. @@ -272,10 +270,7 @@ from onebusaway import OnebusawaySDK, DefaultHttpxClient client = OnebusawaySDK( # Or use the `ONEBUSAWAY_SDK_BASE_URL` env var base_url="http://my.test.server.example.com:8083", - http_client=DefaultHttpxClient( - proxy="http://my.test.proxy.example.com", - transport=httpx.HTTPTransport(local_address="0.0.0.0"), - ), + http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")), ) ``` diff --git a/requirements-dev.lock b/requirements-dev.lock index e00b078..1f3d089 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -14,7 +14,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via sdk-pythonpackagename argcomplete==3.1.2 # via nox certifi==2023.7.22 @@ -26,7 +26,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via onebusaway + # via sdk-pythonpackagename exceptiongroup==1.2.2 # via anyio # via pytest @@ -37,8 +37,8 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 - # via onebusaway # via respx + # via sdk-pythonpackagename idna==3.4 # via anyio # via httpx @@ -64,7 +64,7 @@ platformdirs==3.11.0 pluggy==1.5.0 # via pytest pydantic==2.10.3 - # via onebusaway + # via sdk-pythonpackagename pydantic-core==2.27.1 # via pydantic pygments==2.18.0 @@ -86,7 +86,7 @@ six==1.16.0 # via python-dateutil sniffio==1.3.0 # via anyio - # via onebusaway + # via sdk-pythonpackagename time-machine==2.9.0 tomli==2.0.2 # via mypy @@ -94,10 +94,10 @@ tomli==2.0.2 typing-extensions==4.12.2 # via anyio # via mypy - # via onebusaway # via pydantic # via pydantic-core # via pyright + # via sdk-pythonpackagename virtualenv==20.24.5 # via nox zipp==3.17.0 diff --git a/requirements.lock b/requirements.lock index cf5c8e0..26eb37b 100644 --- a/requirements.lock +++ b/requirements.lock @@ -14,12 +14,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via sdk-pythonpackagename certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via onebusaway + # via sdk-pythonpackagename exceptiongroup==1.2.2 # via anyio h11==0.14.0 @@ -27,19 +27,19 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 - # via onebusaway + # via sdk-pythonpackagename idna==3.4 # via anyio # via httpx pydantic==2.10.3 - # via onebusaway + # via sdk-pythonpackagename pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio - # via onebusaway + # via sdk-pythonpackagename typing-extensions==4.12.2 # via anyio - # via onebusaway # via pydantic # via pydantic-core + # via sdk-pythonpackagename diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py index 0cf2bd2..37b3d94 100644 --- a/scripts/utils/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f"{match['before']}{code}{match['after']}" + return f'{match["before"]}{code}{match["after"]}' def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f"{match['before']}{code}{match['after']}" + return f'{match["before"]}{code}{match["after"]}' src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 2e0349f..e2acc95 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -1,82 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._version import __version__, __title__ +from ._client import Timeout,Transport,RequestOptions,Client,AsyncClient,Stream,AsyncStream,OnebusawaySDK,AsyncOnebusawaySDK +from ._exceptions import OnebusawaySDKError,APIError,APIStatusError,APITimeoutError,APIConnectionError,APIResponseValidationError,BadRequestError,AuthenticationError,PermissionDeniedError,NotFoundError,ConflictError,UnprocessableEntityError,RateLimitError,InternalServerError +from ._types import NoneType,Transport,ProxiesTypes,NotGiven,NOT_GIVEN,Omit from ._utils import file_from_path -from ._client import ( - Client, - Stream, - Timeout, - Transport, - AsyncClient, - AsyncStream, - OnebusawaySDK, - RequestOptions, - AsyncOnebusawaySDK, -) from ._models import BaseModel -from ._version import __title__, __version__ -from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse -from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS -from ._exceptions import ( - APIError, - ConflictError, - NotFoundError, - APIStatusError, - RateLimitError, - APITimeoutError, - BadRequestError, - APIConnectionError, - OnebusawaySDKError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, - APIResponseValidationError, -) -from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient +from ._constants import DEFAULT_TIMEOUT,DEFAULT_MAX_RETRIES,DEFAULT_CONNECTION_LIMITS +from ._base_client import DefaultHttpxClient,DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging +from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse -__all__ = [ - "types", - "__version__", - "__title__", - "NoneType", - "Transport", - "ProxiesTypes", - "NotGiven", - "NOT_GIVEN", - "Omit", - "OnebusawaySDKError", - "APIError", - "APIStatusError", - "APITimeoutError", - "APIConnectionError", - "APIResponseValidationError", - "BadRequestError", - "AuthenticationError", - "PermissionDeniedError", - "NotFoundError", - "ConflictError", - "UnprocessableEntityError", - "RateLimitError", - "InternalServerError", - "Timeout", - "RequestOptions", - "Client", - "AsyncClient", - "Stream", - "AsyncStream", - "OnebusawaySDK", - "AsyncOnebusawaySDK", - "file_from_path", - "BaseModel", - "DEFAULT_TIMEOUT", - "DEFAULT_MAX_RETRIES", - "DEFAULT_CONNECTION_LIMITS", - "DefaultHttpxClient", - "DefaultAsyncHttpxClient", -] +__all__ = ["types", "__version__", "__title__", "NoneType", "Transport", "ProxiesTypes", "NotGiven", "NOT_GIVEN", "Omit", "OnebusawaySDKError", "APIError", "APIStatusError", "APITimeoutError", "APIConnectionError", "APIResponseValidationError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError", "Timeout", "RequestOptions", "Client", "AsyncClient", "Stream", "AsyncStream", "OnebusawaySDK", "AsyncOnebusawaySDK", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", "DEFAULT_MAX_RETRIES", "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient"] _setup_logging() @@ -88,7 +24,7 @@ for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "onebusaway" + setattr(__locals[__name], "__module__", "onebusaway") except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. - pass + pass \ No newline at end of file diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 8ee4250..26cbf6c 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -9,6 +9,7 @@ import inspect import logging import platform +import warnings import email.utils from types import TracebackType from random import random @@ -83,6 +84,7 @@ APIConnectionError, APIResponseValidationError, ) +from ._legacy_response import LegacyAPIResponse log: logging.Logger = logging.getLogger(__name__) @@ -203,7 +205,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: self.__pydantic_private__ = {} self._model = model @@ -291,7 +293,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: self.__pydantic_private__ = {} self._model = model @@ -608,7 +610,7 @@ def default_headers(self) -> dict[str, str | Omit]: "Accept": "application/json", "Content-Type": "application/json", "User-Agent": self.user_agent, - **self.platform_headers(), +**self.platform_headers(), **self.auth_headers, **self._custom_headers, } @@ -994,6 +996,7 @@ def _request( response.reason_phrase, response.headers, ) + try: response.raise_for_status() @@ -1069,6 +1072,8 @@ def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: + + origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): @@ -1592,6 +1597,8 @@ async def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: + + origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e14128b..dce7036 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -2,77 +2,48 @@ from __future__ import annotations +import httpx + import os -from typing import Any, Union, Mapping -from typing_extensions import Self, override -import httpx +from ._streaming import AsyncStream as AsyncStream, Stream as Stream + +from typing import Union, Mapping, Any + +from ._exceptions import OnebusawaySDKError, APIStatusError + +from typing_extensions import override, Self + +from ._utils import get_async_library + +from .resources import agencies_with_coverage, agency, vehicles_for_agency, config, current_time, stops_for_location, stops_for_route, stops_for_agency, stop, stop_ids_for_agency, schedule_for_stop, route, route_ids_for_agency, routes_for_location, routes_for_agency, schedule_for_route, arrival_and_departure, trip, trips_for_location, trip_details, trip_for_vehicle, trips_for_route, report_problem_with_stop, report_problem_with_trip, search_for_stop, search_for_route, block, shape from . import _exceptions -from ._qs import Querystring -from ._types import ( - NOT_GIVEN, - Omit, - Timeout, - NotGiven, - Transport, - ProxiesTypes, - RequestOptions, -) -from ._utils import ( - is_given, - get_async_library, -) + +import os +import asyncio +import warnings +from typing_extensions import Literal + +import httpx + from ._version import __version__ -from .resources import ( - stop, - trip, - block, - route, - shape, - agency, - config, - current_time, - trip_details, - search_for_stop, - stops_for_route, - trips_for_route, - search_for_route, - stops_for_agency, - trip_for_vehicle, - routes_for_agency, - schedule_for_stop, - schedule_for_route, - stops_for_location, - trips_for_location, - routes_for_location, - stop_ids_for_agency, - vehicles_for_agency, - route_ids_for_agency, - arrival_and_departure, - agencies_with_coverage, - report_problem_with_stop, - report_problem_with_trip, -) -from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import APIStatusError, OnebusawaySDKError +from ._qs import Querystring +from ._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, maybe_coerce_integer, maybe_coerce_float, maybe_coerce_boolean, is_given +from ._types import Omit, NotGiven, Timeout, Transport, ProxiesTypes, RequestOptions, Headers, NoneType, Query, Body, NOT_GIVEN from ._base_client import ( + DEFAULT_CONNECTION_LIMITS, + DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, + ResponseT, + SyncHttpxClientWrapper, + AsyncHttpxClientWrapper, SyncAPIClient, AsyncAPIClient, + make_request_options, ) -__all__ = [ - "Timeout", - "Transport", - "ProxiesTypes", - "RequestOptions", - "OnebusawaySDK", - "AsyncOnebusawaySDK", - "Client", - "AsyncClient", -] - +__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "OnebusawaySDK", "AsyncOnebusawaySDK", "Client", "AsyncClient"] class OnebusawaySDK(SyncAPIClient): agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource @@ -109,56 +80,38 @@ class OnebusawaySDK(SyncAPIClient): # client options api_key: str - def __init__( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, - max_retries: int = DEFAULT_MAX_RETRIES, - default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. - http_client: httpx.Client | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False, - ) -> None: + def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + http_client: httpx.Client | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False) -> None: """Construct a new synchronous OnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__( - version=__version__, - base_url=base_url, - max_retries=max_retries, - timeout=timeout, - http_client=http_client, - custom_headers=default_headers, - custom_query=default_query, - _strict_response_validation=_strict_response_validation, - ) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResource(self) self.agency = agency.AgencyResource(self) @@ -205,42 +158,33 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": "false", - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": "false", + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, - default_headers: Mapping[str, str] | None = None, - set_default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - set_default_query: Mapping[str, object] | None = None, - _extra_kwargs: Mapping[str, Any] = {}, - ) -> Self: + def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + raise ValueError( + 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' + ) if default_query is not None and set_default_query is not None: - raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + raise ValueError( + 'The `default_query` and `set_default_query` arguments are mutually exclusive' + ) headers = self._custom_headers if default_headers is not None: @@ -255,29 +199,14 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( - api_key=api_key or self.api_key, - base_url=base_url or self.base_url, - timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, - http_client=http_client, - max_retries=max_retries if is_given(max_retries) else self.max_retries, - default_headers=headers, - default_query=params, - **_extra_kwargs, - ) + return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error( - self, - err_msg: str, - *, - body: object, - response: httpx.Response, - ) -> APIStatusError: + def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -303,7 +232,6 @@ def _make_status_error( return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) - class AsyncOnebusawaySDK(AsyncAPIClient): agencies_with_coverage: agencies_with_coverage.AsyncAgenciesWithCoverageResource agency: agency.AsyncAgencyResource @@ -339,56 +267,38 @@ class AsyncOnebusawaySDK(AsyncAPIClient): # client options api_key: str - def __init__( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, - max_retries: int = DEFAULT_MAX_RETRIES, - default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. - http_client: httpx.AsyncClient | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False, - ) -> None: + def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + http_client: httpx.AsyncClient | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False) -> None: """Construct a new async AsyncOnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__( - version=__version__, - base_url=base_url, - max_retries=max_retries, - timeout=timeout, - http_client=http_client, - custom_headers=default_headers, - custom_query=default_query, - _strict_response_validation=_strict_response_validation, - ) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResource(self) self.agency = agency.AsyncAgencyResource(self) @@ -435,42 +345,33 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": f"async:{get_async_library()}", - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": f'async:{get_async_library()}', + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, - default_headers: Mapping[str, str] | None = None, - set_default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - set_default_query: Mapping[str, object] | None = None, - _extra_kwargs: Mapping[str, Any] = {}, - ) -> Self: + def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + raise ValueError( + 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' + ) if default_query is not None and set_default_query is not None: - raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + raise ValueError( + 'The `default_query` and `set_default_query` arguments are mutually exclusive' + ) headers = self._custom_headers if default_headers is not None: @@ -485,29 +386,14 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( - api_key=api_key or self.api_key, - base_url=base_url or self.base_url, - timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, - http_client=http_client, - max_retries=max_retries if is_given(max_retries) else self.max_retries, - default_headers=headers, - default_query=params, - **_extra_kwargs, - ) + return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error( - self, - err_msg: str, - *, - body: object, - response: httpx.Response, - ) -> APIStatusError: + def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -533,235 +419,130 @@ def _make_status_error( return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) - class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) self.agency = agency.AgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = config.ConfigResourceWithRawResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithRawResponse(client.current_time) self.stops_for_location = stops_for_location.StopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = stops_for_route.StopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.StopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.RouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = trip.TripResourceWithRawResponse(client.trip) self.trips_for_location = trips_for_location.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = trip_details.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.BlockResourceWithRawResponse(client.block) self.shape = shape.ShapeResourceWithRawResponse(client.shape) - class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) self.agency = agency.AsyncAgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = config.AsyncConfigResourceWithRawResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.AsyncStopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.AsyncRouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = trip.AsyncTripResourceWithRawResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = trip_details.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.AsyncBlockResourceWithRawResponse(client.block) self.shape = shape.AsyncShapeResourceWithRawResponse(client.shape) - class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) self.agency = agency.AgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = config.ConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) self.stops_for_route = stops_for_route.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = stop.StopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = route.RouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse(client.routes_for_location) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) self.trip = trip.TripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = trip_details.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = block.BlockResourceWithStreamingResponse(client.block) self.shape = shape.ShapeResourceWithStreamingResponse(client.shape) - class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) self.agency = agency.AsyncAgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = config.AsyncConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse(client.stops_for_location) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse( - client.stops_for_agency - ) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = stop.AsyncStopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = route.AsyncRouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse(client.routes_for_location) + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) self.trip = trip.AsyncTripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = trip_details.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse( - client.trip_for_vehicle - ) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = ( - report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - ) - self.report_problem_with_trip = ( - report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) - ) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse( - client.search_for_route - ) + self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = block.AsyncBlockResourceWithStreamingResponse(client.block) self.shape = shape.AsyncShapeResourceWithStreamingResponse(client.shape) - Client = OnebusawaySDK -AsyncClient = AsyncOnebusawaySDK +AsyncClient = AsyncOnebusawaySDK \ No newline at end of file diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py index 6ddf2c7..f32ba27 100644 --- a/src/onebusaway/_constants.py +++ b/src/onebusaway/_constants.py @@ -11,4 +11,4 @@ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) INITIAL_RETRY_DELAY = 0.5 -MAX_RETRY_DELAY = 8.0 +MAX_RETRY_DELAY = 8.0 \ No newline at end of file diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py index c76aabb..af310bb 100644 --- a/src/onebusaway/_exceptions.py +++ b/src/onebusaway/_exceptions.py @@ -2,26 +2,15 @@ from __future__ import annotations -from typing_extensions import Literal - import httpx -__all__ = [ - "BadRequestError", - "AuthenticationError", - "PermissionDeniedError", - "NotFoundError", - "ConflictError", - "UnprocessableEntityError", - "RateLimitError", - "InternalServerError", -] +from typing_extensions import Literal +__all__ = ["BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError"] class OnebusawaySDKError(Exception): pass - class APIError(OnebusawaySDKError): message: str request: httpx.Request @@ -43,7 +32,6 @@ def __init__(self, message: str, request: httpx.Request, *, body: object | None) self.message = message self.body = body - class APIResponseValidationError(APIError): response: httpx.Response status_code: int @@ -53,10 +41,8 @@ def __init__(self, response: httpx.Response, body: object | None, *, message: st self.response = response self.status_code = response.status_code - class APIStatusError(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" - response: httpx.Response status_code: int @@ -65,44 +51,34 @@ def __init__(self, message: str, *, response: httpx.Response, body: object | Non self.response = response self.status_code = response.status_code - class APIConnectionError(APIError): def __init__(self, *, message: str = "Connection error.", request: httpx.Request) -> None: super().__init__(message, request, body=None) - class APITimeoutError(APIConnectionError): def __init__(self, request: httpx.Request) -> None: - super().__init__(message="Request timed out.", request=request) - + super().__init__(message= "Request timed out.", request=request) class BadRequestError(APIStatusError): - status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] class AuthenticationError(APIStatusError): - status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] class PermissionDeniedError(APIStatusError): - status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] class NotFoundError(APIStatusError): - status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] class ConflictError(APIStatusError): - status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] class UnprocessableEntityError(APIStatusError): - status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] class RateLimitError(APIStatusError): - status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] class InternalServerError(APIStatusError): - pass + pass \ No newline at end of file diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py index 153115b..cda700b 100644 --- a/src/onebusaway/_resource.py +++ b/src/onebusaway/_resource.py @@ -3,13 +3,12 @@ from __future__ import annotations import time -from typing import TYPE_CHECKING - import anyio -if TYPE_CHECKING: - from ._client import OnebusawaySDK, AsyncOnebusawaySDK +from typing import TYPE_CHECKING +if TYPE_CHECKING: + from ._client import OnebusawaySDK, AsyncOnebusawaySDK class SyncAPIResource: _client: OnebusawaySDK @@ -24,8 +23,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self._get_api_list = client.get_api_list def _sleep(self, seconds: float) -> None: - time.sleep(seconds) - + time.sleep(seconds) class AsyncAPIResource: _client: AsyncOnebusawaySDK @@ -40,4 +38,4 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self._get_api_list = client.get_api_list async def _sleep(self, seconds: float) -> None: - await anyio.sleep(seconds) + await anyio.sleep(seconds) \ No newline at end of file diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 16b6f2b..02db195 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -25,12 +25,14 @@ import pydantic from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base +from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base, is_type_alias_type +from ._streaming import extract_stream_chunk_type from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type from ._exceptions import OnebusawaySDKError, APIResponseValidationError + if TYPE_CHECKING: from ._models import FinalRequestOptions from ._base_client import BaseClient @@ -138,6 +140,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: origin = get_origin(cast_to) or cast_to + + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -197,6 +201,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") + if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") @@ -270,6 +275,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): + + @overload def parse(self, *, to: type[_T]) -> _T: ... @@ -372,6 +379,8 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): + + @overload async def parse(self, *, to: type[_T]) -> _T: ... diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 957b8da..9b91d7e 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -9,7 +9,9 @@ import httpx -from ._utils import extract_type_var_from_base +from ._utils import is_mapping, is_dict, extract_type_var_from_base +from ._exceptions import APIError +from ._response import APIResponse, AsyncAPIResponse if TYPE_CHECKING: from ._client import OnebusawaySDK, AsyncOnebusawaySDK @@ -53,10 +55,10 @@ def __stream__(self) -> Iterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed for _sse in iterator: ... @@ -117,10 +119,10 @@ async def __stream__(self) -> AsyncIterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed async for _sse in iterator: ... diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index a457723..515085c 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -1,6 +1,7 @@ from __future__ import annotations from os import PathLike +from abc import ABC, abstractmethod from typing import ( IO, TYPE_CHECKING, @@ -13,8 +14,10 @@ Mapping, TypeVar, Callable, + Iterator, Optional, Sequence, + AsyncIterator, ) from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable @@ -25,6 +28,7 @@ if TYPE_CHECKING: from ._models import BaseModel from ._response import APIResponse, AsyncAPIResponse + from ._legacy_response import HttpxBinaryResponseContent Transport = BaseTransport AsyncTransport = AsyncBaseTransport diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 278749b..5e9600b 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -49,17 +49,16 @@ def is_typevar(typ: type) -> bool: if sys.version_info >= (3, 12): _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) - def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: """Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) - # > True - Str = TypeAliasType("Str", str) + #> True + Str = TypeAliasType('Str', str) is_type_alias_type(Str) - # > True + #> True ``` """ return isinstance(tp, _TYPE_ALIAS_TYPES) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 0a958d2..3482e97 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,397 +1,60 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .stop import ( - StopResource, - AsyncStopResource, - StopResourceWithRawResponse, - AsyncStopResourceWithRawResponse, - StopResourceWithStreamingResponse, - AsyncStopResourceWithStreamingResponse, -) -from .trip import ( - TripResource, - AsyncTripResource, - TripResourceWithRawResponse, - AsyncTripResourceWithRawResponse, - TripResourceWithStreamingResponse, - AsyncTripResourceWithStreamingResponse, -) -from .block import ( - BlockResource, - AsyncBlockResource, - BlockResourceWithRawResponse, - AsyncBlockResourceWithRawResponse, - BlockResourceWithStreamingResponse, - AsyncBlockResourceWithStreamingResponse, -) -from .route import ( - RouteResource, - AsyncRouteResource, - RouteResourceWithRawResponse, - AsyncRouteResourceWithRawResponse, - RouteResourceWithStreamingResponse, - AsyncRouteResourceWithStreamingResponse, -) -from .shape import ( - ShapeResource, - AsyncShapeResource, - ShapeResourceWithRawResponse, - AsyncShapeResourceWithRawResponse, - ShapeResourceWithStreamingResponse, - AsyncShapeResourceWithStreamingResponse, -) -from .agency import ( - AgencyResource, - AsyncAgencyResource, - AgencyResourceWithRawResponse, - AsyncAgencyResourceWithRawResponse, - AgencyResourceWithStreamingResponse, - AsyncAgencyResourceWithStreamingResponse, -) -from .config import ( - ConfigResource, - AsyncConfigResource, - ConfigResourceWithRawResponse, - AsyncConfigResourceWithRawResponse, - ConfigResourceWithStreamingResponse, - AsyncConfigResourceWithStreamingResponse, -) -from .current_time import ( - CurrentTimeResource, - AsyncCurrentTimeResource, - CurrentTimeResourceWithRawResponse, - AsyncCurrentTimeResourceWithRawResponse, - CurrentTimeResourceWithStreamingResponse, - AsyncCurrentTimeResourceWithStreamingResponse, -) -from .trip_details import ( - TripDetailsResource, - AsyncTripDetailsResource, - TripDetailsResourceWithRawResponse, - AsyncTripDetailsResourceWithRawResponse, - TripDetailsResourceWithStreamingResponse, - AsyncTripDetailsResourceWithStreamingResponse, -) -from .search_for_stop import ( - SearchForStopResource, - AsyncSearchForStopResource, - SearchForStopResourceWithRawResponse, - AsyncSearchForStopResourceWithRawResponse, - SearchForStopResourceWithStreamingResponse, - AsyncSearchForStopResourceWithStreamingResponse, -) -from .stops_for_route import ( - StopsForRouteResource, - AsyncStopsForRouteResource, - StopsForRouteResourceWithRawResponse, - AsyncStopsForRouteResourceWithRawResponse, - StopsForRouteResourceWithStreamingResponse, - AsyncStopsForRouteResourceWithStreamingResponse, -) -from .trips_for_route import ( - TripsForRouteResource, - AsyncTripsForRouteResource, - TripsForRouteResourceWithRawResponse, - AsyncTripsForRouteResourceWithRawResponse, - TripsForRouteResourceWithStreamingResponse, - AsyncTripsForRouteResourceWithStreamingResponse, -) -from .search_for_route import ( - SearchForRouteResource, - AsyncSearchForRouteResource, - SearchForRouteResourceWithRawResponse, - AsyncSearchForRouteResourceWithRawResponse, - SearchForRouteResourceWithStreamingResponse, - AsyncSearchForRouteResourceWithStreamingResponse, -) -from .stops_for_agency import ( - StopsForAgencyResource, - AsyncStopsForAgencyResource, - StopsForAgencyResourceWithRawResponse, - AsyncStopsForAgencyResourceWithRawResponse, - StopsForAgencyResourceWithStreamingResponse, - AsyncStopsForAgencyResourceWithStreamingResponse, -) -from .trip_for_vehicle import ( - TripForVehicleResource, - AsyncTripForVehicleResource, - TripForVehicleResourceWithRawResponse, - AsyncTripForVehicleResourceWithRawResponse, - TripForVehicleResourceWithStreamingResponse, - AsyncTripForVehicleResourceWithStreamingResponse, -) -from .routes_for_agency import ( - RoutesForAgencyResource, - AsyncRoutesForAgencyResource, - RoutesForAgencyResourceWithRawResponse, - AsyncRoutesForAgencyResourceWithRawResponse, - RoutesForAgencyResourceWithStreamingResponse, - AsyncRoutesForAgencyResourceWithStreamingResponse, -) -from .schedule_for_stop import ( - ScheduleForStopResource, - AsyncScheduleForStopResource, - ScheduleForStopResourceWithRawResponse, - AsyncScheduleForStopResourceWithRawResponse, - ScheduleForStopResourceWithStreamingResponse, - AsyncScheduleForStopResourceWithStreamingResponse, -) -from .schedule_for_route import ( - ScheduleForRouteResource, - AsyncScheduleForRouteResource, - ScheduleForRouteResourceWithRawResponse, - AsyncScheduleForRouteResourceWithRawResponse, - ScheduleForRouteResourceWithStreamingResponse, - AsyncScheduleForRouteResourceWithStreamingResponse, -) -from .stops_for_location import ( - StopsForLocationResource, - AsyncStopsForLocationResource, - StopsForLocationResourceWithRawResponse, - AsyncStopsForLocationResourceWithRawResponse, - StopsForLocationResourceWithStreamingResponse, - AsyncStopsForLocationResourceWithStreamingResponse, -) -from .trips_for_location import ( - TripsForLocationResource, - AsyncTripsForLocationResource, - TripsForLocationResourceWithRawResponse, - AsyncTripsForLocationResourceWithRawResponse, - TripsForLocationResourceWithStreamingResponse, - AsyncTripsForLocationResourceWithStreamingResponse, -) -from .routes_for_location import ( - RoutesForLocationResource, - AsyncRoutesForLocationResource, - RoutesForLocationResourceWithRawResponse, - AsyncRoutesForLocationResourceWithRawResponse, - RoutesForLocationResourceWithStreamingResponse, - AsyncRoutesForLocationResourceWithStreamingResponse, -) -from .stop_ids_for_agency import ( - StopIDsForAgencyResource, - AsyncStopIDsForAgencyResource, - StopIDsForAgencyResourceWithRawResponse, - AsyncStopIDsForAgencyResourceWithRawResponse, - StopIDsForAgencyResourceWithStreamingResponse, - AsyncStopIDsForAgencyResourceWithStreamingResponse, -) -from .vehicles_for_agency import ( - VehiclesForAgencyResource, - AsyncVehiclesForAgencyResource, - VehiclesForAgencyResourceWithRawResponse, - AsyncVehiclesForAgencyResourceWithRawResponse, - VehiclesForAgencyResourceWithStreamingResponse, - AsyncVehiclesForAgencyResourceWithStreamingResponse, -) -from .route_ids_for_agency import ( - RouteIDsForAgencyResource, - AsyncRouteIDsForAgencyResource, - RouteIDsForAgencyResourceWithRawResponse, - AsyncRouteIDsForAgencyResourceWithRawResponse, - RouteIDsForAgencyResourceWithStreamingResponse, - AsyncRouteIDsForAgencyResourceWithStreamingResponse, -) -from .arrival_and_departure import ( - ArrivalAndDepartureResource, - AsyncArrivalAndDepartureResource, - ArrivalAndDepartureResourceWithRawResponse, - AsyncArrivalAndDepartureResourceWithRawResponse, - ArrivalAndDepartureResourceWithStreamingResponse, - AsyncArrivalAndDepartureResourceWithStreamingResponse, -) -from .agencies_with_coverage import ( - AgenciesWithCoverageResource, - AsyncAgenciesWithCoverageResource, - AgenciesWithCoverageResourceWithRawResponse, - AsyncAgenciesWithCoverageResourceWithRawResponse, - AgenciesWithCoverageResourceWithStreamingResponse, - AsyncAgenciesWithCoverageResourceWithStreamingResponse, -) -from .report_problem_with_stop import ( - ReportProblemWithStopResource, - AsyncReportProblemWithStopResource, - ReportProblemWithStopResourceWithRawResponse, - AsyncReportProblemWithStopResourceWithRawResponse, - ReportProblemWithStopResourceWithStreamingResponse, - AsyncReportProblemWithStopResourceWithStreamingResponse, -) -from .report_problem_with_trip import ( - ReportProblemWithTripResource, - AsyncReportProblemWithTripResource, - ReportProblemWithTripResourceWithRawResponse, - AsyncReportProblemWithTripResourceWithRawResponse, - ReportProblemWithTripResourceWithStreamingResponse, - AsyncReportProblemWithTripResourceWithStreamingResponse, -) +from .agencies_with_coverage import AgenciesWithCoverageResource, AsyncAgenciesWithCoverageResource +from .agencies_with_coverage import AgenciesWithCoverageResourceWithRawResponse, AsyncAgenciesWithCoverageResourceWithRawResponse, AgenciesWithCoverageResourceWithStreamingResponse, AsyncAgenciesWithCoverageResourceWithStreamingResponse +from .agency import AgencyResource, AsyncAgencyResource +from .agency import AgencyResourceWithRawResponse, AsyncAgencyResourceWithRawResponse, AgencyResourceWithStreamingResponse, AsyncAgencyResourceWithStreamingResponse +from .vehicles_for_agency import VehiclesForAgencyResource, AsyncVehiclesForAgencyResource +from .vehicles_for_agency import VehiclesForAgencyResourceWithRawResponse, AsyncVehiclesForAgencyResourceWithRawResponse, VehiclesForAgencyResourceWithStreamingResponse, AsyncVehiclesForAgencyResourceWithStreamingResponse +from .config import ConfigResource, AsyncConfigResource +from .config import ConfigResourceWithRawResponse, AsyncConfigResourceWithRawResponse, ConfigResourceWithStreamingResponse, AsyncConfigResourceWithStreamingResponse +from .current_time import CurrentTimeResource, AsyncCurrentTimeResource +from .current_time import CurrentTimeResourceWithRawResponse, AsyncCurrentTimeResourceWithRawResponse, CurrentTimeResourceWithStreamingResponse, AsyncCurrentTimeResourceWithStreamingResponse +from .stops_for_location import StopsForLocationResource, AsyncStopsForLocationResource +from .stops_for_location import StopsForLocationResourceWithRawResponse, AsyncStopsForLocationResourceWithRawResponse, StopsForLocationResourceWithStreamingResponse, AsyncStopsForLocationResourceWithStreamingResponse +from .stops_for_route import StopsForRouteResource, AsyncStopsForRouteResource +from .stops_for_route import StopsForRouteResourceWithRawResponse, AsyncStopsForRouteResourceWithRawResponse, StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse +from .stops_for_agency import StopsForAgencyResource, AsyncStopsForAgencyResource +from .stops_for_agency import StopsForAgencyResourceWithRawResponse, AsyncStopsForAgencyResourceWithRawResponse, StopsForAgencyResourceWithStreamingResponse, AsyncStopsForAgencyResourceWithStreamingResponse +from .stop import StopResource, AsyncStopResource +from .stop import StopResourceWithRawResponse, AsyncStopResourceWithRawResponse, StopResourceWithStreamingResponse, AsyncStopResourceWithStreamingResponse +from .stop_ids_for_agency import StopIDsForAgencyResource, AsyncStopIDsForAgencyResource +from .stop_ids_for_agency import StopIDsForAgencyResourceWithRawResponse, AsyncStopIDsForAgencyResourceWithRawResponse, StopIDsForAgencyResourceWithStreamingResponse, AsyncStopIDsForAgencyResourceWithStreamingResponse +from .schedule_for_stop import ScheduleForStopResource, AsyncScheduleForStopResource +from .schedule_for_stop import ScheduleForStopResourceWithRawResponse, AsyncScheduleForStopResourceWithRawResponse, ScheduleForStopResourceWithStreamingResponse, AsyncScheduleForStopResourceWithStreamingResponse +from .route import RouteResource, AsyncRouteResource +from .route import RouteResourceWithRawResponse, AsyncRouteResourceWithRawResponse, RouteResourceWithStreamingResponse, AsyncRouteResourceWithStreamingResponse +from .route_ids_for_agency import RouteIDsForAgencyResource, AsyncRouteIDsForAgencyResource +from .route_ids_for_agency import RouteIDsForAgencyResourceWithRawResponse, AsyncRouteIDsForAgencyResourceWithRawResponse, RouteIDsForAgencyResourceWithStreamingResponse, AsyncRouteIDsForAgencyResourceWithStreamingResponse +from .routes_for_location import RoutesForLocationResource, AsyncRoutesForLocationResource +from .routes_for_location import RoutesForLocationResourceWithRawResponse, AsyncRoutesForLocationResourceWithRawResponse, RoutesForLocationResourceWithStreamingResponse, AsyncRoutesForLocationResourceWithStreamingResponse +from .routes_for_agency import RoutesForAgencyResource, AsyncRoutesForAgencyResource +from .routes_for_agency import RoutesForAgencyResourceWithRawResponse, AsyncRoutesForAgencyResourceWithRawResponse, RoutesForAgencyResourceWithStreamingResponse, AsyncRoutesForAgencyResourceWithStreamingResponse +from .schedule_for_route import ScheduleForRouteResource, AsyncScheduleForRouteResource +from .schedule_for_route import ScheduleForRouteResourceWithRawResponse, AsyncScheduleForRouteResourceWithRawResponse, ScheduleForRouteResourceWithStreamingResponse, AsyncScheduleForRouteResourceWithStreamingResponse +from .arrival_and_departure import ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource +from .arrival_and_departure import ArrivalAndDepartureResourceWithRawResponse, AsyncArrivalAndDepartureResourceWithRawResponse, ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse +from .trip import TripResource, AsyncTripResource +from .trip import TripResourceWithRawResponse, AsyncTripResourceWithRawResponse, TripResourceWithStreamingResponse, AsyncTripResourceWithStreamingResponse +from .trips_for_location import TripsForLocationResource, AsyncTripsForLocationResource +from .trips_for_location import TripsForLocationResourceWithRawResponse, AsyncTripsForLocationResourceWithRawResponse, TripsForLocationResourceWithStreamingResponse, AsyncTripsForLocationResourceWithStreamingResponse +from .trip_details import TripDetailsResource, AsyncTripDetailsResource +from .trip_details import TripDetailsResourceWithRawResponse, AsyncTripDetailsResourceWithRawResponse, TripDetailsResourceWithStreamingResponse, AsyncTripDetailsResourceWithStreamingResponse +from .trip_for_vehicle import TripForVehicleResource, AsyncTripForVehicleResource +from .trip_for_vehicle import TripForVehicleResourceWithRawResponse, AsyncTripForVehicleResourceWithRawResponse, TripForVehicleResourceWithStreamingResponse, AsyncTripForVehicleResourceWithStreamingResponse +from .trips_for_route import TripsForRouteResource, AsyncTripsForRouteResource +from .trips_for_route import TripsForRouteResourceWithRawResponse, AsyncTripsForRouteResourceWithRawResponse, TripsForRouteResourceWithStreamingResponse, AsyncTripsForRouteResourceWithStreamingResponse +from .report_problem_with_stop import ReportProblemWithStopResource, AsyncReportProblemWithStopResource +from .report_problem_with_stop import ReportProblemWithStopResourceWithRawResponse, AsyncReportProblemWithStopResourceWithRawResponse, ReportProblemWithStopResourceWithStreamingResponse, AsyncReportProblemWithStopResourceWithStreamingResponse +from .report_problem_with_trip import ReportProblemWithTripResource, AsyncReportProblemWithTripResource +from .report_problem_with_trip import ReportProblemWithTripResourceWithRawResponse, AsyncReportProblemWithTripResourceWithRawResponse, ReportProblemWithTripResourceWithStreamingResponse, AsyncReportProblemWithTripResourceWithStreamingResponse +from .search_for_stop import SearchForStopResource, AsyncSearchForStopResource +from .search_for_stop import SearchForStopResourceWithRawResponse, AsyncSearchForStopResourceWithRawResponse, SearchForStopResourceWithStreamingResponse, AsyncSearchForStopResourceWithStreamingResponse +from .search_for_route import SearchForRouteResource, AsyncSearchForRouteResource +from .search_for_route import SearchForRouteResourceWithRawResponse, AsyncSearchForRouteResourceWithRawResponse, SearchForRouteResourceWithStreamingResponse, AsyncSearchForRouteResourceWithStreamingResponse +from .block import BlockResource, AsyncBlockResource +from .block import BlockResourceWithRawResponse, AsyncBlockResourceWithRawResponse, BlockResourceWithStreamingResponse, AsyncBlockResourceWithStreamingResponse +from .shape import ShapeResource, AsyncShapeResource +from .shape import ShapeResourceWithRawResponse, AsyncShapeResourceWithRawResponse, ShapeResourceWithStreamingResponse, AsyncShapeResourceWithStreamingResponse -__all__ = [ - "AgenciesWithCoverageResource", - "AsyncAgenciesWithCoverageResource", - "AgenciesWithCoverageResourceWithRawResponse", - "AsyncAgenciesWithCoverageResourceWithRawResponse", - "AgenciesWithCoverageResourceWithStreamingResponse", - "AsyncAgenciesWithCoverageResourceWithStreamingResponse", - "AgencyResource", - "AsyncAgencyResource", - "AgencyResourceWithRawResponse", - "AsyncAgencyResourceWithRawResponse", - "AgencyResourceWithStreamingResponse", - "AsyncAgencyResourceWithStreamingResponse", - "VehiclesForAgencyResource", - "AsyncVehiclesForAgencyResource", - "VehiclesForAgencyResourceWithRawResponse", - "AsyncVehiclesForAgencyResourceWithRawResponse", - "VehiclesForAgencyResourceWithStreamingResponse", - "AsyncVehiclesForAgencyResourceWithStreamingResponse", - "ConfigResource", - "AsyncConfigResource", - "ConfigResourceWithRawResponse", - "AsyncConfigResourceWithRawResponse", - "ConfigResourceWithStreamingResponse", - "AsyncConfigResourceWithStreamingResponse", - "CurrentTimeResource", - "AsyncCurrentTimeResource", - "CurrentTimeResourceWithRawResponse", - "AsyncCurrentTimeResourceWithRawResponse", - "CurrentTimeResourceWithStreamingResponse", - "AsyncCurrentTimeResourceWithStreamingResponse", - "StopsForLocationResource", - "AsyncStopsForLocationResource", - "StopsForLocationResourceWithRawResponse", - "AsyncStopsForLocationResourceWithRawResponse", - "StopsForLocationResourceWithStreamingResponse", - "AsyncStopsForLocationResourceWithStreamingResponse", - "StopsForRouteResource", - "AsyncStopsForRouteResource", - "StopsForRouteResourceWithRawResponse", - "AsyncStopsForRouteResourceWithRawResponse", - "StopsForRouteResourceWithStreamingResponse", - "AsyncStopsForRouteResourceWithStreamingResponse", - "StopsForAgencyResource", - "AsyncStopsForAgencyResource", - "StopsForAgencyResourceWithRawResponse", - "AsyncStopsForAgencyResourceWithRawResponse", - "StopsForAgencyResourceWithStreamingResponse", - "AsyncStopsForAgencyResourceWithStreamingResponse", - "StopResource", - "AsyncStopResource", - "StopResourceWithRawResponse", - "AsyncStopResourceWithRawResponse", - "StopResourceWithStreamingResponse", - "AsyncStopResourceWithStreamingResponse", - "StopIDsForAgencyResource", - "AsyncStopIDsForAgencyResource", - "StopIDsForAgencyResourceWithRawResponse", - "AsyncStopIDsForAgencyResourceWithRawResponse", - "StopIDsForAgencyResourceWithStreamingResponse", - "AsyncStopIDsForAgencyResourceWithStreamingResponse", - "ScheduleForStopResource", - "AsyncScheduleForStopResource", - "ScheduleForStopResourceWithRawResponse", - "AsyncScheduleForStopResourceWithRawResponse", - "ScheduleForStopResourceWithStreamingResponse", - "AsyncScheduleForStopResourceWithStreamingResponse", - "RouteResource", - "AsyncRouteResource", - "RouteResourceWithRawResponse", - "AsyncRouteResourceWithRawResponse", - "RouteResourceWithStreamingResponse", - "AsyncRouteResourceWithStreamingResponse", - "RouteIDsForAgencyResource", - "AsyncRouteIDsForAgencyResource", - "RouteIDsForAgencyResourceWithRawResponse", - "AsyncRouteIDsForAgencyResourceWithRawResponse", - "RouteIDsForAgencyResourceWithStreamingResponse", - "AsyncRouteIDsForAgencyResourceWithStreamingResponse", - "RoutesForLocationResource", - "AsyncRoutesForLocationResource", - "RoutesForLocationResourceWithRawResponse", - "AsyncRoutesForLocationResourceWithRawResponse", - "RoutesForLocationResourceWithStreamingResponse", - "AsyncRoutesForLocationResourceWithStreamingResponse", - "RoutesForAgencyResource", - "AsyncRoutesForAgencyResource", - "RoutesForAgencyResourceWithRawResponse", - "AsyncRoutesForAgencyResourceWithRawResponse", - "RoutesForAgencyResourceWithStreamingResponse", - "AsyncRoutesForAgencyResourceWithStreamingResponse", - "ScheduleForRouteResource", - "AsyncScheduleForRouteResource", - "ScheduleForRouteResourceWithRawResponse", - "AsyncScheduleForRouteResourceWithRawResponse", - "ScheduleForRouteResourceWithStreamingResponse", - "AsyncScheduleForRouteResourceWithStreamingResponse", - "ArrivalAndDepartureResource", - "AsyncArrivalAndDepartureResource", - "ArrivalAndDepartureResourceWithRawResponse", - "AsyncArrivalAndDepartureResourceWithRawResponse", - "ArrivalAndDepartureResourceWithStreamingResponse", - "AsyncArrivalAndDepartureResourceWithStreamingResponse", - "TripResource", - "AsyncTripResource", - "TripResourceWithRawResponse", - "AsyncTripResourceWithRawResponse", - "TripResourceWithStreamingResponse", - "AsyncTripResourceWithStreamingResponse", - "TripsForLocationResource", - "AsyncTripsForLocationResource", - "TripsForLocationResourceWithRawResponse", - "AsyncTripsForLocationResourceWithRawResponse", - "TripsForLocationResourceWithStreamingResponse", - "AsyncTripsForLocationResourceWithStreamingResponse", - "TripDetailsResource", - "AsyncTripDetailsResource", - "TripDetailsResourceWithRawResponse", - "AsyncTripDetailsResourceWithRawResponse", - "TripDetailsResourceWithStreamingResponse", - "AsyncTripDetailsResourceWithStreamingResponse", - "TripForVehicleResource", - "AsyncTripForVehicleResource", - "TripForVehicleResourceWithRawResponse", - "AsyncTripForVehicleResourceWithRawResponse", - "TripForVehicleResourceWithStreamingResponse", - "AsyncTripForVehicleResourceWithStreamingResponse", - "TripsForRouteResource", - "AsyncTripsForRouteResource", - "TripsForRouteResourceWithRawResponse", - "AsyncTripsForRouteResourceWithRawResponse", - "TripsForRouteResourceWithStreamingResponse", - "AsyncTripsForRouteResourceWithStreamingResponse", - "ReportProblemWithStopResource", - "AsyncReportProblemWithStopResource", - "ReportProblemWithStopResourceWithRawResponse", - "AsyncReportProblemWithStopResourceWithRawResponse", - "ReportProblemWithStopResourceWithStreamingResponse", - "AsyncReportProblemWithStopResourceWithStreamingResponse", - "ReportProblemWithTripResource", - "AsyncReportProblemWithTripResource", - "ReportProblemWithTripResourceWithRawResponse", - "AsyncReportProblemWithTripResourceWithRawResponse", - "ReportProblemWithTripResourceWithStreamingResponse", - "AsyncReportProblemWithTripResourceWithStreamingResponse", - "SearchForStopResource", - "AsyncSearchForStopResource", - "SearchForStopResourceWithRawResponse", - "AsyncSearchForStopResourceWithRawResponse", - "SearchForStopResourceWithStreamingResponse", - "AsyncSearchForStopResourceWithStreamingResponse", - "SearchForRouteResource", - "AsyncSearchForRouteResource", - "SearchForRouteResourceWithRawResponse", - "AsyncSearchForRouteResourceWithRawResponse", - "SearchForRouteResourceWithStreamingResponse", - "AsyncSearchForRouteResourceWithStreamingResponse", - "BlockResource", - "AsyncBlockResource", - "BlockResourceWithRawResponse", - "AsyncBlockResourceWithRawResponse", - "BlockResourceWithStreamingResponse", - "AsyncBlockResourceWithStreamingResponse", - "ShapeResource", - "AsyncShapeResource", - "ShapeResourceWithRawResponse", - "AsyncShapeResourceWithRawResponse", - "ShapeResourceWithStreamingResponse", - "AsyncShapeResourceWithStreamingResponse", -] +__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource", "AgenciesWithCoverageResourceWithRawResponse", "AsyncAgenciesWithCoverageResourceWithRawResponse", "AgenciesWithCoverageResourceWithStreamingResponse", "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", "AsyncAgencyResourceWithRawResponse", "AgencyResourceWithStreamingResponse", "AsyncAgencyResourceWithStreamingResponse", "VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource", "VehiclesForAgencyResourceWithRawResponse", "AsyncVehiclesForAgencyResourceWithRawResponse", "VehiclesForAgencyResourceWithStreamingResponse", "AsyncVehiclesForAgencyResourceWithStreamingResponse", "ConfigResource", "AsyncConfigResource", "ConfigResourceWithRawResponse", "AsyncConfigResourceWithRawResponse", "ConfigResourceWithStreamingResponse", "AsyncConfigResourceWithStreamingResponse", "CurrentTimeResource", "AsyncCurrentTimeResource", "CurrentTimeResourceWithRawResponse", "AsyncCurrentTimeResourceWithRawResponse", "CurrentTimeResourceWithStreamingResponse", "AsyncCurrentTimeResourceWithStreamingResponse", "StopsForLocationResource", "AsyncStopsForLocationResource", "StopsForLocationResourceWithRawResponse", "AsyncStopsForLocationResourceWithRawResponse", "StopsForLocationResourceWithStreamingResponse", "AsyncStopsForLocationResourceWithStreamingResponse", "StopsForRouteResource", "AsyncStopsForRouteResource", "StopsForRouteResourceWithRawResponse", "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", "StopsForAgencyResource", "AsyncStopsForAgencyResource", "StopsForAgencyResourceWithRawResponse", "AsyncStopsForAgencyResourceWithRawResponse", "StopsForAgencyResourceWithStreamingResponse", "AsyncStopsForAgencyResourceWithStreamingResponse", "StopResource", "AsyncStopResource", "StopResourceWithRawResponse", "AsyncStopResourceWithRawResponse", "StopResourceWithStreamingResponse", "AsyncStopResourceWithStreamingResponse", "StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource", "StopIDsForAgencyResourceWithRawResponse", "AsyncStopIDsForAgencyResourceWithRawResponse", "StopIDsForAgencyResourceWithStreamingResponse", "AsyncStopIDsForAgencyResourceWithStreamingResponse", "ScheduleForStopResource", "AsyncScheduleForStopResource", "ScheduleForStopResourceWithRawResponse", "AsyncScheduleForStopResourceWithRawResponse", "ScheduleForStopResourceWithStreamingResponse", "AsyncScheduleForStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", "AsyncRouteResourceWithRawResponse", "RouteResourceWithStreamingResponse", "AsyncRouteResourceWithStreamingResponse", "RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource", "RouteIDsForAgencyResourceWithRawResponse", "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", "RoutesForLocationResource", "AsyncRoutesForLocationResource", "RoutesForLocationResourceWithRawResponse", "AsyncRoutesForLocationResourceWithRawResponse", "RoutesForLocationResourceWithStreamingResponse", "AsyncRoutesForLocationResourceWithStreamingResponse", "RoutesForAgencyResource", "AsyncRoutesForAgencyResource", "RoutesForAgencyResourceWithRawResponse", "AsyncRoutesForAgencyResourceWithRawResponse", "RoutesForAgencyResourceWithStreamingResponse", "AsyncRoutesForAgencyResourceWithStreamingResponse", "ScheduleForRouteResource", "AsyncScheduleForRouteResource", "ScheduleForRouteResourceWithRawResponse", "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", "AsyncArrivalAndDepartureResourceWithRawResponse", "ArrivalAndDepartureResourceWithStreamingResponse", "AsyncArrivalAndDepartureResourceWithStreamingResponse", "TripResource", "AsyncTripResource", "TripResourceWithRawResponse", "AsyncTripResourceWithRawResponse", "TripResourceWithStreamingResponse", "AsyncTripResourceWithStreamingResponse", "TripsForLocationResource", "AsyncTripsForLocationResource", "TripsForLocationResourceWithRawResponse", "AsyncTripsForLocationResourceWithRawResponse", "TripsForLocationResourceWithStreamingResponse", "AsyncTripsForLocationResourceWithStreamingResponse", "TripDetailsResource", "AsyncTripDetailsResource", "TripDetailsResourceWithRawResponse", "AsyncTripDetailsResourceWithRawResponse", "TripDetailsResourceWithStreamingResponse", "AsyncTripDetailsResourceWithStreamingResponse", "TripForVehicleResource", "AsyncTripForVehicleResource", "TripForVehicleResourceWithRawResponse", "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", "TripsForRouteResource", "AsyncTripsForRouteResource", "TripsForRouteResourceWithRawResponse", "AsyncTripsForRouteResourceWithRawResponse", "TripsForRouteResourceWithStreamingResponse", "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", "ReportProblemWithTripResource", "AsyncReportProblemWithTripResource", "ReportProblemWithTripResourceWithRawResponse", "AsyncReportProblemWithTripResourceWithRawResponse", "ReportProblemWithTripResourceWithStreamingResponse", "AsyncReportProblemWithTripResourceWithStreamingResponse", "SearchForStopResource", "AsyncSearchForStopResource", "SearchForStopResourceWithRawResponse", "AsyncSearchForStopResourceWithRawResponse", "SearchForStopResourceWithStreamingResponse", "AsyncSearchForStopResourceWithStreamingResponse", "SearchForRouteResource", "AsyncSearchForRouteResource", "SearchForRouteResourceWithRawResponse", "AsyncSearchForRouteResourceWithRawResponse", "SearchForRouteResourceWithStreamingResponse", "AsyncSearchForRouteResourceWithStreamingResponse", "BlockResource", "AsyncBlockResource", "BlockResourceWithRawResponse", "AsyncBlockResourceWithRawResponse", "BlockResourceWithStreamingResponse", "AsyncBlockResourceWithStreamingResponse", "ShapeResource", "AsyncShapeResource", "ShapeResourceWithRawResponse", "AsyncShapeResourceWithRawResponse", "ShapeResourceWithStreamingResponse", "AsyncShapeResourceWithStreamingResponse"] \ No newline at end of file diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index f543a88..2fa6042 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse -__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] class AgenciesWithCoverageResource(SyncAPIResource): @cached_property @@ -39,29 +41,24 @@ def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingRe """ return AgenciesWithCoverageResourceWithStreamingResponse(self) - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageListResponse: + def list(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgenciesWithCoverageListResponse, ) - class AsyncAgenciesWithCoverageResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: @@ -82,29 +79,24 @@ def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStream """ return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - async def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageListResponse: + async def list(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return await self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgenciesWithCoverageListResponse, ) - class AgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -113,7 +105,6 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) - class AsyncAgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -122,7 +113,6 @@ def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> agencies_with_coverage.list, ) - class AgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -131,11 +121,10 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) - class AsyncAgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage self.list = async_to_streamed_response_wrapper( agencies_with_coverage.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 9141792..2d8da26 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.agency_retrieve_response import AgencyRetrieveResponse -__all__ = ["AgencyResource", "AsyncAgencyResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["AgencyResource", "AsyncAgencyResource"] class AgencyResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> AgencyResourceWithStreamingResponse: """ return AgencyResourceWithStreamingResponse(self) - def retrieve( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgencyRetrieveResponse: + def retrieve(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgencyRetrieveResponse, ) - class AsyncAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgencyResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncAgencyResourceWithStreamingResponse: """ return AsyncAgencyResourceWithStreamingResponse(self) - async def retrieve( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgencyRetrieveResponse: + async def retrieve(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgencyRetrieveResponse, ) - class AgencyResourceWithRawResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -135,7 +131,6 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) - class AsyncAgencyResourceWithRawResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency @@ -144,7 +139,6 @@ def __init__(self, agency: AsyncAgencyResource) -> None: agency.retrieve, ) - class AgencyResourceWithStreamingResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -153,11 +147,10 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) - class AsyncAgencyResourceWithStreamingResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency self.retrieve = async_to_streamed_response_wrapper( agency.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 8323a51..7bba1a2 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -2,31 +2,34 @@ from __future__ import annotations -from typing import Union -from datetime import datetime - import httpx -from ..types import arrival_and_departure_list_params, arrival_and_departure_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) + +from ..types.arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse + from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + from ..types.arrival_and_departure_list_response import ArrivalAndDepartureListResponse -from ..types.arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse -__all__ = ["ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource"] +from typing import Union +from datetime import datetime + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import arrival_and_departure_retrieve_params +from ..types import arrival_and_departure_list_params + +__all__ = ["ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource"] class ArrivalAndDepartureResource(SyncAPIResource): @cached_property @@ -48,22 +51,20 @@ def with_streaming_response(self) -> ArrivalAndDepartureResourceWithStreamingRes """ return ArrivalAndDepartureResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -77,42 +78,33 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, - arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), cast_to=ArrivalAndDepartureRetrieveResponse, ) - def list( - self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureListResponse: + def list(self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -132,27 +124,19 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, - arrival_and_departure_list_params.ArrivalAndDepartureListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), cast_to=ArrivalAndDepartureListResponse, ) - class AsyncArrivalAndDepartureResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncArrivalAndDepartureResourceWithRawResponse: @@ -173,22 +157,20 @@ def with_streaming_response(self) -> AsyncArrivalAndDepartureResourceWithStreami """ return AsyncArrivalAndDepartureResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -202,42 +184,33 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, - arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), cast_to=ArrivalAndDepartureRetrieveResponse, ) - async def list( - self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureListResponse: + async def list(self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -257,27 +230,19 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, - arrival_and_departure_list_params.ArrivalAndDepartureListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), cast_to=ArrivalAndDepartureListResponse, ) - class ArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -289,7 +254,6 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) - class AsyncArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -301,7 +265,6 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N arrival_and_departure.list, ) - class ArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -313,7 +276,6 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) - class AsyncArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -323,4 +285,4 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N ) self.list = async_to_streamed_response_wrapper( arrival_and_departure.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index cbee583..ec955eb 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.block_retrieve_response import BlockRetrieveResponse -__all__ = ["BlockResource", "AsyncBlockResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["BlockResource", "AsyncBlockResource"] class BlockResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> BlockResourceWithStreamingResponse: """ return BlockResourceWithStreamingResponse(self) - def retrieve( - self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BlockRetrieveResponse: + def retrieve(self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + raise ValueError( + f'Expected a non-empty value for `block_id` but received {block_id!r}' + ) return self._get( f"/api/where/block/{block_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=BlockRetrieveResponse, ) - class AsyncBlockResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncBlockResourceWithStreamingResponse: """ return AsyncBlockResourceWithStreamingResponse(self) - async def retrieve( - self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BlockRetrieveResponse: + async def retrieve(self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + raise ValueError( + f'Expected a non-empty value for `block_id` but received {block_id!r}' + ) return await self._get( f"/api/where/block/{block_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=BlockRetrieveResponse, ) - class BlockResourceWithRawResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -135,7 +131,6 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) - class AsyncBlockResourceWithRawResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block @@ -144,7 +139,6 @@ def __init__(self, block: AsyncBlockResource) -> None: block.retrieve, ) - class BlockResourceWithStreamingResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -153,11 +147,10 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) - class AsyncBlockResourceWithStreamingResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block self.retrieve = async_to_streamed_response_wrapper( block.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 4b3de23..29269b8 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.config_retrieve_response import ConfigRetrieveResponse -__all__ = ["ConfigResource", "AsyncConfigResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["ConfigResource", "AsyncConfigResource"] class ConfigResource(SyncAPIResource): @cached_property @@ -39,26 +41,21 @@ def with_streaming_response(self) -> ConfigResourceWithStreamingResponse: """ return ConfigResourceWithStreamingResponse(self) - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigRetrieveResponse: + def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: """config""" return self._get( "/api/where/config.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ConfigRetrieveResponse, ) - class AsyncConfigResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: @@ -79,26 +76,21 @@ def with_streaming_response(self) -> AsyncConfigResourceWithStreamingResponse: """ return AsyncConfigResourceWithStreamingResponse(self) - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigRetrieveResponse: + async def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: """config""" return await self._get( "/api/where/config.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ConfigRetrieveResponse, ) - class ConfigResourceWithRawResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -107,7 +99,6 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) - class AsyncConfigResourceWithRawResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config @@ -116,7 +107,6 @@ def __init__(self, config: AsyncConfigResource) -> None: config.retrieve, ) - class ConfigResourceWithStreamingResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -125,11 +115,10 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) - class AsyncConfigResourceWithStreamingResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config self.retrieve = async_to_streamed_response_wrapper( config.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 1dcc9a8..5dfc9bc 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.current_time_retrieve_response import CurrentTimeRetrieveResponse -__all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] class CurrentTimeResource(SyncAPIResource): @cached_property @@ -39,26 +41,21 @@ def with_streaming_response(self) -> CurrentTimeResourceWithStreamingResponse: """ return CurrentTimeResourceWithStreamingResponse(self) - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CurrentTimeRetrieveResponse: + def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: """current-time""" return self._get( "/api/where/current-time.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=CurrentTimeRetrieveResponse, ) - class AsyncCurrentTimeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCurrentTimeResourceWithRawResponse: @@ -79,26 +76,21 @@ def with_streaming_response(self) -> AsyncCurrentTimeResourceWithStreamingRespon """ return AsyncCurrentTimeResourceWithStreamingResponse(self) - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CurrentTimeRetrieveResponse: + async def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: """current-time""" return await self._get( "/api/where/current-time.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=CurrentTimeRetrieveResponse, ) - class CurrentTimeResourceWithRawResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -107,7 +99,6 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) - class AsyncCurrentTimeResourceWithRawResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time @@ -116,7 +107,6 @@ def __init__(self, current_time: AsyncCurrentTimeResource) -> None: current_time.retrieve, ) - class CurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -125,11 +115,10 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) - class AsyncCurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time self.retrieve = async_to_streamed_response_wrapper( current_time.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index d1614f6..34f4c72 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -2,29 +2,29 @@ from __future__ import annotations -from typing_extensions import Literal - import httpx -from ..types import report_problem_with_stop_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.shared.response_wrapper import ResponseWrapper -__all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from typing_extensions import Literal +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import report_problem_with_stop_retrieve_params + +__all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] class ReportProblemWithStopResource(SyncAPIResource): @cached_property @@ -46,23 +46,20 @@ def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingR """ return ReportProblemWithStopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + def retrieve(self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -86,29 +83,21 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, - report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), cast_to=ResponseWrapper, ) - class AsyncReportProblemWithStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: @@ -129,23 +118,20 @@ def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStrea """ return AsyncReportProblemWithStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + async def retrieve(self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -169,29 +155,21 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, - report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), cast_to=ResponseWrapper, ) - class ReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -200,7 +178,6 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) - class AsyncReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -209,7 +186,6 @@ def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) report_problem_with_stop.retrieve, ) - class ReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -218,11 +194,10 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) - class AsyncReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop self.retrieve = async_to_streamed_response_wrapper( report_problem_with_stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index d0f9733..668f903 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -2,29 +2,29 @@ from __future__ import annotations -from typing_extensions import Literal - import httpx -from ..types import report_problem_with_trip_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.shared.response_wrapper import ResponseWrapper -__all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from typing_extensions import Literal +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import report_problem_with_trip_retrieve_params + +__all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] class ReportProblemWithTripResource(SyncAPIResource): @cached_property @@ -46,35 +46,25 @@ def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingR """ return ReportProblemWithTripResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + def retrieve(self, + trip_id: str, + *, + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -108,34 +98,26 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, - report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), cast_to=ResponseWrapper, ) - class AsyncReportProblemWithTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: @@ -156,35 +138,25 @@ def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStrea """ return AsyncReportProblemWithTripResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + async def retrieve(self, + trip_id: str, + *, + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -218,34 +190,26 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, - report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), cast_to=ResponseWrapper, ) - class ReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -254,7 +218,6 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) - class AsyncReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -263,7 +226,6 @@ def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) report_problem_with_trip.retrieve, ) - class ReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -272,11 +234,10 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) - class AsyncReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip self.retrieve = async_to_streamed_response_wrapper( report_problem_with_trip.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 62ae14a..5b420e8 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.route_retrieve_response import RouteRetrieveResponse -__all__ = ["RouteResource", "AsyncRouteResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["RouteResource", "AsyncRouteResource"] class RouteResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> RouteResourceWithStreamingResponse: """ return RouteResourceWithStreamingResponse(self) - def retrieve( - self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteRetrieveResponse: + def retrieve(self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteRetrieveResponse, ) - class AsyncRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncRouteResourceWithStreamingResponse: """ return AsyncRouteResourceWithStreamingResponse(self) - async def retrieve( - self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteRetrieveResponse: + async def retrieve(self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteRetrieveResponse, ) - class RouteResourceWithRawResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -135,7 +131,6 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) - class AsyncRouteResourceWithRawResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route @@ -144,7 +139,6 @@ def __init__(self, route: AsyncRouteResource) -> None: route.retrieve, ) - class RouteResourceWithStreamingResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -153,11 +147,10 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) - class AsyncRouteResourceWithStreamingResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route self.retrieve = async_to_streamed_response_wrapper( route.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index e5ddfa3..6f21ee9 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.route_ids_for_agency_list_response import RouteIDsForAgencyListResponse -__all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] class RouteIDsForAgencyResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> RouteIDsForAgencyResourceWithStreamingRespo """ return RouteIDsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteIDsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -63,16 +63,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteIDsForAgencyListResponse, ) - class AsyncRouteIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncRouteIDsForAgencyResourceWithStreaming """ return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteIDsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -117,16 +114,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteIDsForAgencyListResponse, ) - class RouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -135,7 +131,6 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) - class AsyncRouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -144,7 +139,6 @@ def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None route_ids_for_agency.list, ) - class RouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -153,11 +147,10 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) - class AsyncRouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency self.list = async_to_streamed_response_wrapper( route_ids_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index ff7a8cd..dd9306e 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.routes_for_agency_list_response import RoutesForAgencyListResponse -__all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] class RoutesForAgencyResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> RoutesForAgencyResourceWithStreamingRespons """ return RoutesForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -63,16 +63,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RoutesForAgencyListResponse, ) - class AsyncRoutesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncRoutesForAgencyResourceWithStreamingRe """ return AsyncRoutesForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -117,16 +114,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RoutesForAgencyListResponse, ) - class RoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -135,7 +131,6 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) - class AsyncRoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -144,7 +139,6 @@ def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: routes_for_agency.list, ) - class RoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -153,11 +147,10 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) - class AsyncRoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency self.list = async_to_streamed_response_wrapper( routes_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index d315909..7743b84 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,25 +4,25 @@ import httpx -from ..types import routes_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.routes_for_location_list_response import RoutesForLocationListResponse -__all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import routes_for_location_list_params +__all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] class RoutesForLocationResource(SyncAPIResource): @cached_property @@ -44,22 +44,20 @@ def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingRespo """ return RoutesForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationListResponse: + def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: """ routes-for-location @@ -74,27 +72,17 @@ def list( """ return self._get( "/api/where/routes-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - routes_for_location_list_params.RoutesForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, routes_for_location_list_params.RoutesForLocationListParams)), cast_to=RoutesForLocationListResponse, ) - class AsyncRoutesForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: @@ -115,22 +103,20 @@ def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreaming """ return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationListResponse: + async def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: """ routes-for-location @@ -145,27 +131,17 @@ async def list( """ return await self._get( "/api/where/routes-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - routes_for_location_list_params.RoutesForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, routes_for_location_list_params.RoutesForLocationListParams)), cast_to=RoutesForLocationListResponse, ) - class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -174,7 +150,6 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) - class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -183,7 +158,6 @@ def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: routes_for_location.list, ) - class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -192,11 +166,10 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) - class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location self.list = async_to_streamed_response_wrapper( routes_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 3d5509d..66c6a54 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -2,30 +2,31 @@ from __future__ import annotations -from typing import Union -from datetime import date - import httpx -from ..types import schedule_for_route_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse -__all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform +from datetime import date + +from typing import Union + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import schedule_for_route_retrieve_params + +__all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] class ScheduleForRouteResource(SyncAPIResource): @cached_property @@ -47,18 +48,16 @@ def with_streaming_response(self) -> ScheduleForRouteResourceWithStreamingRespon """ return ScheduleForRouteResourceWithStreamingResponse(self) - def retrieve( - self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForRouteRetrieveResponse: + def retrieve(self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -75,22 +74,17 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "date": date + }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), cast_to=ScheduleForRouteRetrieveResponse, ) - class AsyncScheduleForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: @@ -111,18 +105,16 @@ def with_streaming_response(self) -> AsyncScheduleForRouteResourceWithStreamingR """ return AsyncScheduleForRouteResourceWithStreamingResponse(self) - async def retrieve( - self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForRouteRetrieveResponse: + async def retrieve(self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -139,22 +131,17 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "date": date + }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), cast_to=ScheduleForRouteRetrieveResponse, ) - class ScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -163,7 +150,6 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class AsyncScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -172,7 +158,6 @@ def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class ScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -181,11 +166,10 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class AsyncScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route self.retrieve = async_to_streamed_response_wrapper( schedule_for_route.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 78b4d36..5c71e9c 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -2,30 +2,31 @@ from __future__ import annotations -from typing import Union -from datetime import date - import httpx -from ..types import schedule_for_stop_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse -__all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform +from datetime import date + +from typing import Union + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import schedule_for_stop_retrieve_params + +__all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] class ScheduleForStopResource(SyncAPIResource): @cached_property @@ -47,18 +48,16 @@ def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingRespons """ return ScheduleForStopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForStopRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -75,20 +74,17 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "date": date + }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), cast_to=ScheduleForStopRetrieveResponse, ) - class AsyncScheduleForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: @@ -109,18 +105,16 @@ def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingRe """ return AsyncScheduleForStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForStopRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -137,22 +131,17 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "date": date + }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), cast_to=ScheduleForStopRetrieveResponse, ) - class ScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -161,7 +150,6 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class AsyncScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -170,7 +158,6 @@ def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class ScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -179,11 +166,10 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class AsyncScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop self.retrieve = async_to_streamed_response_wrapper( schedule_for_stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index fe1d9a2..37f7cb4 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -4,25 +4,25 @@ import httpx -from ..types import search_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.search_for_route_list_response import SearchForRouteListResponse -__all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import search_for_route_list_params +__all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] class SearchForRouteResource(SyncAPIResource): @cached_property @@ -44,18 +44,16 @@ def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse """ return SearchForRouteResourceWithStreamingResponse(self) - def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteListResponse: + def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -74,23 +72,13 @@ def list( """ return self._get( "/api/where/search/route.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_route_list_params.SearchForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_route_list_params.SearchForRouteListParams)), cast_to=SearchForRouteListResponse, ) - class AsyncSearchForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: @@ -111,18 +99,16 @@ def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingRes """ return AsyncSearchForRouteResourceWithStreamingResponse(self) - async def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteListResponse: + async def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -141,23 +127,13 @@ async def list( """ return await self._get( "/api/where/search/route.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_route_list_params.SearchForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_route_list_params.SearchForRouteListParams)), cast_to=SearchForRouteListResponse, ) - class SearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -166,7 +142,6 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) - class AsyncSearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -175,7 +150,6 @@ def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: search_for_route.list, ) - class SearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -184,11 +158,10 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) - class AsyncSearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route self.list = async_to_streamed_response_wrapper( search_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 8efb8ad..a0320a3 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -4,25 +4,25 @@ import httpx -from ..types import search_for_stop_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.search_for_stop_list_response import SearchForStopListResponse -__all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import search_for_stop_list_params +__all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] class SearchForStopResource(SyncAPIResource): @cached_property @@ -44,18 +44,16 @@ def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: """ return SearchForStopResourceWithStreamingResponse(self) - def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopListResponse: + def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -74,23 +72,13 @@ def list( """ return self._get( "/api/where/search/stop.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_stop_list_params.SearchForStopListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_stop_list_params.SearchForStopListParams)), cast_to=SearchForStopListResponse, ) - class AsyncSearchForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: @@ -111,18 +99,16 @@ def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResp """ return AsyncSearchForStopResourceWithStreamingResponse(self) - async def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopListResponse: + async def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -141,23 +127,13 @@ async def list( """ return await self._get( "/api/where/search/stop.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_stop_list_params.SearchForStopListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_stop_list_params.SearchForStopListParams)), cast_to=SearchForStopListResponse, ) - class SearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -166,7 +142,6 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) - class AsyncSearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -175,7 +150,6 @@ def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: search_for_stop.list, ) - class SearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -184,11 +158,10 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) - class AsyncSearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop self.list = async_to_streamed_response_wrapper( search_for_stop.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 0b4c291..ddc989f 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.shape_retrieve_response import ShapeRetrieveResponse -__all__ = ["ShapeResource", "AsyncShapeResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["ShapeResource", "AsyncShapeResource"] class ShapeResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> ShapeResourceWithStreamingResponse: """ return ShapeResourceWithStreamingResponse(self) - def retrieve( - self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ShapeRetrieveResponse: + def retrieve(self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + raise ValueError( + f'Expected a non-empty value for `shape_id` but received {shape_id!r}' + ) return self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ShapeRetrieveResponse, ) - class AsyncShapeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncShapeResourceWithStreamingResponse: """ return AsyncShapeResourceWithStreamingResponse(self) - async def retrieve( - self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ShapeRetrieveResponse: + async def retrieve(self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + raise ValueError( + f'Expected a non-empty value for `shape_id` but received {shape_id!r}' + ) return await self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ShapeRetrieveResponse, ) - class ShapeResourceWithRawResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -135,7 +131,6 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) - class AsyncShapeResourceWithRawResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape @@ -144,7 +139,6 @@ def __init__(self, shape: AsyncShapeResource) -> None: shape.retrieve, ) - class ShapeResourceWithStreamingResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -153,11 +147,10 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) - class AsyncShapeResourceWithStreamingResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape self.retrieve = async_to_streamed_response_wrapper( shape.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 502f8ce..ba53226 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.stop_retrieve_response import StopRetrieveResponse -__all__ = ["StopResource", "AsyncStopResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["StopResource", "AsyncStopResource"] class StopResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> StopResourceWithStreamingResponse: """ return StopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: """ Get details of a specific stop @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopRetrieveResponse, ) - class AsyncStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse: """ return AsyncStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: """ Get details of a specific stop @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopRetrieveResponse, ) - class StopResourceWithRawResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -135,7 +131,6 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) - class AsyncStopResourceWithRawResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop @@ -144,7 +139,6 @@ def __init__(self, stop: AsyncStopResource) -> None: stop.retrieve, ) - class StopResourceWithStreamingResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -153,11 +147,10 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) - class AsyncStopResourceWithStreamingResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop self.retrieve = async_to_streamed_response_wrapper( stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 3850d16..55a39cd 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.stop_ids_for_agency_list_response import StopIDsForAgencyListResponse -__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] class StopIDsForAgencyResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingRespon """ return StopIDsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopIDsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -63,16 +63,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopIDsForAgencyListResponse, ) - class AsyncStopIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingR """ return AsyncStopIDsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopIDsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -117,16 +114,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopIDsForAgencyListResponse, ) - class StopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -135,7 +131,6 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class AsyncStopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -144,7 +139,6 @@ def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class StopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -153,11 +147,10 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class AsyncStopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency self.list = async_to_streamed_response_wrapper( stop_ids_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 834ab5c..9e09796 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.stops_for_agency_list_response import StopsForAgencyListResponse -__all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] class StopsForAgencyResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> StopsForAgencyResourceWithStreamingResponse """ return StopsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -63,16 +63,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopsForAgencyListResponse, ) - class AsyncStopsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForAgencyResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncStopsForAgencyResourceWithStreamingRes """ return AsyncStopsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -117,16 +114,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopsForAgencyListResponse, ) - class StopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -135,7 +131,6 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) - class AsyncStopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -144,7 +139,6 @@ def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: stops_for_agency.list, ) - class StopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -153,11 +147,10 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) - class AsyncStopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency self.list = async_to_streamed_response_wrapper( stops_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 80322e3..b589d59 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,25 +4,25 @@ import httpx -from ..types import stops_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.stops_for_location_list_response import StopsForLocationListResponse -__all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import stops_for_location_list_params +__all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] class StopsForLocationResource(SyncAPIResource): @cached_property @@ -44,22 +44,20 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon """ return StopsForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationListResponse: + def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: """ stops-for-location @@ -82,27 +80,17 @@ def list( """ return self._get( "/api/where/stops-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - stops_for_location_list_params.StopsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, stops_for_location_list_params.StopsForLocationListParams)), cast_to=StopsForLocationListResponse, ) - class AsyncStopsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: @@ -123,22 +111,20 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR """ return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationListResponse: + async def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: """ stops-for-location @@ -161,27 +147,17 @@ async def list( """ return await self._get( "/api/where/stops-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - stops_for_location_list_params.StopsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, stops_for_location_list_params.StopsForLocationListParams)), cast_to=StopsForLocationListResponse, ) - class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -190,7 +166,6 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) - class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -199,7 +174,6 @@ def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: stops_for_location.list, ) - class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -208,11 +182,10 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) - class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location self.list = async_to_streamed_response_wrapper( stops_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 36f7514..454b725 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -4,25 +4,25 @@ import httpx -from ..types import stops_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.stops_for_route_list_response import StopsForRouteListResponse -__all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import stops_for_route_list_params +__all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] class StopsForRouteResource(SyncAPIResource): @cached_property @@ -44,19 +44,17 @@ def with_streaming_response(self) -> StopsForRouteResourceWithStreamingResponse: """ return StopsForRouteResourceWithStreamingResponse(self) - def list( - self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForRouteListResponse: + def list(self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -74,26 +72,18 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_polylines": include_polylines, - "time": time, - }, - stops_for_route_list_params.StopsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_polylines": include_polylines, + "time": time, + }, stops_for_route_list_params.StopsForRouteListParams)), cast_to=StopsForRouteListResponse, ) - class AsyncStopsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse: @@ -114,19 +104,17 @@ def with_streaming_response(self) -> AsyncStopsForRouteResourceWithStreamingResp """ return AsyncStopsForRouteResourceWithStreamingResponse(self) - async def list( - self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForRouteListResponse: + async def list(self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -144,26 +132,18 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_polylines": include_polylines, - "time": time, - }, - stops_for_route_list_params.StopsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_polylines": include_polylines, + "time": time, + }, stops_for_route_list_params.StopsForRouteListParams)), cast_to=StopsForRouteListResponse, ) - class StopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -172,7 +152,6 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) - class AsyncStopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -181,7 +160,6 @@ def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: stops_for_route.list, ) - class StopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -190,11 +168,10 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) - class AsyncStopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route self.list = async_to_streamed_response_wrapper( stops_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index 9b7e137..e5a9bb5 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -4,20 +4,22 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.trip_retrieve_response import TripRetrieveResponse -__all__ = ["TripResource", "AsyncTripResource"] +from .._base_client import make_request_options + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params + +__all__ = ["TripResource", "AsyncTripResource"] class TripResource(SyncAPIResource): @cached_property @@ -39,17 +41,15 @@ def with_streaming_response(self) -> TripResourceWithStreamingResponse: """ return TripResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripRetrieveResponse: + def retrieve(self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: """ Get details of a specific trip @@ -63,16 +63,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=TripRetrieveResponse, ) - class AsyncTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripResourceWithRawResponse: @@ -93,17 +92,15 @@ def with_streaming_response(self) -> AsyncTripResourceWithStreamingResponse: """ return AsyncTripResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripRetrieveResponse: + async def retrieve(self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: """ Get details of a specific trip @@ -117,16 +114,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=TripRetrieveResponse, ) - class TripResourceWithRawResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -135,7 +131,6 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) - class AsyncTripResourceWithRawResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip @@ -144,7 +139,6 @@ def __init__(self, trip: AsyncTripResource) -> None: trip.retrieve, ) - class TripResourceWithStreamingResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -153,11 +147,10 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) - class AsyncTripResourceWithStreamingResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip self.retrieve = async_to_streamed_response_wrapper( trip.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 71092c9..cbbb057 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -4,25 +4,25 @@ import httpx -from ..types import trip_detail_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.trip_detail_retrieve_response import TripDetailRetrieveResponse -__all__ = ["TripDetailsResource", "AsyncTripDetailsResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import trip_detail_retrieve_params +__all__ = ["TripDetailsResource", "AsyncTripDetailsResource"] class TripDetailsResource(SyncAPIResource): @cached_property @@ -44,22 +44,20 @@ def with_streaming_response(self) -> TripDetailsResourceWithStreamingResponse: """ return TripDetailsResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripDetailRetrieveResponse: + def retrieve(self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -86,29 +84,21 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, - trip_detail_retrieve_params.TripDetailRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, trip_detail_retrieve_params.TripDetailRetrieveParams)), cast_to=TripDetailRetrieveResponse, ) - class AsyncTripDetailsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: @@ -129,22 +119,20 @@ def with_streaming_response(self) -> AsyncTripDetailsResourceWithStreamingRespon """ return AsyncTripDetailsResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripDetailRetrieveResponse: + async def retrieve(self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -171,29 +159,21 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, - trip_detail_retrieve_params.TripDetailRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, trip_detail_retrieve_params.TripDetailRetrieveParams)), cast_to=TripDetailRetrieveResponse, ) - class TripDetailsResourceWithRawResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -202,7 +182,6 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) - class AsyncTripDetailsResourceWithRawResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details @@ -211,7 +190,6 @@ def __init__(self, trip_details: AsyncTripDetailsResource) -> None: trip_details.retrieve, ) - class TripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -220,11 +198,10 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) - class AsyncTripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details self.retrieve = async_to_streamed_response_wrapper( trip_details.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 4417b48..4327fc7 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -4,25 +4,25 @@ import httpx -from ..types import trip_for_vehicle_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse -__all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import trip_for_vehicle_retrieve_params +__all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"] class TripForVehicleResource(SyncAPIResource): @cached_property @@ -44,21 +44,19 @@ def with_streaming_response(self) -> TripForVehicleResourceWithStreamingResponse """ return TripForVehicleResourceWithStreamingResponse(self) - def retrieve( - self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripForVehicleRetrieveResponse: + def retrieve(self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -83,28 +81,20 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") + raise ValueError( + f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' + ) return self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, - trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), cast_to=TripForVehicleRetrieveResponse, ) - class AsyncTripForVehicleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse: @@ -125,21 +115,19 @@ def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingRes """ return AsyncTripForVehicleResourceWithStreamingResponse(self) - async def retrieve( - self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripForVehicleRetrieveResponse: + async def retrieve(self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -164,28 +152,20 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") + raise ValueError( + f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' + ) return await self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, - trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), cast_to=TripForVehicleRetrieveResponse, ) - class TripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -194,7 +174,6 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class AsyncTripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -203,7 +182,6 @@ def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class TripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -212,11 +190,10 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class AsyncTripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle self.retrieve = async_to_streamed_response_wrapper( trip_for_vehicle.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 84958f9..ab7ba23 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,25 +4,25 @@ import httpx -from ..types import trips_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.trips_for_location_list_response import TripsForLocationListResponse -__all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import trips_for_location_list_params +__all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] class TripsForLocationResource(SyncAPIResource): @cached_property @@ -44,23 +44,21 @@ def with_streaming_response(self) -> TripsForLocationResourceWithStreamingRespon """ return TripsForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationListResponse: + def list(self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -91,28 +89,18 @@ def list( """ return self._get( "/api/where/trips-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, - trips_for_location_list_params.TripsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, trips_for_location_list_params.TripsForLocationListParams)), cast_to=TripsForLocationListResponse, ) - class AsyncTripsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: @@ -133,23 +121,21 @@ def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingR """ return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationListResponse: + async def list(self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -180,28 +166,18 @@ async def list( """ return await self._get( "/api/where/trips-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, - trips_for_location_list_params.TripsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, trips_for_location_list_params.TripsForLocationListParams)), cast_to=TripsForLocationListResponse, ) - class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -210,7 +186,6 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) - class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -219,7 +194,6 @@ def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: trips_for_location.list, ) - class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -228,11 +202,10 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) - class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location self.list = async_to_streamed_response_wrapper( trips_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index a5ca21d..690ea60 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -4,25 +4,25 @@ import httpx -from ..types import trips_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.trips_for_route_list_response import TripsForRouteListResponse -__all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import trips_for_route_list_params +__all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] class TripsForRouteResource(SyncAPIResource): @cached_property @@ -44,20 +44,18 @@ def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: """ return TripsForRouteResourceWithStreamingResponse(self) - def list( - self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForRouteListResponse: + def list(self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -78,27 +76,19 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, - trips_for_route_list_params.TripsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, trips_for_route_list_params.TripsForRouteListParams)), cast_to=TripsForRouteListResponse, ) - class AsyncTripsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: @@ -119,20 +109,18 @@ def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResp """ return AsyncTripsForRouteResourceWithStreamingResponse(self) - async def list( - self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForRouteListResponse: + async def list(self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -153,27 +141,19 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, - trips_for_route_list_params.TripsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, trips_for_route_list_params.TripsForRouteListParams)), cast_to=TripsForRouteListResponse, ) - class TripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -182,7 +162,6 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) - class AsyncTripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -191,7 +170,6 @@ def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: trips_for_route.list, ) - class TripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -200,11 +178,10 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) - class AsyncTripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route self.list = async_to_streamed_response_wrapper( trips_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 3f8697d..4126bb6 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -4,25 +4,25 @@ import httpx -from ..types import vehicles_for_agency_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options + from ..types.vehicles_for_agency_list_response import VehiclesForAgencyListResponse -__all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] +from .._base_client import make_request_options + +from .._utils import maybe_transform, async_maybe_transform + +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper + +import warnings +from typing_extensions import Literal, overload +from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given +from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from .._resource import SyncAPIResource, AsyncAPIResource +from ..types import shared_params +from ..types import vehicles_for_agency_list_params +__all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] class VehiclesForAgencyResource(SyncAPIResource): @cached_property @@ -44,18 +44,16 @@ def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingRespo """ return VehiclesForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VehiclesForAgencyListResponse: + def list(self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -71,20 +69,17 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "time": time + }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), cast_to=VehiclesForAgencyListResponse, ) - class AsyncVehiclesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: @@ -105,18 +100,16 @@ def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreaming """ return AsyncVehiclesForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VehiclesForAgencyListResponse: + async def list(self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -132,22 +125,17 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "time": time + }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), cast_to=VehiclesForAgencyListResponse, ) - class VehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -156,7 +144,6 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class AsyncVehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -165,7 +152,6 @@ def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class VehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -174,11 +160,10 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class AsyncVehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency self.list = async_to_streamed_response_wrapper( vehicles_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index a4bb996..634ab48 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -3,54 +3,46 @@ from __future__ import annotations from .shared import References as References, ResponseWrapper as ResponseWrapper -from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse -from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse -from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse -from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse -from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse +from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse +from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse +from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse -from .search_for_stop_list_params import SearchForStopListParams as SearchForStopListParams -from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams -from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams -from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams -from .search_for_route_list_params import SearchForRouteListParams as SearchForRouteListParams -from .search_for_stop_list_response import SearchForStopListResponse as SearchForStopListResponse -from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse -from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse -from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse -from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse -from .stops_for_agency_list_response import StopsForAgencyListResponse as StopsForAgencyListResponse -from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams -from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams -from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse -from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams -from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse -from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams -from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse -from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams -from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse -from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams +from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams +from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse +from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams +from .stops_for_agency_list_response import StopsForAgencyListResponse as StopsForAgencyListResponse +from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse -from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse +from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams +from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse +from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse +from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams +from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams -from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse +from .arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse -from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse -from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse -from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse -from .arrival_and_departure_retrieve_params import ( - ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, -) -from .arrival_and_departure_retrieve_response import ( - ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, -) -from .report_problem_with_stop_retrieve_params import ( - ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, -) -from .report_problem_with_trip_retrieve_params import ( - ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams, -) +from .arrival_and_departure_retrieve_params import ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams +from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse +from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse +from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams +from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse +from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams +from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse +from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams +from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse +from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams +from .report_problem_with_stop_retrieve_params import ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams +from .report_problem_with_trip_retrieve_params import ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams +from .search_for_stop_list_response import SearchForStopListResponse as SearchForStopListResponse +from .search_for_stop_list_params import SearchForStopListParams as SearchForStopListParams +from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse +from .search_for_route_list_params import SearchForRouteListParams as SearchForRouteListParams +from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse +from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse \ No newline at end of file diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py index 13f182b..4a5b82d 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -1,39 +1,35 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "AgenciesWithCoverageListResponse", - "AgenciesWithCoverageListResponseData", - "AgenciesWithCoverageListResponseDataList", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["AgenciesWithCoverageListResponse", "AgenciesWithCoverageListResponseData", "AgenciesWithCoverageListResponseDataList"] class AgenciesWithCoverageListResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") lat: float - lat_span: float = FieldInfo(alias="latSpan") + lat_span: float = FieldInfo(alias = "latSpan") lon: float - lon_span: float = FieldInfo(alias="lonSpan") - + lon_span: float = FieldInfo(alias = "lonSpan") class AgenciesWithCoverageListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[AgenciesWithCoverageListResponseDataList] references: References - class AgenciesWithCoverageListResponse(ResponseWrapper): - data: AgenciesWithCoverageListResponseData + data: AgenciesWithCoverageListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 61d8e79..037963c 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["AgencyRetrieveResponse", "AgencyRetrieveResponseData", "AgencyRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["AgencyRetrieveResponse", "AgencyRetrieveResponseData", "AgencyRetrieveResponseDataEntry"] class AgencyRetrieveResponseDataEntry(BaseModel): id: str @@ -24,22 +26,20 @@ class AgencyRetrieveResponseDataEntry(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) + fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) - + private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") references: References - class AgencyRetrieveResponse(ResponseWrapper): - data: AgencyRetrieveResponseData + data: AgencyRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py index fd1f0c0..8205ce6 100644 --- a/src/onebusaway/types/arrival_and_departure_list_params.py +++ b/src/onebusaway/types/arrival_and_departure_list_params.py @@ -2,15 +2,20 @@ from __future__ import annotations +from typing_extensions import TypedDict, Annotated + +from .._utils import PropertyInfo + from typing import Union + from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes from .._utils import PropertyInfo __all__ = ["ArrivalAndDepartureListParams"] - class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_after: Annotated[int, PropertyInfo(alias="minutesAfter")] """Include vehicles arriving or departing in the next n minutes.""" @@ -18,5 +23,5 @@ class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_before: Annotated[int, PropertyInfo(alias="minutesBefore")] """Include vehicles having arrived or departed in the previous n minutes.""" - time: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """The specific time for querying the system status.""" + time: Annotated[Union[str, datetime], PropertyInfo(format = "iso8601")] + """The specific time for querying the system status.""" \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index cbabf18..87f8287 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -1,23 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ArrivalAndDepartureListResponse", - "ArrivalAndDepartureListResponseData", - "ArrivalAndDepartureListResponseDataEntry", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ArrivalAndDepartureListResponse", "ArrivalAndDepartureListResponseData", "ArrivalAndDepartureListResponseDataEntry", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition"] class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -26,7 +20,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLast lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -34,39 +27,38 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -75,10 +67,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -87,10 +79,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -99,18 +91,16 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ - ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation - ] = FieldInfo(alias="lastKnownLocation", default=None) + last_known_location: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -122,160 +112,152 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas position: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias="stopSequence") + stop_sequence: int = FieldInfo(alias = "stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias="tripHeadsign") + trip_headsign: str = FieldInfo(alias = "tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( - alias="tripStatus", default=None - ) + trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo(alias = "tripStatus", default = None) """Trip-specific status for the arriving transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntry(BaseModel): - arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( - alias="arrivalsAndDepartures" - ) - + arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo(alias = "arrivalsAndDepartures") class ArrivalAndDepartureListResponseData(BaseModel): entry: ArrivalAndDepartureListResponseDataEntry references: References - class ArrivalAndDepartureListResponse(ResponseWrapper): - data: ArrivalAndDepartureListResponseData + data: ArrivalAndDepartureListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py index 3451b73..1bddc55 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_params.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Annotated, Required from .._utils import PropertyInfo -__all__ = ["ArrivalAndDepartureRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["ArrivalAndDepartureRetrieveParams"] class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): service_date: Required[Annotated[int, PropertyInfo(alias="serviceDate")]] @@ -18,4 +21,4 @@ class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): time: int - vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] + vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index a0bc771..78120ae 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -1,22 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ArrivalAndDepartureRetrieveResponse", - "ArrivalAndDepartureRetrieveResponseData", - "ArrivalAndDepartureRetrieveResponseDataEntry", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ArrivalAndDepartureRetrieveResponse", "ArrivalAndDepartureRetrieveResponseData", "ArrivalAndDepartureRetrieveResponseDataEntry", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition"] class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -25,7 +20,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(Ba lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -33,39 +27,38 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -74,10 +67,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -86,10 +79,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -98,18 +91,16 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -121,154 +112,149 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): position: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias="stopSequence") + stop_sequence: int = FieldInfo(alias = "stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias="tripHeadsign") + trip_headsign: str = FieldInfo(alias = "tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( - alias="tripStatus", default=None - ) + trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo(alias = "tripStatus", default = None) """Trip-specific status for the arriving transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry references: References - class ArrivalAndDepartureRetrieveResponse(ResponseWrapper): - data: ArrivalAndDepartureRetrieveResponseData + data: ArrivalAndDepartureRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py index aecb822..ceb636d 100644 --- a/src/onebusaway/types/block_retrieve_response.py +++ b/src/onebusaway/types/block_retrieve_response.py @@ -1,77 +1,63 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "BlockRetrieveResponse", - "BlockRetrieveResponseData", - "BlockRetrieveResponseDataEntry", - "BlockRetrieveResponseDataEntryConfiguration", - "BlockRetrieveResponseDataEntryConfigurationTrip", - "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", - "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["BlockRetrieveResponse", "BlockRetrieveResponseData", "BlockRetrieveResponseDataEntry", "BlockRetrieveResponseDataEntryConfiguration", "BlockRetrieveResponseDataEntryConfigurationTrip", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime"] class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime(BaseModel): - arrival_time: int = FieldInfo(alias="arrivalTime") - - departure_time: int = FieldInfo(alias="departureTime") + arrival_time: int = FieldInfo(alias = "arrivalTime") - stop_id: str = FieldInfo(alias="stopId") + departure_time: int = FieldInfo(alias = "departureTime") - drop_off_type: Optional[int] = FieldInfo(alias="dropOffType", default=None) + stop_id: str = FieldInfo(alias = "stopId") - pickup_type: Optional[int] = FieldInfo(alias="pickupType", default=None) + drop_off_type: Optional[int] = FieldInfo(alias = "dropOffType", default = None) + pickup_type: Optional[int] = FieldInfo(alias = "pickupType", default = None) class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime(BaseModel): - accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") + accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") - block_sequence: int = FieldInfo(alias="blockSequence") + block_sequence: int = FieldInfo(alias = "blockSequence") - distance_along_block: float = FieldInfo(alias="distanceAlongBlock") - - stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias="stopTime") + distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias = "stopTime") class BlockRetrieveResponseDataEntryConfigurationTrip(BaseModel): - accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") - - block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo( - alias="blockStopTimes" - ) + accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") - distance_along_block: float = FieldInfo(alias="distanceAlongBlock") + block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo(alias = "blockStopTimes") - trip_id: str = FieldInfo(alias="tripId") + distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + trip_id: str = FieldInfo(alias = "tripId") class BlockRetrieveResponseDataEntryConfiguration(BaseModel): - active_service_ids: List[str] = FieldInfo(alias="activeServiceIds") + active_service_ids: List[str] = FieldInfo(alias = "activeServiceIds") trips: List[BlockRetrieveResponseDataEntryConfigurationTrip] - inactive_service_ids: Optional[List[str]] = FieldInfo(alias="inactiveServiceIds", default=None) - + inactive_service_ids: Optional[List[str]] = FieldInfo(alias = "inactiveServiceIds", default = None) class BlockRetrieveResponseDataEntry(BaseModel): id: str configurations: List[BlockRetrieveResponseDataEntryConfiguration] - class BlockRetrieveResponseData(BaseModel): entry: BlockRetrieveResponseDataEntry references: References - class BlockRetrieveResponse(ResponseWrapper): - data: BlockRetrieveResponseData + data: BlockRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index eaa7cf9..ace5e26 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -1,82 +1,74 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ConfigRetrieveResponse", - "ConfigRetrieveResponseData", - "ConfigRetrieveResponseDataEntry", - "ConfigRetrieveResponseDataEntryGitProperties", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ConfigRetrieveResponse", "ConfigRetrieveResponseData", "ConfigRetrieveResponseDataEntry", "ConfigRetrieveResponseDataEntryGitProperties"] class ConfigRetrieveResponseDataEntryGitProperties(BaseModel): - git_branch: Optional[str] = FieldInfo(alias="git.branch", default=None) - - git_build_host: Optional[str] = FieldInfo(alias="git.build.host", default=None) + git_branch: Optional[str] = FieldInfo(alias = "git.branch", default = None) - git_build_time: Optional[str] = FieldInfo(alias="git.build.time", default=None) + git_build_host: Optional[str] = FieldInfo(alias = "git.build.host", default = None) - git_build_user_email: Optional[str] = FieldInfo(alias="git.build.user.email", default=None) + git_build_time: Optional[str] = FieldInfo(alias = "git.build.time", default = None) - git_build_user_name: Optional[str] = FieldInfo(alias="git.build.user.name", default=None) + git_build_user_email: Optional[str] = FieldInfo(alias = "git.build.user.email", default = None) - git_build_version: Optional[str] = FieldInfo(alias="git.build.version", default=None) + git_build_user_name: Optional[str] = FieldInfo(alias = "git.build.user.name", default = None) - git_closest_tag_commit_count: Optional[str] = FieldInfo(alias="git.closest.tag.commit.count", default=None) + git_build_version: Optional[str] = FieldInfo(alias = "git.build.version", default = None) - git_closest_tag_name: Optional[str] = FieldInfo(alias="git.closest.tag.name", default=None) + git_closest_tag_commit_count: Optional[str] = FieldInfo(alias = "git.closest.tag.commit.count", default = None) - git_commit_id: Optional[str] = FieldInfo(alias="git.commit.id", default=None) + git_closest_tag_name: Optional[str] = FieldInfo(alias = "git.closest.tag.name", default = None) - git_commit_id_abbrev: Optional[str] = FieldInfo(alias="git.commit.id.abbrev", default=None) + git_commit_id: Optional[str] = FieldInfo(alias = "git.commit.id", default = None) - git_commit_id_describe: Optional[str] = FieldInfo(alias="git.commit.id.describe", default=None) + git_commit_id_abbrev: Optional[str] = FieldInfo(alias = "git.commit.id.abbrev", default = None) - git_commit_id_describe_short: Optional[str] = FieldInfo(alias="git.commit.id.describe-short", default=None) + git_commit_id_describe: Optional[str] = FieldInfo(alias = "git.commit.id.describe", default = None) - git_commit_message_full: Optional[str] = FieldInfo(alias="git.commit.message.full", default=None) + git_commit_id_describe_short: Optional[str] = FieldInfo(alias = "git.commit.id.describe-short", default = None) - git_commit_message_short: Optional[str] = FieldInfo(alias="git.commit.message.short", default=None) + git_commit_message_full: Optional[str] = FieldInfo(alias = "git.commit.message.full", default = None) - git_commit_time: Optional[str] = FieldInfo(alias="git.commit.time", default=None) + git_commit_message_short: Optional[str] = FieldInfo(alias = "git.commit.message.short", default = None) - git_commit_user_email: Optional[str] = FieldInfo(alias="git.commit.user.email", default=None) + git_commit_time: Optional[str] = FieldInfo(alias = "git.commit.time", default = None) - git_commit_user_name: Optional[str] = FieldInfo(alias="git.commit.user.name", default=None) + git_commit_user_email: Optional[str] = FieldInfo(alias = "git.commit.user.email", default = None) - git_dirty: Optional[str] = FieldInfo(alias="git.dirty", default=None) + git_commit_user_name: Optional[str] = FieldInfo(alias = "git.commit.user.name", default = None) - git_remote_origin_url: Optional[str] = FieldInfo(alias="git.remote.origin.url", default=None) + git_dirty: Optional[str] = FieldInfo(alias = "git.dirty", default = None) - git_tags: Optional[str] = FieldInfo(alias="git.tags", default=None) + git_remote_origin_url: Optional[str] = FieldInfo(alias = "git.remote.origin.url", default = None) + git_tags: Optional[str] = FieldInfo(alias = "git.tags", default = None) class ConfigRetrieveResponseDataEntry(BaseModel): id: Optional[str] = None - git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo( - alias="gitProperties", default=None - ) + git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo(alias = "gitProperties", default = None) name: Optional[str] = None - service_date_from: Optional[str] = FieldInfo(alias="serviceDateFrom", default=None) - - service_date_to: Optional[str] = FieldInfo(alias="serviceDateTo", default=None) + service_date_from: Optional[str] = FieldInfo(alias = "serviceDateFrom", default = None) + service_date_to: Optional[str] = FieldInfo(alias = "serviceDateTo", default = None) class ConfigRetrieveResponseData(BaseModel): entry: ConfigRetrieveResponseDataEntry references: References - class ConfigRetrieveResponse(ResponseWrapper): - data: ConfigRetrieveResponseData + data: ConfigRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 20fddb2..80fc92a 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -1,27 +1,27 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["CurrentTimeRetrieveResponse", "CurrentTimeRetrieveResponseData", "CurrentTimeRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["CurrentTimeRetrieveResponse", "CurrentTimeRetrieveResponseData", "CurrentTimeRetrieveResponseDataEntry"] class CurrentTimeRetrieveResponseDataEntry(BaseModel): - readable_time: Optional[str] = FieldInfo(alias="readableTime", default=None) + readable_time: Optional[str] = FieldInfo(alias = "readableTime", default = None) time: Optional[int] = None - class CurrentTimeRetrieveResponseData(BaseModel): entry: CurrentTimeRetrieveResponseDataEntry references: References - class CurrentTimeRetrieveResponse(ResponseWrapper): - data: CurrentTimeRetrieveResponseData + data: CurrentTimeRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py index 609f03f..6889773 100644 --- a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import TypedDict, Literal, Annotated from .._utils import PropertyInfo -__all__ = ["ReportProblemWithStopRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["ReportProblemWithStopRetrieveParams"] class ReportProblemWithStopRetrieveParams(TypedDict, total=False): code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] @@ -23,4 +26,4 @@ class ReportProblemWithStopRetrieveParams(TypedDict, total=False): """The reporting user’s location accuracy, in meters""" user_lon: Annotated[float, PropertyInfo(alias="userLon")] - """The reporting user’s current longitude""" + """The reporting user’s current longitude""" \ No newline at end of file diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py index f55386d..94dc84e 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -2,22 +2,18 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import TypedDict, Literal, Annotated from .._utils import PropertyInfo -__all__ = ["ReportProblemWithTripRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["ReportProblemWithTripRetrieveParams"] class ReportProblemWithTripRetrieveParams(TypedDict, total=False): - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] """A string code identifying the nature of the problem""" service_date: Annotated[int, PropertyInfo(alias="serviceDate")] @@ -45,4 +41,4 @@ class ReportProblemWithTripRetrieveParams(TypedDict, total=False): """The vehicle number, as reported by the user""" vehicle_id: Annotated[str, PropertyInfo(alias="vehicleID")] - """The vehicle actively serving the trip""" + """The vehicle actively serving the trip""" \ No newline at end of file diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index 193704e..33d3468 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,23 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] class RouteIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[str] references: References - class RouteIDsForAgencyListResponse(ResponseWrapper): - data: RouteIDsForAgencyListResponseData + data: RouteIDsForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index a0dfa1e..f5ca95a 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -1,20 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["RouteRetrieveResponse", "RouteRetrieveResponseData", "RouteRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["RouteRetrieveResponse", "RouteRetrieveResponseData", "RouteRetrieveResponseDataEntry"] class RouteRetrieveResponseDataEntry(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,22 +24,20 @@ class RouteRetrieveResponseDataEntry(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RouteRetrieveResponseData(BaseModel): entry: RouteRetrieveResponseDataEntry references: References - class RouteRetrieveResponse(ResponseWrapper): - data: RouteRetrieveResponseData + data: RouteRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 672141d..949b1ff 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -1,20 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] class RoutesForAgencyListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,24 +24,22 @@ class RoutesForAgencyListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RoutesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[RoutesForAgencyListResponseDataList] references: References - class RoutesForAgencyListResponse(ResponseWrapper): - data: RoutesForAgencyListResponseData + data: RoutesForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py index 033ec2a..cfabb8c 100644 --- a/src/onebusaway/types/routes_for_location_list_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Required, Annotated from .._utils import PropertyInfo -__all__ = ["RoutesForLocationListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["RoutesForLocationListParams"] class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -20,4 +23,4 @@ class RoutesForLocationListParams(TypedDict, total=False): query: str - radius: float + radius: float \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index 0393f01..b91a72c 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -1,24 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "RoutesForLocationListResponse", - "RoutesForLocationListResponseData", - "RoutesForLocationListResponseDataList", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["RoutesForLocationListResponse", "RoutesForLocationListResponseData", "RoutesForLocationListResponseDataList"] class RoutesForLocationListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -26,26 +24,24 @@ class RoutesForLocationListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RoutesForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[RoutesForLocationListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class RoutesForLocationListResponse(ResponseWrapper): - data: RoutesForLocationListResponseData + data: RoutesForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py index 6d4d029..6b5fa6b 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -3,17 +3,22 @@ from __future__ import annotations import datetime + +from typing_extensions import TypedDict, Annotated + from typing import Union -from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["ScheduleForRouteRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["ScheduleForRouteRetrieveParams"] class ScheduleForRouteRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to current date) - """ + """ \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 8266786..31d487b 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -1,23 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List, Optional -from .._models import BaseModel from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ScheduleForRouteRetrieveResponse", - "ScheduleForRouteRetrieveResponseData", - "ScheduleForRouteRetrieveResponseDataEntry", - "ScheduleForRouteRetrieveResponseDataEntryStop", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", - "ScheduleForRouteRetrieveResponseDataEntryTrip", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", "ScheduleForRouteRetrieveResponseDataEntryTrip"] class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): id: str @@ -30,102 +22,89 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") - arrival_time: int = FieldInfo(alias="arrivalTime") + arrival_time: int = FieldInfo(alias = "arrivalTime") - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") - departure_time: int = FieldInfo(alias="departureTime") + departure_time: int = FieldInfo(alias = "departureTime") - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + service_id: Optional[str] = FieldInfo(alias = "serviceId", default = None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime(BaseModel): - stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo( - alias="stopTimes" - ) - - trip_id: str = FieldInfo(alias="tripId") + stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo(alias = "stopTimes") + trip_id: str = FieldInfo(alias = "tripId") class ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping(BaseModel): - direction_id: str = FieldInfo(alias="directionId") - - stop_ids: List[str] = FieldInfo(alias="stopIds") + direction_id: str = FieldInfo(alias = "directionId") - trip_headsigns: List[str] = FieldInfo(alias="tripHeadsigns") + stop_ids: List[str] = FieldInfo(alias = "stopIds") - trip_ids: List[str] = FieldInfo(alias="tripIds") + trip_headsigns: List[str] = FieldInfo(alias = "tripHeadsigns") - trips_with_stop_times: Optional[ - List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime] - ] = FieldInfo(alias="tripsWithStopTimes", default=None) + trip_ids: List[str] = FieldInfo(alias = "tripIds") + trips_with_stop_times: Optional[List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime]] = FieldInfo(alias = "tripsWithStopTimes", default = None) class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") - service_id: str = FieldInfo(alias="serviceId") + service_id: str = FieldInfo(alias = "serviceId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") - schedule_date: int = FieldInfo(alias="scheduleDate") + schedule_date: int = FieldInfo(alias = "scheduleDate") - service_ids: List[str] = FieldInfo(alias="serviceIds") + service_ids: List[str] = FieldInfo(alias = "serviceIds") stops: List[ScheduleForRouteRetrieveResponseDataEntryStop] - stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo( - alias="stopTripGroupings" - ) + stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo(alias = "stopTripGroupings") trips: List[ScheduleForRouteRetrieveResponseDataEntryTrip] - class ScheduleForRouteRetrieveResponseData(BaseModel): entry: ScheduleForRouteRetrieveResponseDataEntry - class ScheduleForRouteRetrieveResponse(ResponseWrapper): - data: ScheduleForRouteRetrieveResponseData + data: ScheduleForRouteRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py index 99b89f7..2fe81c7 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -3,17 +3,22 @@ from __future__ import annotations import datetime + +from typing_extensions import TypedDict, Annotated + from typing import Union -from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["ScheduleForStopRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["ScheduleForStopRetrieveParams"] class ScheduleForStopRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to the current date) - """ + """ \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py index 83d1985..afc6eb7 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -1,89 +1,69 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ScheduleForStopRetrieveResponse", - "ScheduleForStopRetrieveResponseData", - "ScheduleForStopRetrieveResponseDataEntry", - "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ScheduleForStopRetrieveResponse", "ScheduleForStopRetrieveResponseData", "ScheduleForStopRetrieveResponseDataEntry", "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency"] class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") - - arrival_time: int = FieldInfo(alias="arrivalTime") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") - departure_enabled: bool = FieldInfo(alias="departureEnabled") + arrival_time: int = FieldInfo(alias = "arrivalTime") - departure_time: int = FieldInfo(alias="departureTime") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") - service_id: str = FieldInfo(alias="serviceId") + departure_time: int = FieldInfo(alias = "departureTime") - trip_id: str = FieldInfo(alias="tripId") + service_id: str = FieldInfo(alias = "serviceId") - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + trip_id: str = FieldInfo(alias = "tripId") + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency(BaseModel): - end_time: int = FieldInfo(alias="endTime") + end_time: int = FieldInfo(alias = "endTime") headway: int - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") - service_id: str = FieldInfo(alias="serviceId") + service_id: str = FieldInfo(alias = "serviceId") - start_time: int = FieldInfo(alias="startTime") - - trip_id: str = FieldInfo(alias="tripId") + start_time: int = FieldInfo(alias = "startTime") + trip_id: str = FieldInfo(alias = "tripId") class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule(BaseModel): - schedule_stop_times: List[ - ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime - ] = FieldInfo(alias="scheduleStopTimes") - - trip_headsign: str = FieldInfo(alias="tripHeadsign") + schedule_stop_times: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime] = FieldInfo(alias = "scheduleStopTimes") - schedule_frequencies: Optional[ - List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency] - ] = FieldInfo(alias="scheduleFrequencies", default=None) + trip_headsign: str = FieldInfo(alias = "tripHeadsign") + schedule_frequencies: Optional[List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency]] = FieldInfo(alias = "scheduleFrequencies", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule(BaseModel): - route_id: str = FieldInfo(alias="routeId") - - stop_route_direction_schedules: List[ - ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule - ] = FieldInfo(alias="stopRouteDirectionSchedules") + route_id: str = FieldInfo(alias = "routeId") + stop_route_direction_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule] = FieldInfo(alias = "stopRouteDirectionSchedules") class ScheduleForStopRetrieveResponseDataEntry(BaseModel): date: int - stop_id: str = FieldInfo(alias="stopId") - - stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo( - alias="stopRouteSchedules" - ) + stop_id: str = FieldInfo(alias = "stopId") + stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo(alias = "stopRouteSchedules") class ScheduleForStopRetrieveResponseData(BaseModel): entry: ScheduleForStopRetrieveResponseDataEntry references: References - class ScheduleForStopRetrieveResponse(ResponseWrapper): - data: ScheduleForStopRetrieveResponseData + data: ScheduleForStopRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/search_for_route_list_params.py b/src/onebusaway/types/search_for_route_list_params.py index 76f767b..979587c 100755 --- a/src/onebusaway/types/search_for_route_list_params.py +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -2,16 +2,19 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Required, Annotated from .._utils import PropertyInfo -__all__ = ["SearchForRouteListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["SearchForRouteListParams"] class SearchForRouteListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" + """The max number of results to return. Defaults to 20.""" \ No newline at end of file diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py index e54153a..6c8e481 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -1,20 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] class SearchForRouteListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,26 +24,24 @@ class SearchForRouteListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class SearchForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[SearchForRouteListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class SearchForRouteListResponse(ResponseWrapper): - data: Optional[SearchForRouteListResponseData] = None + data: Optional[SearchForRouteListResponseData] = None \ No newline at end of file diff --git a/src/onebusaway/types/search_for_stop_list_params.py b/src/onebusaway/types/search_for_stop_list_params.py index 012f802..9cf8c67 100755 --- a/src/onebusaway/types/search_for_stop_list_params.py +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -2,16 +2,19 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Required, Annotated from .._utils import PropertyInfo -__all__ = ["SearchForStopListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["SearchForStopListParams"] class SearchForStopListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" + """The max number of results to return. Defaults to 20.""" \ No newline at end of file diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 502455c..1b643cb 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List, Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] class SearchForStopListResponseDataList(BaseModel): id: str @@ -22,28 +24,26 @@ class SearchForStopListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class SearchForStopListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[SearchForStopListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class SearchForStopListResponse(ResponseWrapper): - data: Optional[SearchForStopListResponseData] = None + data: Optional[SearchForStopListResponseData] = None \ No newline at end of file diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py index 07a3b6a..d4e9b0d 100644 --- a/src/onebusaway/types/shape_retrieve_response.py +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -1,13 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .._models import BaseModel + from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] class ShapeRetrieveResponseDataEntry(BaseModel): length: int @@ -17,12 +21,10 @@ class ShapeRetrieveResponseDataEntry(BaseModel): levels: Optional[str] = None - class ShapeRetrieveResponseData(BaseModel): entry: ShapeRetrieveResponseDataEntry references: References - class ShapeRetrieveResponse(ResponseWrapper): - data: ShapeRetrieveResponseData + data: ShapeRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py index 1da019e..5991736 100644 --- a/src/onebusaway/types/shared/__init__.py +++ b/src/onebusaway/types/shared/__init__.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .references import References as References -from .response_wrapper import ResponseWrapper as ResponseWrapper +from .response_wrapper import ResponseWrapper as ResponseWrapper \ No newline at end of file diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 8c6deab..bed6854 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -1,31 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal +from ..._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from ..._models import BaseModel +from typing_extensions import Literal + +from typing_extensions import Literal -__all__ = [ - "References", - "Agency", - "Route", - "Situation", - "SituationActiveWindow", - "SituationAllAffect", - "SituationConsequence", - "SituationConsequenceConditionDetails", - "SituationConsequenceConditionDetailsDiversionPath", - "SituationDescription", - "SituationPublicationWindow", - "SituationSummary", - "SituationURL", - "Stop", - "StopTime", - "Trip", -] +from pydantic import Field as FieldInfo +__all__ = ["References", "Agency", "Route", "Situation", "SituationActiveWindow", "SituationAllAffect", "SituationConsequence", "SituationConsequenceConditionDetails", "SituationConsequenceConditionDetailsDiversionPath", "SituationDescription", "SituationPublicationWindow", "SituationSummary", "SituationURL", "Stop", "StopTime", "Trip"] class Agency(BaseModel): id: str @@ -40,19 +25,18 @@ class Agency(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) + fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) - + private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) class Route(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -60,45 +44,42 @@ class Route(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class SituationActiveWindow(BaseModel): - from_: Optional[int] = FieldInfo(alias="from", default=None) + from_: Optional[int] = FieldInfo(alias = "from", default = None) """Start time of the active window as a Unix timestamp.""" to: Optional[int] = None """End time of the active window as a Unix timestamp.""" - class SituationAllAffect(BaseModel): - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: Optional[str] = FieldInfo(alias = "agencyId", default = None) """Identifier for the agency.""" - application_id: Optional[str] = FieldInfo(alias="applicationId", default=None) + application_id: Optional[str] = FieldInfo(alias = "applicationId", default = None) """Identifier for the application.""" - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) """Identifier for the direction.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) + route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) """Identifier for the route.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) """Identifier for the stop.""" - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + trip_id: Optional[str] = FieldInfo(alias = "tripId", default = None) """Identifier for the trip.""" - class SituationConsequenceConditionDetailsDiversionPath(BaseModel): length: Optional[int] = None """Length of the diversion path.""" @@ -109,23 +90,16 @@ class SituationConsequenceConditionDetailsDiversionPath(BaseModel): points: Optional[str] = None """Points of the diversion path.""" - class SituationConsequenceConditionDetails(BaseModel): - diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo( - alias="diversionPath", default=None - ) - - diversion_stop_ids: Optional[List[str]] = FieldInfo(alias="diversionStopIds", default=None) + diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo(alias = "diversionPath", default = None) + diversion_stop_ids: Optional[List[str]] = FieldInfo(alias = "diversionStopIds", default = None) class SituationConsequence(BaseModel): condition: Optional[str] = None """Condition of the consequence.""" - condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo( - alias="conditionDetails", default=None - ) - + condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo(alias = "conditionDetails", default = None) class SituationDescription(BaseModel): lang: Optional[str] = None @@ -134,15 +108,13 @@ class SituationDescription(BaseModel): value: Optional[str] = None """Longer description of the situation.""" - class SituationPublicationWindow(BaseModel): - from_: int = FieldInfo(alias="from") + from_: int = FieldInfo(alias = "from") """Start time of the time window as a Unix timestamp.""" to: int """End time of the time window as a Unix timestamp.""" - class SituationSummary(BaseModel): lang: Optional[str] = None """Language of the summary.""" @@ -150,7 +122,6 @@ class SituationSummary(BaseModel): value: Optional[str] = None """Short summary of the situation.""" - class SituationURL(BaseModel): lang: Optional[str] = None """Language of the URL.""" @@ -158,32 +129,27 @@ class SituationURL(BaseModel): value: Optional[str] = None """URL for more information about the situation.""" - class Situation(BaseModel): id: str """Unique identifier for the situation.""" - creation_time: int = FieldInfo(alias="creationTime") + creation_time: int = FieldInfo(alias = "creationTime") """Unix timestamp of when this situation was created.""" - active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias="activeWindows", default=None) + active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias = "activeWindows", default = None) - all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias="allAffects", default=None) + all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias = "allAffects", default = None) - consequence_message: Optional[str] = FieldInfo(alias="consequenceMessage", default=None) + consequence_message: Optional[str] = FieldInfo(alias = "consequenceMessage", default = None) """Message regarding the consequence of the situation.""" consequences: Optional[List[SituationConsequence]] = None description: Optional[SituationDescription] = None - publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo( - alias="publicationWindows", default=None - ) + publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo(alias = "publicationWindows", default = None) - reason: Optional[ - Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"] - ] = None + reason: Optional[Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"]] = None """Reason for the service alert, taken from TPEG codes.""" severity: Optional[str] = None @@ -193,7 +159,6 @@ class Situation(BaseModel): url: Optional[SituationURL] = None - class Stop(BaseModel): id: str @@ -205,56 +170,53 @@ class Stop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class Trip(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") - - service_id: str = FieldInfo(alias="serviceId") + route_id: str = FieldInfo(alias = "routeId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + service_id: str = FieldInfo(alias = "serviceId") - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class References(BaseModel): agencies: List[Agency] @@ -265,6 +227,6 @@ class References(BaseModel): stops: List[Stop] - stop_times: List[StopTime] = FieldInfo(alias="stopTimes") + stop_times: List[StopTime] = FieldInfo(alias = "stopTimes") - trips: List[Trip] + trips: List[Trip] \ No newline at end of file diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py index 72ecc38..fcaf06c 100644 --- a/src/onebusaway/types/shared/response_wrapper.py +++ b/src/onebusaway/types/shared/response_wrapper.py @@ -1,18 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from ..._models import BaseModel -from pydantic import Field as FieldInfo +from typing_extensions import Literal -from ..._models import BaseModel +from pydantic import Field as FieldInfo __all__ = ["ResponseWrapper"] - class ResponseWrapper(BaseModel): code: int - current_time: int = FieldInfo(alias="currentTime") + current_time: int = FieldInfo(alias = "currentTime") text: str - version: int + version: int \ No newline at end of file diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index 3ae9947..48489cd 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,23 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] class StopIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[str] references: References - class StopIDsForAgencyListResponse(ResponseWrapper): - data: StopIDsForAgencyListResponseData + data: StopIDsForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 6a69553..eb259c5 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List, Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] class StopRetrieveResponseDataEntry(BaseModel): id: str @@ -22,24 +24,22 @@ class StopRetrieveResponseDataEntry(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopRetrieveResponseData(BaseModel): entry: StopRetrieveResponseDataEntry references: References - class StopRetrieveResponse(ResponseWrapper): - data: StopRetrieveResponseData + data: StopRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index 422c5ee..bf131b5 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .._models import BaseModel + from typing import List, Optional -from pydantic import Field as FieldInfo +from .shared.response_wrapper import ResponseWrapper -from .._models import BaseModel from .shared.references import References -from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] class StopsForAgencyListResponseList(BaseModel): id: str @@ -22,24 +24,23 @@ class StopsForAgencyListResponseList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForAgencyListResponse(ResponseWrapper): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[StopsForAgencyListResponseList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py index 3174257..6137ce8 100644 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Required, Annotated from .._utils import PropertyInfo -__all__ = ["StopsForLocationListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["StopsForLocationListParams"] class StopsForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -24,4 +27,4 @@ class StopsForLocationListParams(TypedDict, total=False): """A search query string to filter the results""" radius: float - """The radius in meters to search within""" + """The radius in meters to search within""" \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index e075eb1..f9d4fca 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import List, Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] class StopsForLocationListResponseDataList(BaseModel): id: str @@ -22,28 +24,26 @@ class StopsForLocationListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[StopsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) - + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) class StopsForLocationListResponse(ResponseWrapper): - data: StopsForLocationListResponseData + data: StopsForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py index ddf40d0..cad8058 100644 --- a/src/onebusaway/types/stops_for_route_list_params.py +++ b/src/onebusaway/types/stops_for_route_list_params.py @@ -2,16 +2,19 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict, Annotated from .._utils import PropertyInfo -__all__ = ["StopsForRouteListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["StopsForRouteListParams"] class StopsForRouteListParams(TypedDict, total=False): include_polylines: Annotated[bool, PropertyInfo(alias="includePolylines")] """Include polyline elements in the response (default true)""" time: str - """Specify service date (YYYY-MM-DD or epoch) (default today)""" + """Specify service date (YYYY-MM-DD or epoch) (default today)""" \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 53cff4e..cd346b6 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -1,23 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopsForRouteListResponse", - "StopsForRouteListResponseData", - "StopsForRouteListResponseDataEntry", - "StopsForRouteListResponseDataEntryPolyline", - "StopsForRouteListResponseDataEntryStopGrouping", - "StopsForRouteListResponseDataEntryStopGroupingName", - "StopsForRouteListResponseDataEntryStopGroupingPolyline", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["StopsForRouteListResponse", "StopsForRouteListResponseData", "StopsForRouteListResponseDataEntry", "StopsForRouteListResponseDataEntryPolyline", "StopsForRouteListResponseDataEntryStopGrouping", "StopsForRouteListResponseDataEntryStopGroupingName", "StopsForRouteListResponseDataEntryStopGroupingPolyline"] class StopsForRouteListResponseDataEntryPolyline(BaseModel): length: Optional[int] = None @@ -26,7 +20,6 @@ class StopsForRouteListResponseDataEntryPolyline(BaseModel): points: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): name: Optional[str] = None @@ -34,7 +27,6 @@ class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): type: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None @@ -42,7 +34,6 @@ class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): id: Optional[str] = None @@ -50,26 +41,21 @@ class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryStopGroupingPolyline]] = None - stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) - + stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) class StopsForRouteListResponseDataEntry(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryPolyline]] = None - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) + route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) - stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo( - alias="stopGroupings", default=None - ) - - stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) + stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo(alias = "stopGroupings", default = None) + stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) class StopsForRouteListResponseData(BaseModel): entry: StopsForRouteListResponseDataEntry references: References - class StopsForRouteListResponse(ResponseWrapper): - data: StopsForRouteListResponseData + data: StopsForRouteListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py index a8529bf..658d0a6 100644 --- a/src/onebusaway/types/trip_detail_retrieve_params.py +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict, Annotated from .._utils import PropertyInfo -__all__ = ["TripDetailRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["TripDetailRetrieveParams"] class TripDetailRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] @@ -32,4 +35,4 @@ class TripDetailRetrieveParams(TypedDict, total=False): """Service date for the trip as Unix time in milliseconds (optional).""" time: int - """Time parameter to query the system at a specific time (optional).""" + """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 4b76689..1846d1e 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -1,51 +1,42 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripDetailRetrieveResponse", - "TripDetailRetrieveResponseData", - "TripDetailRetrieveResponseDataEntry", - "TripDetailRetrieveResponseDataEntrySchedule", - "TripDetailRetrieveResponseDataEntryScheduleStopTime", - "TripDetailRetrieveResponseDataEntryStatus", - "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", - "TripDetailRetrieveResponseDataEntryStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["TripDetailRetrieveResponse", "TripDetailRetrieveResponseData", "TripDetailRetrieveResponseDataEntry", "TripDetailRetrieveResponseDataEntrySchedule", "TripDetailRetrieveResponseDataEntryScheduleStopTime", "TripDetailRetrieveResponseDataEntryStatus", "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", "TripDetailRetrieveResponseDataEntryStatusPosition"] class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +44,6 @@ class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +51,38 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +91,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +103,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +115,16 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,38 +136,35 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripDetailRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripDetailRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None - class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry references: References - class TripDetailRetrieveResponse(ResponseWrapper): - data: TripDetailRetrieveResponseData + data: TripDetailRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py index 3e8240c..325521b 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict, Annotated from .._utils import PropertyInfo -__all__ = ["TripForVehicleRetrieveParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["TripForVehicleRetrieveParams"] class TripForVehicleRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] @@ -30,4 +33,4 @@ class TripForVehicleRetrieveParams(TypedDict, total=False): """ time: int - """Time parameter to query the system at a specific time (optional).""" + """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 136b96c..fab9984 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -1,51 +1,42 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripForVehicleRetrieveResponse", - "TripForVehicleRetrieveResponseData", - "TripForVehicleRetrieveResponseDataEntry", - "TripForVehicleRetrieveResponseDataEntrySchedule", - "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", - "TripForVehicleRetrieveResponseDataEntryStatus", - "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", - "TripForVehicleRetrieveResponseDataEntryStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["TripForVehicleRetrieveResponse", "TripForVehicleRetrieveResponseData", "TripForVehicleRetrieveResponseDataEntry", "TripForVehicleRetrieveResponseDataEntrySchedule", "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", "TripForVehicleRetrieveResponseDataEntryStatus", "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", "TripForVehicleRetrieveResponseDataEntryStatusPosition"] class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +44,6 @@ class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +51,38 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +91,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +103,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +115,16 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,38 +136,35 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripForVehicleRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None - class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry references: References - class TripForVehicleRetrieveResponse(ResponseWrapper): - data: TripForVehicleRetrieveResponseData + data: TripForVehicleRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 152bfa2..37fbab7 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -1,45 +1,45 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = ["TripRetrieveResponse", "TripRetrieveResponseData", "TripRetrieveResponseDataEntry"] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["TripRetrieveResponse", "TripRetrieveResponseData", "TripRetrieveResponseDataEntry"] class TripRetrieveResponseDataEntry(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") - service_id: str = FieldInfo(alias="serviceId") + service_id: str = FieldInfo(alias = "serviceId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class TripRetrieveResponseData(BaseModel): entry: TripRetrieveResponseDataEntry references: References - class TripRetrieveResponse(ResponseWrapper): - data: TripRetrieveResponseData + data: TripRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py index 69a9186..6962798 100644 --- a/src/onebusaway/types/trips_for_location_list_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import TypedDict, Required, Annotated from .._utils import PropertyInfo -__all__ = ["TripsForLocationListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["TripsForLocationListParams"] class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -35,4 +38,4 @@ class TripsForLocationListParams(TypedDict, total=False): """ time: int - """Specific time for the query. Defaults to the current time.""" + """Specific time for the query. Defaults to the current time.""" \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 68ae881..5e3c087 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -1,51 +1,42 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripsForLocationListResponse", - "TripsForLocationListResponseData", - "TripsForLocationListResponseDataList", - "TripsForLocationListResponseDataListSchedule", - "TripsForLocationListResponseDataListScheduleStopTime", - "TripsForLocationListResponseDataListStatus", - "TripsForLocationListResponseDataListStatusLastKnownLocation", - "TripsForLocationListResponseDataListStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["TripsForLocationListResponse", "TripsForLocationListResponseData", "TripsForLocationListResponseDataList", "TripsForLocationListResponseDataListSchedule", "TripsForLocationListResponseDataListScheduleStopTime", "TripsForLocationListResponseDataListStatus", "TripsForLocationListResponseDataListStatusLastKnownLocation", "TripsForLocationListResponseDataListStatusPosition"] class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForLocationListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +44,6 @@ class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripsForLocationListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +51,38 @@ class TripsForLocationListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripsForLocationListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +91,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +103,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +115,16 @@ class TripsForLocationListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,44 +136,41 @@ class TripsForLocationListResponseDataListStatus(BaseModel): position: Optional[TripsForLocationListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripsForLocationListResponseDataList(BaseModel): schedule: TripsForLocationListResponseDataListSchedule status: TripsForLocationListResponseDataListStatus - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") """Indicates if the limit of trips has been exceeded""" list: List[TripsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) """Indicates if the search location is out of range""" - class TripsForLocationListResponse(ResponseWrapper): - data: TripsForLocationListResponseData + data: TripsForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py index c2f7ec0..d3bf43f 100644 --- a/src/onebusaway/types/trips_for_route_list_params.py +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -2,12 +2,15 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict, Annotated from .._utils import PropertyInfo -__all__ = ["TripsForRouteListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["TripsForRouteListParams"] class TripsForRouteListParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] @@ -20,4 +23,4 @@ class TripsForRouteListParams(TypedDict, total=False): """ time: int - """Query the system at a specific time. Useful for testing.""" + """Query the system at a specific time. Useful for testing.""" \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index f9bc2d8..efb7b6e 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -1,51 +1,42 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripsForRouteListResponse", - "TripsForRouteListResponseData", - "TripsForRouteListResponseDataList", - "TripsForRouteListResponseDataListSchedule", - "TripsForRouteListResponseDataListScheduleStopTime", - "TripsForRouteListResponseDataListStatus", - "TripsForRouteListResponseDataListStatusLastKnownLocation", - "TripsForRouteListResponseDataListStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["TripsForRouteListResponse", "TripsForRouteListResponseData", "TripsForRouteListResponseDataList", "TripsForRouteListResponseDataListSchedule", "TripsForRouteListResponseDataListScheduleStopTime", "TripsForRouteListResponseDataListStatus", "TripsForRouteListResponseDataListStatusLastKnownLocation", "TripsForRouteListResponseDataListStatusPosition"] class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForRouteListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +44,6 @@ class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripsForRouteListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +51,38 @@ class TripsForRouteListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripsForRouteListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +91,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +103,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +115,16 @@ class TripsForRouteListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,40 +136,37 @@ class TripsForRouteListResponseDataListStatus(BaseModel): position: Optional[TripsForRouteListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripsForRouteListResponseDataList(BaseModel): schedule: TripsForRouteListResponseDataListSchedule status: TripsForRouteListResponseDataListStatus - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[TripsForRouteListResponseDataList] references: References - class TripsForRouteListResponse(ResponseWrapper): - data: TripsForRouteListResponseData + data: TripsForRouteListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py index ebf92d1..05937c8 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_params.py +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -4,9 +4,12 @@ from typing_extensions import TypedDict -__all__ = ["VehiclesForAgencyListParams"] +from typing_extensions import Literal, TypedDict, Required, Annotated +from .._types import FileTypes +from .._utils import PropertyInfo +__all__ = ["VehiclesForAgencyListParams"] class VehiclesForAgencyListParams(TypedDict, total=False): time: str - """Specific time for querying the status (timestamp format)""" + """Specific time for querying the status (timestamp format)""" \ No newline at end of file diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 34601dd..cd8ac35 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -1,30 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from .._models import BaseModel -from pydantic import Field as FieldInfo +from typing import Optional, List -from .._models import BaseModel from .shared.references import References + from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "VehiclesForAgencyListResponse", - "VehiclesForAgencyListResponseData", - "VehiclesForAgencyListResponseDataList", - "VehiclesForAgencyListResponseDataListLocation", - "VehiclesForAgencyListResponseDataListTripStatus", - "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", - "VehiclesForAgencyListResponseDataListTripStatusPosition", -] +from typing_extensions import Literal +from pydantic import Field as FieldInfo +__all__ = ["VehiclesForAgencyListResponse", "VehiclesForAgencyListResponseData", "VehiclesForAgencyListResponseDataList", "VehiclesForAgencyListResponseDataListLocation", "VehiclesForAgencyListResponseDataListTripStatus", "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", "VehiclesForAgencyListResponseDataListTripStatusPosition"] class VehiclesForAgencyListResponseDataListLocation(BaseModel): lat: Optional[float] = None lon: Optional[float] = None - class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -32,7 +25,6 @@ class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -40,39 +32,38 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -81,10 +72,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -93,10 +84,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -105,18 +96,16 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -128,50 +117,47 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): position: Optional[VehiclesForAgencyListResponseDataListTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class VehiclesForAgencyListResponseDataList(BaseModel): - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") location: VehiclesForAgencyListResponseDataListLocation - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") - trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias="tripStatus") + trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias = "tripStatus") - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) + occupancy_capacity: Optional[int] = FieldInfo(alias = "occupancyCapacity", default = None) - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) + occupancy_count: Optional[int] = FieldInfo(alias = "occupancyCount", default = None) - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) phase: Optional[str] = None status: Optional[str] = None - class VehiclesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[VehiclesForAgencyListResponseDataList] references: References - class VehiclesForAgencyListResponse(ResponseWrapper): - data: VehiclesForAgencyListResponseData + data: VehiclesForAgencyListResponseData \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py index fd8019a..bd67c17 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py index fd8019a..bd67c17 100644 --- a/tests/api_resources/__init__.py +++ b/tests/api_resources/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py index fad1087..5b49882 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -2,71 +2,77 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import AgenciesWithCoverageListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import AgenciesWithCoverageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: agencies_with_coverage = client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.list() as response: + with client.agencies_with_coverage.with_streaming_response.list() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: agencies_with_coverage = await async_client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.list() as response: + async with async_client.agencies_with_coverage.with_streaming_response.list() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index 05b83a8..bdfd649 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import AgencyRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import AgencyRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: agency = client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.agency.with_streaming_response.retrieve( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.agency.with_raw_response.retrieve( - "", - ) - - + client.agency.with_raw_response.retrieve( + "", + ) class TestAsyncAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: agency = await async_client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.agency.with_streaming_response.retrieve( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.agency.with_raw_response.retrieve( - "", - ) + await async_client.agency.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index 0ba8109..f371046 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -2,24 +2,29 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import ArrivalAndDepartureRetrieveResponse, ArrivalAndDepartureListResponse + +from typing import cast, Any +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import ( - ArrivalAndDepartureListResponse, - ArrivalAndDepartureRetrieveResponse, -) +from onebusaway.types import arrival_and_departure_retrieve_params +from onebusaway.types import arrival_and_departure_list_params +from onebusaway._utils import parse_datetime from onebusaway._utils import parse_datetime base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestArrivalAndDeparture: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: @@ -28,7 +33,7 @@ def test_method_retrieve(self, client: OnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -40,10 +45,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -51,9 +57,9 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: @@ -61,30 +67,30 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -94,42 +100,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) - - + client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) class TestAsyncArrivalAndDeparture: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: @@ -138,7 +144,7 @@ async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -150,10 +156,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -161,9 +168,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: @@ -171,30 +178,30 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + await async_client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -204,35 +211,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) + await async_client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py index a07a29b..0adb879 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import BlockRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import BlockRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestBlock: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: block = client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.block.with_streaming_response.retrieve( "blockID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - client.block.with_raw_response.retrieve( - "", - ) - - + client.block.with_raw_response.retrieve( + "", + ) class TestAsyncBlock: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: block = await async_client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.block.with_streaming_response.retrieve( "blockID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - await async_client.block.with_raw_response.retrieve( - "", - ) + await async_client.block.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py index 62bdd91..5692c29 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -2,71 +2,77 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import ConfigRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import ConfigRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestConfig: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: config = client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.config.with_streaming_response.retrieve() as response: + with client.config.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncConfig: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: config = await async_client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.config.with_streaming_response.retrieve() as response: + async with async_client.config.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py index 1a05528..a43fb0c 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -2,71 +2,77 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import CurrentTimeRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import CurrentTimeRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestCurrentTime: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: current_time = client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.current_time.with_streaming_response.retrieve() as response: + with client.current_time.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncCurrentTime: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: current_time = await async_client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.current_time.with_streaming_response.retrieve() as response: + async with async_client.current_time.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py index 0b15883..f7a4f54 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types.shared import ResponseWrapper +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types.shared import ResponseWrapper +from onebusaway.types import report_problem_with_stop_retrieve_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestReportProblemWithStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_stop = client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +40,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) - - + client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) class TestAsyncReportProblemWithStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,35 +94,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) + await async_client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index 0bc9cf2..8b23611 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types.shared import ResponseWrapper +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types.shared import ResponseWrapper +from onebusaway.types import report_problem_with_trip_retrieve_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestReportProblemWithTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_trip = client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -39,49 +45,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) - - + client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) class TestAsyncReportProblemWithTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_trip = await async_client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -98,35 +104,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) + await async_client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index 8b773cf..b27ce01 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import RouteRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RouteRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: route = client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.route.with_streaming_response.retrieve( "routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.route.with_raw_response.retrieve( - "", - ) - - + client.route.with_raw_response.retrieve( + "", + ) class TestAsyncRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: route = await async_client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route.with_streaming_response.retrieve( "routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.route.with_raw_response.retrieve( - "", - ) + await async_client.route.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py index 867c19a..f8ded3c 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import RouteIDsForAgencyListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RouteIDsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRouteIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: route_ids_for_agency = client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.route_ids_for_agency.with_raw_response.list( - "", - ) - - + client.route_ids_for_agency.with_raw_response.list( + "", + ) class TestAsyncRouteIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: route_ids_for_agency = await async_client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.route_ids_for_agency.with_raw_response.list( - "", - ) + await async_client.route_ids_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 1fe2d56..225d1f2 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import RoutesForAgencyListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RoutesForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoutesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: routes_for_agency = client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.routes_for_agency.with_raw_response.list( - "", - ) - - + client.routes_for_agency.with_raw_response.list( + "", + ) class TestAsyncRoutesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: routes_for_agency = await async_client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.routes_for_agency.with_raw_response.list( - "", - ) + await async_client.routes_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 55fbc31..35716ba 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -2,20 +2,26 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import RoutesForLocationListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RoutesForLocationListResponse +from onebusaway.types import routes_for_location_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoutesForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +29,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,37 +41,37 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncRoutesForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,7 +79,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,30 +91,31 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index 6973a7e..4dd1a1d 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -2,28 +2,35 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import ScheduleForRouteRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import ScheduleForRouteRetrieveResponse +from onebusaway.types import schedule_for_route_retrieve_params +from onebusaway._utils import parse_date from onebusaway._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestScheduleForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_route = client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +38,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) - - + client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) class TestAsyncScheduleForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_route = await async_client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,35 +88,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) + await async_client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py index 0154e44..ad705cf 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -2,28 +2,35 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import ScheduleForStopRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import ScheduleForStopRetrieveResponse +from onebusaway.types import schedule_for_stop_retrieve_params +from onebusaway._utils import parse_date from onebusaway._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestScheduleForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_stop = client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +38,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) - - + client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) class TestAsyncScheduleForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_stop = await async_client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,35 +88,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) + await async_client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index 76114f6..220353c 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import SearchForRouteListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import SearchForRouteListResponse +from onebusaway.types import search_for_route_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestSearchForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_route = client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +36,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_route.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncSearchForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_route = await async_client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,28 +79,29 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_route.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index bed17ea..aa138a1 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import SearchForStopListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import SearchForStopListResponse +from onebusaway.types import search_for_stop_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestSearchForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_stop = client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +36,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_stop.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncSearchForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_stop = await async_client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,28 +79,29 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_stop.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py index 369da7d..4ef8019 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import ShapeRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import ShapeRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestShape: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: shape = client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.shape.with_streaming_response.retrieve( "shapeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - client.shape.with_raw_response.retrieve( - "", - ) - - + client.shape.with_raw_response.retrieve( + "", + ) class TestAsyncShape: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: shape = await async_client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.shape.with_streaming_response.retrieve( "shapeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - await async_client.shape.with_raw_response.retrieve( - "", - ) + await async_client.shape.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py index 9286176..eacc5ad 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import StopRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: stop = client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.stop.with_streaming_response.retrieve( "stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.stop.with_raw_response.retrieve( - "", - ) - - + client.stop.with_raw_response.retrieve( + "", + ) class TestAsyncStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: stop = await async_client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop.with_streaming_response.retrieve( "stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.stop.with_raw_response.retrieve( - "", - ) + await async_client.stop.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py index 923a743..56c9414 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import StopIDsForAgencyListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopIDsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stop_ids_for_agency = client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stop_ids_for_agency.with_raw_response.list( - "", - ) - - + client.stop_ids_for_agency.with_raw_response.list( + "", + ) class TestAsyncStopIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stop_ids_for_agency = await async_client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stop_ids_for_agency.with_raw_response.list( - "", - ) + await async_client.stop_ids_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py index 7c6538e..71230d1 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import StopsForAgencyListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_agency = client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stops_for_agency.with_raw_response.list( - "", - ) - - + client.stops_for_agency.with_raw_response.list( + "", + ) class TestAsyncStopsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_agency = await async_client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stops_for_agency.with_raw_response.list( - "", - ) + await async_client.stops_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index fcb2f07..520184f 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -2,20 +2,26 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import StopsForLocationListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForLocationListResponse +from onebusaway.types import stops_for_location_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +29,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,37 +41,37 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncStopsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,7 +79,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,30 +91,31 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py index e062f7d..4e6787a 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import StopsForRouteListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForRouteListResponse +from onebusaway.types import stops_for_route_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_route = client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +37,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.stops_for_route.with_raw_response.list( - route_id="", - ) - - + client.stops_for_route.with_raw_response.list( + route_id="", + ) class TestAsyncStopsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_route = await async_client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -82,35 +88,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.stops_for_route.with_raw_response.list( - route_id="", - ) + await async_client.stops_for_route.with_raw_response.list( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index ef2bd7f..7c39766 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -2,97 +2,103 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import TripRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip = client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip.with_streaming_response.retrieve( "tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip.with_raw_response.retrieve( - "", - ) - - + client.trip.with_raw_response.retrieve( + "", + ) class TestAsyncTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip = await async_client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip.with_streaming_response.retrieve( "tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip.with_raw_response.retrieve( - "", - ) + await async_client.trip.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py index 82d00d9..0db299e 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import TripDetailRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripDetailRetrieveResponse +from onebusaway.types import trip_detail_retrieve_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripDetails: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_detail = client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +40,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip_details.with_raw_response.retrieve( - trip_id="", - ) - - + client.trip_details.with_raw_response.retrieve( + trip_id="", + ) class TestAsyncTripDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_detail = await async_client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,35 +94,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip_details.with_raw_response.retrieve( - trip_id="", - ) + await async_client.trip_details.with_raw_response.retrieve( + trip_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py index be96fa6..0a2d84f 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import TripForVehicleRetrieveResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripForVehicleRetrieveResponse +from onebusaway.types import trip_for_vehicle_retrieve_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripForVehicle: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_for_vehicle = client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -33,49 +39,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) - - + client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) class TestAsyncTripForVehicle: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_for_vehicle = await async_client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -86,35 +92,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - await async_client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) + await async_client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 050d552..c3dbfa3 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -2,20 +2,26 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import TripsForLocationListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripsForLocationListResponse +from onebusaway.types import trips_for_location_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -25,7 +31,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -38,10 +44,11 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -50,9 +57,9 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: @@ -61,18 +68,17 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: lat_span=0, lon=0, lon_span=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncTripsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -82,7 +88,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -95,10 +101,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -107,9 +114,9 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -118,11 +125,11 @@ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) - lat_span=0, lon=0, lon_span=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py index 0ef4092..b301f38 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import TripsForRouteListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripsForRouteListResponse +from onebusaway.types import trips_for_route_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: trips_for_route = client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -32,49 +38,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.trips_for_route.with_raw_response.list( - route_id="", - ) - - + client.trips_for_route.with_raw_response.list( + route_id="", + ) class TestAsyncTripsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: trips_for_route = await async_client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -84,35 +90,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.trips_for_route.with_raw_response.list( - route_id="", - ) + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py index 5f201f2..4d2e659 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -2,27 +2,33 @@ from __future__ import annotations -import os -from typing import Any, cast +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -import pytest +from onebusaway.types import VehiclesForAgencyListResponse +from typing import cast, Any + +import os +import pytest +import httpx +from typing_extensions import get_args +from respx import MockRouter from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import VehiclesForAgencyListResponse +from onebusaway.types import vehicles_for_agency_list_params base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestVehiclesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: vehicles_for_agency = client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,49 +36,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) - - + client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) class TestAsyncVehiclesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: vehicles_for_agency = await async_client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -80,35 +86,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) + await async_client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index d166173..763d201 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,16 +1,18 @@ from __future__ import annotations -import os import logging -from typing import TYPE_CHECKING, Iterator, AsyncIterator +from typing import Iterator import pytest from pytest_asyncio import is_async_test +import os +from typing import TYPE_CHECKING, AsyncIterator + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") @@ -30,22 +32,20 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: api_key = "My API Key" - @pytest.fixture(scope="session") def client(request: FixtureRequest) -> Iterator[OnebusawaySDK]: - strict = getattr(request, "param", True) + strict = getattr(request, 'param', True) if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') - with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : yield client - @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOnebusawaySDK]: - strict = getattr(request, "param", True) + strict = getattr(request, 'param', True) if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') - async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : yield client diff --git a/tests/test_client.py b/tests/test_client.py index 7b650cc..32505e6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,54 +2,60 @@ from __future__ import annotations -import gc -import os +import httpx + +import subprocess + import sys -import json + import time + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK + +from onebusaway._exceptions import APITimeoutError, APIStatusError, APIResponseValidationError + +from typing import cast, Any, Union + +from pydantic import ValidationError + +from typing_extensions import Literal + +from textwrap import dedent + import asyncio +import gc import inspect -import subprocess +import json +import os import tracemalloc import urllib.parse -from typing import Any, Union, cast -from textwrap import dedent from unittest import mock -from typing_extensions import Literal import httpx import pytest from respx import MockRouter -from pydantic import ValidationError from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError -from onebusaway._types import Omit -from onebusaway._models import BaseModel, FinalRequestOptions +from onebusaway._models import FinalRequestOptions, BaseModel +from onebusaway._types import NOT_GIVEN, Headers, NotGiven, Query, Body, Timeout, Omit +from onebusaway._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, RequestOptions, make_request_options +from onebusaway._streaming import Stream, AsyncStream from onebusaway._constants import RAW_RESPONSE_HEADER -from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError -from onebusaway._base_client import ( - DEFAULT_TIMEOUT, - HTTPX_DEFAULT_TIMEOUT, - BaseClient, - make_request_options, -) - +from onebusaway._response import APIResponse, AsyncAPIResponse +from onebusaway._types import Omit from .utils import update_env base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" - def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]: - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - url = httpx.URL(request.url) - return dict(url.params) - + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + url = httpx.URL(request.url) + return dict(url.params) def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 - def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -57,7 +63,6 @@ def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: pool = transport._pool return len(pool._requests) - class TestOnebusawaySDK: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -72,9 +77,7 @@ def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock( - return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') - ) + respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) response = self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -106,58 +109,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - assert client.default_headers["X-Foo"] == "bar" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + assert client.default_headers['X-Foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers['X-Foo'] == 'bar' # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) - assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + copied = client.copy(default_headers={'X-Bar': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers['X-Bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={'X-Foo': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'stainless' # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get("X-Foo") is None + assert copied.default_headers.get('X-Foo') is None - copied = client.copy(set_default_headers={"X-Bar": "Robert"}) - assert copied.default_headers["X-Bar"] == "Robert" + copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) + assert copied.default_headers['X-Bar'] == 'Robert' with pytest.raises( - ValueError, - match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ValueError, + match='`default_headers` and `set_default_headers` arguments are mutually exclusive', ): - client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) def test_copy_default_query(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} - ) - assert _get_params(client)["foo"] == "bar" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "foo": "bar" + }) + assert _get_params(client)['foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)["foo"] == "bar" + assert _get_params(copied)['foo'] == 'bar' # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={'bar': 'stainless'}) params = _get_params(copied) - assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params['foo'] == 'bar' + assert params['bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={'foo': 'stainless'}) + assert _get_params(copied)['foo'] == 'stainless' # set_default_query @@ -165,21 +168,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={"bar": "Robert"}) - assert _get_params(copied)["bar"] == "Robert" + copied = client.copy(set_default_query={'bar': 'Robert'}) + assert _get_params(copied)['bar'] == 'Robert' with pytest.raises( - ValueError, - # TODO: update - match="`default_query` and `set_default_query` arguments are mutually exclusive", + ValueError, + # TODO: update + match='`default_query` and `set_default_query` arguments are mutually exclusive', ): - client.copy(set_default_query={}, default_query={"foo": "Bar", "key": api_key}) + client.copy(set_default_query={}, default_query={'foo': 'Bar', "key": api_key}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -265,9 +268,7 @@ def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) def test_client_timeout_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -276,70 +277,54 @@ def test_client_timeout_option(self) -> None: def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default async def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match="Invalid `http_client` arg"): - async with httpx.AsyncClient() as http_client: - OnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - http_client=cast(Any, http_client), - ) + with pytest.raises(TypeError, match='Invalid `http_client` arg') : + async with httpx.AsyncClient() as http_client : + OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) def test_default_headers_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" - - client2 = OnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }, - ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'bar' + assert request.headers.get('x-stainless-lang') == 'python' + + client2 = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }) + request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'stainless' + assert request.headers.get('x-stainless-lang') == 'my-overriding-header' def test_default_query_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "query_param": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) url = httpx.URL(request.url) assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -351,7 +336,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -434,7 +419,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2", "key": api_key} + assert params == {'bar': '1', 'foo': '2', "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -448,7 +433,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {'foo': '2', "key": api_key} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -487,29 +472,27 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" - + assert response.foo == 'bar' @pytest.mark.respx(base_url=base_url) def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" - class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" + assert response.foo == 'bar' - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -520,7 +503,6 @@ def test_non_application_json_content_type_for_json_data(self, respx_mock: MockR """ Response that sets Content-Type to something other than application/json but returns json data """ - class Model(BaseModel): foo: int @@ -537,9 +519,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = OnebusawaySDK( - base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True - ) + client = OnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -547,25 +527,11 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): - client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == "http://localhost:5000/from/env/" + with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): + client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == 'http://localhost:5000/from/env/' - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -577,21 +543,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -603,21 +555,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_absolute_request_url(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -643,9 +581,9 @@ def test_copied_client_does_not_close_http(self) -> None: def test_client_context_manager(self) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -662,9 +600,7 @@ class Model(BaseModel): def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) - ) + OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: @@ -676,7 +612,7 @@ class Model(BaseModel): strict_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - strict_client.get("/foo", cast_to=Model) + strict_client.get("/foo", cast_to=Model) client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -684,26 +620,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], - [3, "60", 60], - [3, "61", 0.5], - [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [ 3, "20", 20 ], + [ 3, "0", 0.5 ], + [ 3, "-10", 0.5 ], + [ 3, "60", 60 ], + [ 3, "61", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], + [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], + [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], + [ 3, "99999999999999999999999999999999999", 0.5 ], + [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "", 0.5 ], + [ 2, "", 0.5 * 2.0 ], + [ 1, "", 0.5 * 4.0 ], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -711,7 +647,7 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -719,11 +655,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -733,11 +665,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -750,7 +678,7 @@ def test_retries_taken( client: OnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -761,7 +689,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -776,7 +704,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_omit_retry_count_header( - self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + client: OnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -791,15 +722,18 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": Omit()}) + response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_overwrite_retry_count_header( - self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + client: OnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -814,11 +748,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) - - assert response.http_request.headers.get("x-stainless-retry-count") == "42" - + response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) + assert response.http_request.headers.get('x-stainless-retry-count') == '42' class TestAsyncOnebusawaySDK: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -835,9 +767,7 @@ async def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock( - return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') - ) + respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) response = await self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -869,58 +799,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - assert client.default_headers["X-Foo"] == "bar" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + assert client.default_headers['X-Foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers['X-Foo'] == 'bar' # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) - assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + copied = client.copy(default_headers={'X-Bar': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers['X-Bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={'X-Foo': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'stainless' # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get("X-Foo") is None + assert copied.default_headers.get('X-Foo') is None - copied = client.copy(set_default_headers={"X-Bar": "Robert"}) - assert copied.default_headers["X-Bar"] == "Robert" + copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) + assert copied.default_headers['X-Bar'] == 'Robert' with pytest.raises( - ValueError, - match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ValueError, + match='`default_headers` and `set_default_headers` arguments are mutually exclusive', ): - client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) def test_copy_default_query(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} - ) - assert _get_params(client)["foo"] == "bar" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "foo": "bar" + }) + assert _get_params(client)['foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)["foo"] == "bar" + assert _get_params(copied)['foo'] == 'bar' # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={'bar': 'stainless'}) params = _get_params(copied) - assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params['foo'] == 'bar' + assert params['bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={'foo': 'stainless'}) + assert _get_params(copied)['foo'] == 'stainless' # set_default_query @@ -928,21 +858,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={"bar": "Robert"}) - assert _get_params(copied)["bar"] == "Robert" + copied = client.copy(set_default_query={'bar': 'Robert'}) + assert _get_params(copied)['bar'] == 'Robert' with pytest.raises( - ValueError, - # TODO: update - match="`default_query` and `set_default_query` arguments are mutually exclusive", + ValueError, + # TODO: update + match='`default_query` and `set_default_query` arguments are mutually exclusive', ): - client.copy(set_default_query={}, default_query={"foo": "Bar"}) + client.copy(set_default_query={}, default_query={'foo': 'Bar'}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -1027,9 +957,7 @@ async def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) async def test_client_timeout_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1038,70 +966,54 @@ async def test_client_timeout_option(self) -> None: async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match="Invalid `http_client` arg"): - with httpx.Client() as http_client: - AsyncOnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - http_client=cast(Any, http_client), - ) + with pytest.raises(TypeError, match='Invalid `http_client` arg') : + with httpx.Client() as http_client : + AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) def test_default_headers_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" - - client2 = AsyncOnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }, - ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'bar' + assert request.headers.get('x-stainless-lang') == 'python' + + client2 = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }) + request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'stainless' + assert request.headers.get('x-stainless-lang') == 'my-overriding-header' def test_default_query_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "query_param": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) url = httpx.URL(request.url) # Include the 'key' in the expected params assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -1114,7 +1026,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1197,7 +1109,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2", "key": api_key} + assert params == {'bar': '1', 'foo': '2', "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( FinalRequestOptions( @@ -1210,7 +1122,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {'foo': '2', "key": api_key} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1249,29 +1161,27 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" - + assert response.foo == 'bar' @pytest.mark.respx(base_url=base_url) async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" - class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" + assert response.foo == 'bar' - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -1282,7 +1192,6 @@ async def test_non_application_json_content_type_for_json_data(self, respx_mock: """ Response that sets Content-Type to something other than application/json but returns json data """ - class Model(BaseModel): foo: int @@ -1299,9 +1208,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = AsyncOnebusawaySDK( - base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True - ) + client = AsyncOnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -1309,25 +1216,11 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): - client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == "http://localhost:5000/from/env/" + with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): + client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == 'http://localhost:5000/from/env/' - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1339,21 +1232,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: excepted_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == excepted_url - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1366,21 +1245,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1407,9 +1272,9 @@ async def test_copied_client_does_not_close_http(self) -> None: async def test_client_context_manager(self) -> None: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -1427,9 +1292,7 @@ class Model(BaseModel): async def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) - ) + AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio @@ -1442,7 +1305,7 @@ class Model(BaseModel): strict_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - await strict_client.get("/foo", cast_to=Model) + await strict_client.get("/foo", cast_to=Model) client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -1450,26 +1313,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], - [3, "60", 60], - [3, "61", 0.5], - [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [ 3, "20", 20 ], + [ 3, "0", 0.5 ], + [ 3, "-10", 0.5 ], + [ 3, "60", 60 ], + [ 3, "61", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], + [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], + [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], + [ 3, "99999999999999999999999999999999999", 0.5 ], + [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "", 0.5 ], + [ 2, "", 0.5 * 2.0 ], + [ 1, "", 0.5 * 4.0 ], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @pytest.mark.asyncio async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: @@ -1478,7 +1341,7 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1486,11 +1349,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -1500,11 +1359,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -1518,7 +1373,7 @@ async def test_retries_taken( async_client: AsyncOnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1529,7 +1384,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -1545,7 +1400,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_omit_retry_count_header( - self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1560,18 +1418,19 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve( - extra_headers={"x-stainless-retry-count": Omit()} - ) + response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_overwrite_retry_count_header( - self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1586,9 +1445,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) + response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) - assert response.http_request.headers.get("x-stainless-retry-count") == "42" + assert response.http_request.headers.get('x-stainless-retry-count') == '42' def test_get_platform(self) -> None: # A previous implementation of asyncify could leave threads unterminated when @@ -1624,13 +1483,17 @@ async def test_main() -> None: return_code = process.poll() if return_code is not None: if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + raise AssertionError( + "calling get_platform using asyncify resulted in a non-zero exit code" + ) # success break if time.monotonic() - start_time > timeout: process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") + raise AssertionError( + "calling get_platform using asyncify resulted in a hung process" + ) time.sleep(0.1) diff --git a/tests/test_models.py b/tests/test_models.py index d3499d2..682ff07 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -520,6 +520,7 @@ class Model(BaseModel): assert m3.to_dict(exclude_none=True) == {} assert m3.to_dict(exclude_defaults=True) == {} + class Model2(BaseModel): created_at: datetime @@ -830,20 +831,20 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(not PYDANTIC_V2, reason='TypeAliasType is not supported in Pydantic v1') def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) class Model(BaseModel): alias: Alias union: Union[int, Alias] - - m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + + m = construct_type(value={'alias': 'foo', 'union': 'bar'}, type_=Model) assert isinstance(m, Model) assert isinstance(m.alias, str) - assert m.alias == "foo" + assert m.alias == 'foo' assert isinstance(m.union, str) - assert m.union == "bar" + assert m.union == 'bar' @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 64498cb..c82ceb3 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -28,7 +28,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_data_missing_event(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_data_missing_event( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b'data: {"foo":true}\n' yield b"\n" @@ -44,7 +46,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_event_missing_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_event_missing_data( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -60,7 +64,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_events( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -82,7 +88,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events_with_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_events_with_data( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b'data: {"foo":true}\n' @@ -149,7 +157,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_data_lines(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_data_lines( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"data: {\n" diff --git a/tests/test_transform.py b/tests/test_transform.py index 352d7ae..ee24d7b 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -191,18 +191,16 @@ async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") tz = "Z" if PYDANTIC_V2 else "+00:00" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { - "foo": "2023-02-23" - } # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] @parametrize @@ -392,9 +390,11 @@ def my_iter() -> Iterable[Baz8]: @pytest.mark.asyncio async def test_dictionary_items(use_async: bool) -> None: class DictItems(TypedDict): - foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + foo_baz: Annotated[str, PropertyInfo(alias='fooBaz')] - assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == { + "foo": {"fooBaz": "bar"} + } class TypedDictIterableUnionStr(TypedDict): From f783dc50eaaf1ca31702d08ded4d09bf4833a558 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 16:36:41 +0000 Subject: [PATCH 215/397] release: 1.8.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dc8ed9b..2171c6e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.4" + ".": "1.8.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3934b2e..7545938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.8.5 (2025-05-15) + +Full Changelog: [v1.8.4...v1.8.5](https://github.com/OneBusAway/python-sdk/compare/v1.8.4...v1.8.5) + +### Chores + +* **internal:** codegen related update ([#288](https://github.com/OneBusAway/python-sdk/issues/288)) ([d301a0c](https://github.com/OneBusAway/python-sdk/commit/d301a0cf24104ff0d791046c99093f3c47365bf3)) + ## 1.8.4 (2025-03-27) Full Changelog: [v1.8.3...v1.8.4](https://github.com/OneBusAway/python-sdk/compare/v1.8.3...v1.8.4) diff --git a/pyproject.toml b/pyproject.toml index 6b048b7..ee6e992 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.4" +version = "1.8.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index e4402cd..ac2c376 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.4" # x-release-please-version +__version__ = "1.8.5" # x-release-please-version From d50bcd8e3c6f4aa4710ff7b8ff322a1d4aa1add4 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 15 May 2025 19:56:12 +0300 Subject: [PATCH 216/397] chore: rye linting --- src/onebusaway/__init__.py | 41 ++- src/onebusaway/_base_client.py | 2 - src/onebusaway/_client.py | 79 +++-- src/onebusaway/_exceptions.py | 4 +- src/onebusaway/_resource.py | 4 +- src/onebusaway/_response.py | 4 +- src/onebusaway/_streaming.py | 4 +- src/onebusaway/_types.py | 4 - src/onebusaway/resources/__init__.py | 280 ++++++++++++++---- .../resources/agencies_with_coverage.py | 21 +- src/onebusaway/resources/agency.py | 21 +- .../resources/arrival_and_departure.py | 38 ++- src/onebusaway/resources/block.py | 21 +- src/onebusaway/resources/config.py | 21 +- src/onebusaway/resources/current_time.py | 21 +- .../resources/report_problem_with_stop.py | 33 +-- .../resources/report_problem_with_trip.py | 33 +-- src/onebusaway/resources/route.py | 21 +- .../resources/route_ids_for_agency.py | 21 +- src/onebusaway/resources/routes_for_agency.py | 21 +- .../resources/routes_for_location.py | 29 +- .../resources/schedule_for_route.py | 36 ++- src/onebusaway/resources/schedule_for_stop.py | 36 ++- src/onebusaway/resources/search_for_route.py | 29 +- src/onebusaway/resources/search_for_stop.py | 29 +- src/onebusaway/resources/shape.py | 21 +- src/onebusaway/resources/stop.py | 21 +- .../resources/stop_ids_for_agency.py | 21 +- src/onebusaway/resources/stops_for_agency.py | 21 +- .../resources/stops_for_location.py | 29 +- src/onebusaway/resources/stops_for_route.py | 29 +- src/onebusaway/resources/trip.py | 21 +- src/onebusaway/resources/trip_details.py | 29 +- src/onebusaway/resources/trip_for_vehicle.py | 29 +- .../resources/trips_for_location.py | 29 +- src/onebusaway/resources/trips_for_route.py | 29 +- .../resources/vehicles_for_agency.py | 29 +- src/onebusaway/types/__init__.py | 78 ++--- .../agencies_with_coverage_list_response.py | 9 +- .../types/agency_retrieve_response.py | 9 +- .../arrival_and_departure_list_params.py | 8 +- .../arrival_and_departure_list_response.py | 9 +- .../arrival_and_departure_retrieve_params.py | 6 +- ...arrival_and_departure_retrieve_response.py | 9 +- .../types/block_retrieve_response.py | 9 +- .../types/config_retrieve_response.py | 9 +- .../types/current_time_retrieve_response.py | 9 +- ...eport_problem_with_stop_retrieve_params.py | 6 +- ...eport_problem_with_trip_retrieve_params.py | 6 +- .../route_ids_for_agency_list_response.py | 9 +- .../types/route_retrieve_response.py | 9 +- .../types/routes_for_agency_list_response.py | 9 +- .../types/routes_for_location_list_params.py | 6 +- .../routes_for_location_list_response.py | 9 +- .../schedule_for_route_retrieve_params.py | 8 +- .../schedule_for_route_retrieve_response.py | 8 +- .../schedule_for_stop_retrieve_params.py | 8 +- .../schedule_for_stop_retrieve_response.py | 9 +- .../types/search_for_route_list_params.py | 6 +- .../types/search_for_route_list_response.py | 9 +- .../types/search_for_stop_list_params.py | 6 +- .../types/search_for_stop_list_response.py | 9 +- .../types/shape_retrieve_response.py | 7 +- src/onebusaway/types/shared/references.py | 9 +- .../types/shared/response_wrapper.py | 5 +- .../stop_ids_for_agency_list_response.py | 9 +- .../types/stop_retrieve_response.py | 9 +- .../types/stops_for_agency_list_response.py | 9 +- .../types/stops_for_location_list_params.py | 6 +- .../types/stops_for_location_list_response.py | 9 +- .../types/stops_for_route_list_params.py | 6 +- .../types/stops_for_route_list_response.py | 9 +- .../types/trip_detail_retrieve_params.py | 6 +- .../types/trip_detail_retrieve_response.py | 9 +- .../types/trip_for_vehicle_retrieve_params.py | 6 +- .../trip_for_vehicle_retrieve_response.py | 9 +- .../types/trip_retrieve_response.py | 9 +- .../types/trips_for_location_list_params.py | 6 +- .../types/trips_for_location_list_response.py | 9 +- .../types/trips_for_route_list_params.py | 6 +- .../types/trips_for_route_list_response.py | 9 +- .../types/vehicles_for_agency_list_params.py | 4 - .../vehicles_for_agency_list_response.py | 9 +- .../test_agencies_with_coverage.py | 13 +- tests/api_resources/test_agency.py | 13 +- .../test_arrival_and_departure.py | 19 +- tests/api_resources/test_block.py | 13 +- tests/api_resources/test_config.py | 13 +- tests/api_resources/test_current_time.py | 13 +- .../test_report_problem_with_stop.py | 14 +- .../test_report_problem_with_trip.py | 14 +- tests/api_resources/test_route.py | 13 +- .../test_route_ids_for_agency.py | 13 +- tests/api_resources/test_routes_for_agency.py | 13 +- .../api_resources/test_routes_for_location.py | 14 +- .../api_resources/test_schedule_for_route.py | 15 +- tests/api_resources/test_schedule_for_stop.py | 15 +- tests/api_resources/test_search_for_route.py | 14 +- tests/api_resources/test_search_for_stop.py | 14 +- tests/api_resources/test_shape.py | 13 +- tests/api_resources/test_stop.py | 13 +- .../api_resources/test_stop_ids_for_agency.py | 13 +- tests/api_resources/test_stops_for_agency.py | 13 +- .../api_resources/test_stops_for_location.py | 14 +- tests/api_resources/test_stops_for_route.py | 14 +- tests/api_resources/test_trip.py | 13 +- tests/api_resources/test_trip_details.py | 14 +- tests/api_resources/test_trip_for_vehicle.py | 14 +- .../api_resources/test_trips_for_location.py | 14 +- tests/api_resources/test_trips_for_route.py | 14 +- .../api_resources/test_vehicles_for_agency.py | 14 +- tests/conftest.py | 6 +- tests/test_client.py | 45 ++- 113 files changed, 929 insertions(+), 1101 deletions(-) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index e2acc95..948ea95 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -1,16 +1,41 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from . import types -from ._version import __version__, __title__ -from ._client import Timeout,Transport,RequestOptions,Client,AsyncClient,Stream,AsyncStream,OnebusawaySDK,AsyncOnebusawaySDK -from ._exceptions import OnebusawaySDKError,APIError,APIStatusError,APITimeoutError,APIConnectionError,APIResponseValidationError,BadRequestError,AuthenticationError,PermissionDeniedError,NotFoundError,ConflictError,UnprocessableEntityError,RateLimitError,InternalServerError -from ._types import NoneType,Transport,ProxiesTypes,NotGiven,NOT_GIVEN,Omit +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path +from ._client import ( + Client, + Stream, + Timeout, + Transport, + AsyncClient, + AsyncStream, + OnebusawaySDK, + RequestOptions, + AsyncOnebusawaySDK, +) from ._models import BaseModel -from ._constants import DEFAULT_TIMEOUT,DEFAULT_MAX_RETRIES,DEFAULT_CONNECTION_LIMITS -from ._base_client import DefaultHttpxClient,DefaultAsyncHttpxClient -from ._utils._logs import setup_logging as _setup_logging +from ._version import __title__, __version__ from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse +from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS +from ._exceptions import ( + APIError, + ConflictError, + NotFoundError, + APIStatusError, + RateLimitError, + APITimeoutError, + BadRequestError, + APIConnectionError, + OnebusawaySDKError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, + APIResponseValidationError, +) +from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient +from ._utils._logs import setup_logging as _setup_logging __all__ = ["types", "__version__", "__title__", "NoneType", "Transport", "ProxiesTypes", "NotGiven", "NOT_GIVEN", "Omit", "OnebusawaySDKError", "APIError", "APIStatusError", "APITimeoutError", "APIConnectionError", "APIResponseValidationError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError", "Timeout", "RequestOptions", "Client", "AsyncClient", "Stream", "AsyncStream", "OnebusawaySDK", "AsyncOnebusawaySDK", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", "DEFAULT_MAX_RETRIES", "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient"] @@ -24,7 +49,7 @@ for __name in __all__: if not __name.startswith("__"): try: - setattr(__locals[__name], "__module__", "onebusaway") + __locals[__name].__module__ = "onebusaway" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass \ No newline at end of file diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 26cbf6c..f99a333 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -9,7 +9,6 @@ import inspect import logging import platform -import warnings import email.utils from types import TracebackType from random import random @@ -84,7 +83,6 @@ APIConnectionError, APIResponseValidationError, ) -from ._legacy_response import LegacyAPIResponse log: logging.Logger = logging.getLogger(__name__) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index dce7036..e11449e 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -2,45 +2,64 @@ from __future__ import annotations -import httpx - -import os - -from ._streaming import AsyncStream as AsyncStream, Stream as Stream - -from typing import Union, Mapping, Any - -from ._exceptions import OnebusawaySDKError, APIStatusError - -from typing_extensions import override, Self - -from ._utils import get_async_library - -from .resources import agencies_with_coverage, agency, vehicles_for_agency, config, current_time, stops_for_location, stops_for_route, stops_for_agency, stop, stop_ids_for_agency, schedule_for_stop, route, route_ids_for_agency, routes_for_location, routes_for_agency, schedule_for_route, arrival_and_departure, trip, trips_for_location, trip_details, trip_for_vehicle, trips_for_route, report_problem_with_stop, report_problem_with_trip, search_for_stop, search_for_route, block, shape - -from . import _exceptions - import os -import asyncio -import warnings -from typing_extensions import Literal +from typing import Any, Union, Mapping +from typing_extensions import Self, override import httpx -from ._version import __version__ +from . import _exceptions from ._qs import Querystring -from ._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, maybe_coerce_integer, maybe_coerce_float, maybe_coerce_boolean, is_given -from ._types import Omit, NotGiven, Timeout, Transport, ProxiesTypes, RequestOptions, Headers, NoneType, Query, Body, NOT_GIVEN +from ._types import ( + NOT_GIVEN, + Omit, + Timeout, + NotGiven, + Transport, + ProxiesTypes, + RequestOptions, +) +from ._utils import ( + is_given, + get_async_library, +) +from ._version import __version__ +from .resources import ( + stop, + trip, + block, + route, + shape, + agency, + config, + current_time, + trip_details, + search_for_stop, + stops_for_route, + trips_for_route, + search_for_route, + stops_for_agency, + trip_for_vehicle, + routes_for_agency, + schedule_for_stop, + schedule_for_route, + stops_for_location, + trips_for_location, + routes_for_location, + stop_ids_for_agency, + vehicles_for_agency, + route_ids_for_agency, + arrival_and_departure, + agencies_with_coverage, + report_problem_with_stop, + report_problem_with_trip, +) +from ._streaming import Stream as Stream, AsyncStream as AsyncStream +from ._exceptions import APIStatusError, OnebusawaySDKError from ._base_client import ( - DEFAULT_CONNECTION_LIMITS, - DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, - ResponseT, - SyncHttpxClientWrapper, - AsyncHttpxClientWrapper, SyncAPIClient, AsyncAPIClient, - make_request_options, ) __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "OnebusawaySDK", "AsyncOnebusawaySDK", "Client", "AsyncClient"] diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py index af310bb..dad6a31 100644 --- a/src/onebusaway/_exceptions.py +++ b/src/onebusaway/_exceptions.py @@ -2,10 +2,10 @@ from __future__ import annotations -import httpx - from typing_extensions import Literal +import httpx + __all__ = ["BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError"] class OnebusawaySDKError(Exception): diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py index cda700b..e20e5cd 100644 --- a/src/onebusaway/_resource.py +++ b/src/onebusaway/_resource.py @@ -3,10 +3,10 @@ from __future__ import annotations import time -import anyio - from typing import TYPE_CHECKING +import anyio + if TYPE_CHECKING: from ._client import OnebusawaySDK, AsyncOnebusawaySDK diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 02db195..21c87fc 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -25,14 +25,12 @@ import pydantic from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base, is_type_alias_type -from ._streaming import extract_stream_chunk_type +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type from ._exceptions import OnebusawaySDKError, APIResponseValidationError - if TYPE_CHECKING: from ._models import FinalRequestOptions from ._base_client import BaseClient diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 9b91d7e..293ffe5 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -9,9 +9,7 @@ import httpx -from ._utils import is_mapping, is_dict, extract_type_var_from_base -from ._exceptions import APIError -from ._response import APIResponse, AsyncAPIResponse +from ._utils import extract_type_var_from_base if TYPE_CHECKING: from ._client import OnebusawaySDK, AsyncOnebusawaySDK diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 515085c..a457723 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -1,7 +1,6 @@ from __future__ import annotations from os import PathLike -from abc import ABC, abstractmethod from typing import ( IO, TYPE_CHECKING, @@ -14,10 +13,8 @@ Mapping, TypeVar, Callable, - Iterator, Optional, Sequence, - AsyncIterator, ) from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable @@ -28,7 +25,6 @@ if TYPE_CHECKING: from ._models import BaseModel from ._response import APIResponse, AsyncAPIResponse - from ._legacy_response import HttpxBinaryResponseContent Transport = BaseTransport AsyncTransport = AsyncBaseTransport diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 3482e97..c5f49f6 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,60 +1,228 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .agencies_with_coverage import AgenciesWithCoverageResource, AsyncAgenciesWithCoverageResource -from .agencies_with_coverage import AgenciesWithCoverageResourceWithRawResponse, AsyncAgenciesWithCoverageResourceWithRawResponse, AgenciesWithCoverageResourceWithStreamingResponse, AsyncAgenciesWithCoverageResourceWithStreamingResponse -from .agency import AgencyResource, AsyncAgencyResource -from .agency import AgencyResourceWithRawResponse, AsyncAgencyResourceWithRawResponse, AgencyResourceWithStreamingResponse, AsyncAgencyResourceWithStreamingResponse -from .vehicles_for_agency import VehiclesForAgencyResource, AsyncVehiclesForAgencyResource -from .vehicles_for_agency import VehiclesForAgencyResourceWithRawResponse, AsyncVehiclesForAgencyResourceWithRawResponse, VehiclesForAgencyResourceWithStreamingResponse, AsyncVehiclesForAgencyResourceWithStreamingResponse -from .config import ConfigResource, AsyncConfigResource -from .config import ConfigResourceWithRawResponse, AsyncConfigResourceWithRawResponse, ConfigResourceWithStreamingResponse, AsyncConfigResourceWithStreamingResponse -from .current_time import CurrentTimeResource, AsyncCurrentTimeResource -from .current_time import CurrentTimeResourceWithRawResponse, AsyncCurrentTimeResourceWithRawResponse, CurrentTimeResourceWithStreamingResponse, AsyncCurrentTimeResourceWithStreamingResponse -from .stops_for_location import StopsForLocationResource, AsyncStopsForLocationResource -from .stops_for_location import StopsForLocationResourceWithRawResponse, AsyncStopsForLocationResourceWithRawResponse, StopsForLocationResourceWithStreamingResponse, AsyncStopsForLocationResourceWithStreamingResponse -from .stops_for_route import StopsForRouteResource, AsyncStopsForRouteResource -from .stops_for_route import StopsForRouteResourceWithRawResponse, AsyncStopsForRouteResourceWithRawResponse, StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse -from .stops_for_agency import StopsForAgencyResource, AsyncStopsForAgencyResource -from .stops_for_agency import StopsForAgencyResourceWithRawResponse, AsyncStopsForAgencyResourceWithRawResponse, StopsForAgencyResourceWithStreamingResponse, AsyncStopsForAgencyResourceWithStreamingResponse -from .stop import StopResource, AsyncStopResource -from .stop import StopResourceWithRawResponse, AsyncStopResourceWithRawResponse, StopResourceWithStreamingResponse, AsyncStopResourceWithStreamingResponse -from .stop_ids_for_agency import StopIDsForAgencyResource, AsyncStopIDsForAgencyResource -from .stop_ids_for_agency import StopIDsForAgencyResourceWithRawResponse, AsyncStopIDsForAgencyResourceWithRawResponse, StopIDsForAgencyResourceWithStreamingResponse, AsyncStopIDsForAgencyResourceWithStreamingResponse -from .schedule_for_stop import ScheduleForStopResource, AsyncScheduleForStopResource -from .schedule_for_stop import ScheduleForStopResourceWithRawResponse, AsyncScheduleForStopResourceWithRawResponse, ScheduleForStopResourceWithStreamingResponse, AsyncScheduleForStopResourceWithStreamingResponse -from .route import RouteResource, AsyncRouteResource -from .route import RouteResourceWithRawResponse, AsyncRouteResourceWithRawResponse, RouteResourceWithStreamingResponse, AsyncRouteResourceWithStreamingResponse -from .route_ids_for_agency import RouteIDsForAgencyResource, AsyncRouteIDsForAgencyResource -from .route_ids_for_agency import RouteIDsForAgencyResourceWithRawResponse, AsyncRouteIDsForAgencyResourceWithRawResponse, RouteIDsForAgencyResourceWithStreamingResponse, AsyncRouteIDsForAgencyResourceWithStreamingResponse -from .routes_for_location import RoutesForLocationResource, AsyncRoutesForLocationResource -from .routes_for_location import RoutesForLocationResourceWithRawResponse, AsyncRoutesForLocationResourceWithRawResponse, RoutesForLocationResourceWithStreamingResponse, AsyncRoutesForLocationResourceWithStreamingResponse -from .routes_for_agency import RoutesForAgencyResource, AsyncRoutesForAgencyResource -from .routes_for_agency import RoutesForAgencyResourceWithRawResponse, AsyncRoutesForAgencyResourceWithRawResponse, RoutesForAgencyResourceWithStreamingResponse, AsyncRoutesForAgencyResourceWithStreamingResponse -from .schedule_for_route import ScheduleForRouteResource, AsyncScheduleForRouteResource -from .schedule_for_route import ScheduleForRouteResourceWithRawResponse, AsyncScheduleForRouteResourceWithRawResponse, ScheduleForRouteResourceWithStreamingResponse, AsyncScheduleForRouteResourceWithStreamingResponse -from .arrival_and_departure import ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource -from .arrival_and_departure import ArrivalAndDepartureResourceWithRawResponse, AsyncArrivalAndDepartureResourceWithRawResponse, ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse -from .trip import TripResource, AsyncTripResource -from .trip import TripResourceWithRawResponse, AsyncTripResourceWithRawResponse, TripResourceWithStreamingResponse, AsyncTripResourceWithStreamingResponse -from .trips_for_location import TripsForLocationResource, AsyncTripsForLocationResource -from .trips_for_location import TripsForLocationResourceWithRawResponse, AsyncTripsForLocationResourceWithRawResponse, TripsForLocationResourceWithStreamingResponse, AsyncTripsForLocationResourceWithStreamingResponse -from .trip_details import TripDetailsResource, AsyncTripDetailsResource -from .trip_details import TripDetailsResourceWithRawResponse, AsyncTripDetailsResourceWithRawResponse, TripDetailsResourceWithStreamingResponse, AsyncTripDetailsResourceWithStreamingResponse -from .trip_for_vehicle import TripForVehicleResource, AsyncTripForVehicleResource -from .trip_for_vehicle import TripForVehicleResourceWithRawResponse, AsyncTripForVehicleResourceWithRawResponse, TripForVehicleResourceWithStreamingResponse, AsyncTripForVehicleResourceWithStreamingResponse -from .trips_for_route import TripsForRouteResource, AsyncTripsForRouteResource -from .trips_for_route import TripsForRouteResourceWithRawResponse, AsyncTripsForRouteResourceWithRawResponse, TripsForRouteResourceWithStreamingResponse, AsyncTripsForRouteResourceWithStreamingResponse -from .report_problem_with_stop import ReportProblemWithStopResource, AsyncReportProblemWithStopResource -from .report_problem_with_stop import ReportProblemWithStopResourceWithRawResponse, AsyncReportProblemWithStopResourceWithRawResponse, ReportProblemWithStopResourceWithStreamingResponse, AsyncReportProblemWithStopResourceWithStreamingResponse -from .report_problem_with_trip import ReportProblemWithTripResource, AsyncReportProblemWithTripResource -from .report_problem_with_trip import ReportProblemWithTripResourceWithRawResponse, AsyncReportProblemWithTripResourceWithRawResponse, ReportProblemWithTripResourceWithStreamingResponse, AsyncReportProblemWithTripResourceWithStreamingResponse -from .search_for_stop import SearchForStopResource, AsyncSearchForStopResource -from .search_for_stop import SearchForStopResourceWithRawResponse, AsyncSearchForStopResourceWithRawResponse, SearchForStopResourceWithStreamingResponse, AsyncSearchForStopResourceWithStreamingResponse -from .search_for_route import SearchForRouteResource, AsyncSearchForRouteResource -from .search_for_route import SearchForRouteResourceWithRawResponse, AsyncSearchForRouteResourceWithRawResponse, SearchForRouteResourceWithStreamingResponse, AsyncSearchForRouteResourceWithStreamingResponse -from .block import BlockResource, AsyncBlockResource -from .block import BlockResourceWithRawResponse, AsyncBlockResourceWithRawResponse, BlockResourceWithStreamingResponse, AsyncBlockResourceWithStreamingResponse -from .shape import ShapeResource, AsyncShapeResource -from .shape import ShapeResourceWithRawResponse, AsyncShapeResourceWithRawResponse, ShapeResourceWithStreamingResponse, AsyncShapeResourceWithStreamingResponse +from .stop import ( + StopResource, + AsyncStopResource, + StopResourceWithRawResponse, + AsyncStopResourceWithRawResponse, + StopResourceWithStreamingResponse, + AsyncStopResourceWithStreamingResponse, +) +from .trip import ( + TripResource, + AsyncTripResource, + TripResourceWithRawResponse, + AsyncTripResourceWithRawResponse, + TripResourceWithStreamingResponse, + AsyncTripResourceWithStreamingResponse, +) +from .block import ( + BlockResource, + AsyncBlockResource, + BlockResourceWithRawResponse, + AsyncBlockResourceWithRawResponse, + BlockResourceWithStreamingResponse, + AsyncBlockResourceWithStreamingResponse, +) +from .route import ( + RouteResource, + AsyncRouteResource, + RouteResourceWithRawResponse, + AsyncRouteResourceWithRawResponse, + RouteResourceWithStreamingResponse, + AsyncRouteResourceWithStreamingResponse, +) +from .shape import ( + ShapeResource, + AsyncShapeResource, + ShapeResourceWithRawResponse, + AsyncShapeResourceWithRawResponse, + ShapeResourceWithStreamingResponse, + AsyncShapeResourceWithStreamingResponse, +) +from .agency import ( + AgencyResource, + AsyncAgencyResource, + AgencyResourceWithRawResponse, + AsyncAgencyResourceWithRawResponse, + AgencyResourceWithStreamingResponse, + AsyncAgencyResourceWithStreamingResponse, +) +from .config import ( + ConfigResource, + AsyncConfigResource, + ConfigResourceWithRawResponse, + AsyncConfigResourceWithRawResponse, + ConfigResourceWithStreamingResponse, + AsyncConfigResourceWithStreamingResponse, +) +from .current_time import ( + CurrentTimeResource, + AsyncCurrentTimeResource, + CurrentTimeResourceWithRawResponse, + AsyncCurrentTimeResourceWithRawResponse, + CurrentTimeResourceWithStreamingResponse, + AsyncCurrentTimeResourceWithStreamingResponse, +) +from .trip_details import ( + TripDetailsResource, + AsyncTripDetailsResource, + TripDetailsResourceWithRawResponse, + AsyncTripDetailsResourceWithRawResponse, + TripDetailsResourceWithStreamingResponse, + AsyncTripDetailsResourceWithStreamingResponse, +) +from .search_for_stop import ( + SearchForStopResource, + AsyncSearchForStopResource, + SearchForStopResourceWithRawResponse, + AsyncSearchForStopResourceWithRawResponse, + SearchForStopResourceWithStreamingResponse, + AsyncSearchForStopResourceWithStreamingResponse, +) +from .stops_for_route import ( + StopsForRouteResource, + AsyncStopsForRouteResource, + StopsForRouteResourceWithRawResponse, + AsyncStopsForRouteResourceWithRawResponse, + StopsForRouteResourceWithStreamingResponse, + AsyncStopsForRouteResourceWithStreamingResponse, +) +from .trips_for_route import ( + TripsForRouteResource, + AsyncTripsForRouteResource, + TripsForRouteResourceWithRawResponse, + AsyncTripsForRouteResourceWithRawResponse, + TripsForRouteResourceWithStreamingResponse, + AsyncTripsForRouteResourceWithStreamingResponse, +) +from .search_for_route import ( + SearchForRouteResource, + AsyncSearchForRouteResource, + SearchForRouteResourceWithRawResponse, + AsyncSearchForRouteResourceWithRawResponse, + SearchForRouteResourceWithStreamingResponse, + AsyncSearchForRouteResourceWithStreamingResponse, +) +from .stops_for_agency import ( + StopsForAgencyResource, + AsyncStopsForAgencyResource, + StopsForAgencyResourceWithRawResponse, + AsyncStopsForAgencyResourceWithRawResponse, + StopsForAgencyResourceWithStreamingResponse, + AsyncStopsForAgencyResourceWithStreamingResponse, +) +from .trip_for_vehicle import ( + TripForVehicleResource, + AsyncTripForVehicleResource, + TripForVehicleResourceWithRawResponse, + AsyncTripForVehicleResourceWithRawResponse, + TripForVehicleResourceWithStreamingResponse, + AsyncTripForVehicleResourceWithStreamingResponse, +) +from .routes_for_agency import ( + RoutesForAgencyResource, + AsyncRoutesForAgencyResource, + RoutesForAgencyResourceWithRawResponse, + AsyncRoutesForAgencyResourceWithRawResponse, + RoutesForAgencyResourceWithStreamingResponse, + AsyncRoutesForAgencyResourceWithStreamingResponse, +) +from .schedule_for_stop import ( + ScheduleForStopResource, + AsyncScheduleForStopResource, + ScheduleForStopResourceWithRawResponse, + AsyncScheduleForStopResourceWithRawResponse, + ScheduleForStopResourceWithStreamingResponse, + AsyncScheduleForStopResourceWithStreamingResponse, +) +from .schedule_for_route import ( + ScheduleForRouteResource, + AsyncScheduleForRouteResource, + ScheduleForRouteResourceWithRawResponse, + AsyncScheduleForRouteResourceWithRawResponse, + ScheduleForRouteResourceWithStreamingResponse, + AsyncScheduleForRouteResourceWithStreamingResponse, +) +from .stops_for_location import ( + StopsForLocationResource, + AsyncStopsForLocationResource, + StopsForLocationResourceWithRawResponse, + AsyncStopsForLocationResourceWithRawResponse, + StopsForLocationResourceWithStreamingResponse, + AsyncStopsForLocationResourceWithStreamingResponse, +) +from .trips_for_location import ( + TripsForLocationResource, + AsyncTripsForLocationResource, + TripsForLocationResourceWithRawResponse, + AsyncTripsForLocationResourceWithRawResponse, + TripsForLocationResourceWithStreamingResponse, + AsyncTripsForLocationResourceWithStreamingResponse, +) +from .routes_for_location import ( + RoutesForLocationResource, + AsyncRoutesForLocationResource, + RoutesForLocationResourceWithRawResponse, + AsyncRoutesForLocationResourceWithRawResponse, + RoutesForLocationResourceWithStreamingResponse, + AsyncRoutesForLocationResourceWithStreamingResponse, +) +from .stop_ids_for_agency import ( + StopIDsForAgencyResource, + AsyncStopIDsForAgencyResource, + StopIDsForAgencyResourceWithRawResponse, + AsyncStopIDsForAgencyResourceWithRawResponse, + StopIDsForAgencyResourceWithStreamingResponse, + AsyncStopIDsForAgencyResourceWithStreamingResponse, +) +from .vehicles_for_agency import ( + VehiclesForAgencyResource, + AsyncVehiclesForAgencyResource, + VehiclesForAgencyResourceWithRawResponse, + AsyncVehiclesForAgencyResourceWithRawResponse, + VehiclesForAgencyResourceWithStreamingResponse, + AsyncVehiclesForAgencyResourceWithStreamingResponse, +) +from .route_ids_for_agency import ( + RouteIDsForAgencyResource, + AsyncRouteIDsForAgencyResource, + RouteIDsForAgencyResourceWithRawResponse, + AsyncRouteIDsForAgencyResourceWithRawResponse, + RouteIDsForAgencyResourceWithStreamingResponse, + AsyncRouteIDsForAgencyResourceWithStreamingResponse, +) +from .arrival_and_departure import ( + ArrivalAndDepartureResource, + AsyncArrivalAndDepartureResource, + ArrivalAndDepartureResourceWithRawResponse, + AsyncArrivalAndDepartureResourceWithRawResponse, + ArrivalAndDepartureResourceWithStreamingResponse, + AsyncArrivalAndDepartureResourceWithStreamingResponse, +) +from .agencies_with_coverage import ( + AgenciesWithCoverageResource, + AsyncAgenciesWithCoverageResource, + AgenciesWithCoverageResourceWithRawResponse, + AsyncAgenciesWithCoverageResourceWithRawResponse, + AgenciesWithCoverageResourceWithStreamingResponse, + AsyncAgenciesWithCoverageResourceWithStreamingResponse, +) +from .report_problem_with_stop import ( + ReportProblemWithStopResource, + AsyncReportProblemWithStopResource, + ReportProblemWithStopResourceWithRawResponse, + AsyncReportProblemWithStopResourceWithRawResponse, + ReportProblemWithStopResourceWithStreamingResponse, + AsyncReportProblemWithStopResourceWithStreamingResponse, +) +from .report_problem_with_trip import ( + ReportProblemWithTripResource, + AsyncReportProblemWithTripResource, + ReportProblemWithTripResourceWithRawResponse, + AsyncReportProblemWithTripResourceWithRawResponse, + ReportProblemWithTripResourceWithStreamingResponse, + AsyncReportProblemWithTripResourceWithStreamingResponse, +) __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource", "AgenciesWithCoverageResourceWithRawResponse", "AsyncAgenciesWithCoverageResourceWithRawResponse", "AgenciesWithCoverageResourceWithStreamingResponse", "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", "AsyncAgencyResourceWithRawResponse", "AgencyResourceWithStreamingResponse", "AsyncAgencyResourceWithStreamingResponse", "VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource", "VehiclesForAgencyResourceWithRawResponse", "AsyncVehiclesForAgencyResourceWithRawResponse", "VehiclesForAgencyResourceWithStreamingResponse", "AsyncVehiclesForAgencyResourceWithStreamingResponse", "ConfigResource", "AsyncConfigResource", "ConfigResourceWithRawResponse", "AsyncConfigResourceWithRawResponse", "ConfigResourceWithStreamingResponse", "AsyncConfigResourceWithStreamingResponse", "CurrentTimeResource", "AsyncCurrentTimeResource", "CurrentTimeResourceWithRawResponse", "AsyncCurrentTimeResourceWithRawResponse", "CurrentTimeResourceWithStreamingResponse", "AsyncCurrentTimeResourceWithStreamingResponse", "StopsForLocationResource", "AsyncStopsForLocationResource", "StopsForLocationResourceWithRawResponse", "AsyncStopsForLocationResourceWithRawResponse", "StopsForLocationResourceWithStreamingResponse", "AsyncStopsForLocationResourceWithStreamingResponse", "StopsForRouteResource", "AsyncStopsForRouteResource", "StopsForRouteResourceWithRawResponse", "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", "StopsForAgencyResource", "AsyncStopsForAgencyResource", "StopsForAgencyResourceWithRawResponse", "AsyncStopsForAgencyResourceWithRawResponse", "StopsForAgencyResourceWithStreamingResponse", "AsyncStopsForAgencyResourceWithStreamingResponse", "StopResource", "AsyncStopResource", "StopResourceWithRawResponse", "AsyncStopResourceWithRawResponse", "StopResourceWithStreamingResponse", "AsyncStopResourceWithStreamingResponse", "StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource", "StopIDsForAgencyResourceWithRawResponse", "AsyncStopIDsForAgencyResourceWithRawResponse", "StopIDsForAgencyResourceWithStreamingResponse", "AsyncStopIDsForAgencyResourceWithStreamingResponse", "ScheduleForStopResource", "AsyncScheduleForStopResource", "ScheduleForStopResourceWithRawResponse", "AsyncScheduleForStopResourceWithRawResponse", "ScheduleForStopResourceWithStreamingResponse", "AsyncScheduleForStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", "AsyncRouteResourceWithRawResponse", "RouteResourceWithStreamingResponse", "AsyncRouteResourceWithStreamingResponse", "RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource", "RouteIDsForAgencyResourceWithRawResponse", "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", "RoutesForLocationResource", "AsyncRoutesForLocationResource", "RoutesForLocationResourceWithRawResponse", "AsyncRoutesForLocationResourceWithRawResponse", "RoutesForLocationResourceWithStreamingResponse", "AsyncRoutesForLocationResourceWithStreamingResponse", "RoutesForAgencyResource", "AsyncRoutesForAgencyResource", "RoutesForAgencyResourceWithRawResponse", "AsyncRoutesForAgencyResourceWithRawResponse", "RoutesForAgencyResourceWithStreamingResponse", "AsyncRoutesForAgencyResourceWithStreamingResponse", "ScheduleForRouteResource", "AsyncScheduleForRouteResource", "ScheduleForRouteResourceWithRawResponse", "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", "AsyncArrivalAndDepartureResourceWithRawResponse", "ArrivalAndDepartureResourceWithStreamingResponse", "AsyncArrivalAndDepartureResourceWithStreamingResponse", "TripResource", "AsyncTripResource", "TripResourceWithRawResponse", "AsyncTripResourceWithRawResponse", "TripResourceWithStreamingResponse", "AsyncTripResourceWithStreamingResponse", "TripsForLocationResource", "AsyncTripsForLocationResource", "TripsForLocationResourceWithRawResponse", "AsyncTripsForLocationResourceWithRawResponse", "TripsForLocationResourceWithStreamingResponse", "AsyncTripsForLocationResourceWithStreamingResponse", "TripDetailsResource", "AsyncTripDetailsResource", "TripDetailsResourceWithRawResponse", "AsyncTripDetailsResourceWithRawResponse", "TripDetailsResourceWithStreamingResponse", "AsyncTripDetailsResourceWithStreamingResponse", "TripForVehicleResource", "AsyncTripForVehicleResource", "TripForVehicleResourceWithRawResponse", "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", "TripsForRouteResource", "AsyncTripsForRouteResource", "TripsForRouteResourceWithRawResponse", "AsyncTripsForRouteResourceWithRawResponse", "TripsForRouteResourceWithStreamingResponse", "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", "ReportProblemWithTripResource", "AsyncReportProblemWithTripResource", "ReportProblemWithTripResourceWithRawResponse", "AsyncReportProblemWithTripResourceWithRawResponse", "ReportProblemWithTripResourceWithStreamingResponse", "AsyncReportProblemWithTripResourceWithStreamingResponse", "SearchForStopResource", "AsyncSearchForStopResource", "SearchForStopResourceWithRawResponse", "AsyncSearchForStopResourceWithRawResponse", "SearchForStopResourceWithStreamingResponse", "AsyncSearchForStopResourceWithStreamingResponse", "SearchForRouteResource", "AsyncSearchForRouteResource", "SearchForRouteResourceWithRawResponse", "AsyncSearchForRouteResourceWithRawResponse", "SearchForRouteResourceWithStreamingResponse", "AsyncSearchForRouteResourceWithStreamingResponse", "BlockResource", "AsyncBlockResource", "BlockResourceWithRawResponse", "AsyncBlockResourceWithRawResponse", "BlockResourceWithStreamingResponse", "AsyncBlockResourceWithStreamingResponse", "ShapeResource", "AsyncShapeResource", "ShapeResourceWithRawResponse", "AsyncShapeResourceWithRawResponse", "ShapeResourceWithStreamingResponse", "AsyncShapeResourceWithStreamingResponse"] \ No newline at end of file diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index 2fa6042..ad26d0d 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 2d8da26..90ac9ae 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.agency_retrieve_response import AgencyRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.agency_retrieve_response import AgencyRetrieveResponse __all__ = ["AgencyResource", "AsyncAgencyResource"] diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 7bba1a2..3daac58 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -2,32 +2,28 @@ from __future__ import annotations -import httpx - -from .._compat import cached_property - -from ..types.arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from ..types.arrival_and_departure_list_response import ArrivalAndDepartureListResponse - from typing import Union - from datetime import datetime -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import httpx -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent +from ..types import arrival_and_departure_list_params, arrival_and_departure_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import arrival_and_departure_retrieve_params -from ..types import arrival_and_departure_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.arrival_and_departure_list_response import ArrivalAndDepartureListResponse +from ..types.arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse __all__ = ["ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource"] diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index ec955eb..66e28a8 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.block_retrieve_response import BlockRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.block_retrieve_response import BlockRetrieveResponse __all__ = ["BlockResource", "AsyncBlockResource"] diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 29269b8..e52cb1e 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.config_retrieve_response import ConfigRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.config_retrieve_response import ConfigRetrieveResponse __all__ = ["ConfigResource", "AsyncConfigResource"] diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 5dfc9bc..b4b29d5 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.current_time_retrieve_response import CurrentTimeRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.current_time_retrieve_response import CurrentTimeRetrieveResponse __all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index 34f4c72..0c26ff9 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -2,27 +2,26 @@ from __future__ import annotations -import httpx - -from .._compat import cached_property - -from ..types.shared.response_wrapper import ResponseWrapper - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - from typing_extensions import Literal -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import httpx -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent -from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params from ..types import report_problem_with_stop_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shared.response_wrapper import ResponseWrapper __all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index 668f903..b2506b5 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -2,27 +2,26 @@ from __future__ import annotations -import httpx - -from .._compat import cached_property - -from ..types.shared.response_wrapper import ResponseWrapper - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - from typing_extensions import Literal -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import httpx -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent -from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params from ..types import report_problem_with_trip_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shared.response_wrapper import ResponseWrapper __all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 5b420e8..adc785a 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.route_retrieve_response import RouteRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.route_retrieve_response import RouteRetrieveResponse __all__ = ["RouteResource", "AsyncRouteResource"] diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index 6f21ee9..7a33d59 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.route_ids_for_agency_list_response import RouteIDsForAgencyListResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.route_ids_for_agency_list_response import RouteIDsForAgencyListResponse __all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index dd9306e..7f1b5ba 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.routes_for_agency_list_response import RoutesForAgencyListResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.routes_for_agency_list_response import RoutesForAgencyListResponse __all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index 7743b84..f43e196 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,23 +4,22 @@ import httpx +from ..types import routes_for_location_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.routes_for_location_list_response import RoutesForLocationListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import routes_for_location_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.routes_for_location_list_response import RoutesForLocationListResponse __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 66c6a54..53a5303 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -2,29 +2,27 @@ from __future__ import annotations -import httpx - -from .._compat import cached_property - -from ..types.schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from datetime import date - from typing import Union +from datetime import date -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import httpx -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent -from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params from ..types import schedule_for_route_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse __all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 5c71e9c..f1dd499 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -2,29 +2,27 @@ from __future__ import annotations -import httpx - -from .._compat import cached_property - -from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from datetime import date - from typing import Union +from datetime import date -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper +import httpx -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent -from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params from ..types import schedule_for_stop_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse __all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index 37f7cb4..b4b3968 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -4,23 +4,22 @@ import httpx +from ..types import search_for_route_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.search_for_route_list_response import SearchForRouteListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import search_for_route_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.search_for_route_list_response import SearchForRouteListResponse __all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index a0320a3..2aba780 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -4,23 +4,22 @@ import httpx +from ..types import search_for_stop_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.search_for_stop_list_response import SearchForStopListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import search_for_stop_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.search_for_stop_list_response import SearchForStopListResponse __all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index ddc989f..7ae390c 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.shape_retrieve_response import ShapeRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.shape_retrieve_response import ShapeRetrieveResponse __all__ = ["ShapeResource", "AsyncShapeResource"] diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index ba53226..5d1f22e 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.stop_retrieve_response import StopRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stop_retrieve_response import StopRetrieveResponse __all__ = ["StopResource", "AsyncStopResource"] diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 55a39cd..5311acd 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.stop_ids_for_agency_list_response import StopIDsForAgencyListResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stop_ids_for_agency_list_response import StopIDsForAgencyListResponse __all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 9e09796..8458527 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.stops_for_agency_list_response import StopsForAgencyListResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stops_for_agency_list_response import StopsForAgencyListResponse __all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index b589d59..3da78db 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,23 +4,22 @@ import httpx +from ..types import stops_for_location_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.stops_for_location_list_response import StopsForLocationListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import stops_for_location_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stops_for_location_list_response import StopsForLocationListResponse __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 454b725..d4c1d80 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -4,23 +4,22 @@ import httpx +from ..types import stops_for_route_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.stops_for_route_list_response import StopsForRouteListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import stops_for_route_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.stops_for_route_list_response import StopsForRouteListResponse __all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index e5a9bb5..c570387 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -4,20 +4,17 @@ import httpx +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property - -from ..types.trip_retrieve_response import TripRetrieveResponse - -from .._base_client import make_request_options - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trip_retrieve_response import TripRetrieveResponse __all__ = ["TripResource", "AsyncTripResource"] diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index cbbb057..4c4fe91 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -4,23 +4,22 @@ import httpx +from ..types import trip_detail_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.trip_detail_retrieve_response import TripDetailRetrieveResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import trip_detail_retrieve_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trip_detail_retrieve_response import TripDetailRetrieveResponse __all__ = ["TripDetailsResource", "AsyncTripDetailsResource"] diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 4327fc7..1a993a1 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -4,23 +4,22 @@ import httpx +from ..types import trip_for_vehicle_retrieve_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import trip_for_vehicle_retrieve_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse __all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"] diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index ab7ba23..f3decf4 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,23 +4,22 @@ import httpx +from ..types import trips_for_location_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.trips_for_location_list_response import TripsForLocationListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import trips_for_location_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trips_for_location_list_response import TripsForLocationListResponse __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index 690ea60..129ab33 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -4,23 +4,22 @@ import httpx +from ..types import trips_for_route_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.trips_for_route_list_response import TripsForRouteListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import trips_for_route_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trips_for_route_list_response import TripsForRouteListResponse __all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 4126bb6..2cd39db 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -4,23 +4,22 @@ import httpx +from ..types import vehicles_for_agency_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) from .._compat import cached_property - -from ..types.vehicles_for_agency_list_response import VehiclesForAgencyListResponse - -from .._base_client import make_request_options - -from .._utils import maybe_transform, async_maybe_transform - -from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper, to_streamed_response_wrapper, async_to_streamed_response_wrapper - -import warnings -from typing_extensions import Literal, overload -from .._utils import extract_files, maybe_transform, required_args, deepcopy_minimal, strip_not_given -from .._types import NotGiven, Timeout, Headers, NoneType, Query, Body, NOT_GIVEN, FileTypes, BinaryResponseContent from .._resource import SyncAPIResource, AsyncAPIResource -from ..types import shared_params -from ..types import vehicles_for_agency_list_params +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.vehicles_for_agency_list_response import VehiclesForAgencyListResponse __all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 634ab48..a4bb996 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -3,46 +3,54 @@ from __future__ import annotations from .shared import References as References, ResponseWrapper as ResponseWrapper -from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse +from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse +from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse +from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse +from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse +from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse -from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse -from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse -from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse -from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse -from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams -from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse +from .search_for_stop_list_params import SearchForStopListParams as SearchForStopListParams from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams +from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams +from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams +from .search_for_route_list_params import SearchForRouteListParams as SearchForRouteListParams +from .search_for_stop_list_response import SearchForStopListResponse as SearchForStopListResponse +from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse +from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse +from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse +from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse from .stops_for_agency_list_response import StopsForAgencyListResponse as StopsForAgencyListResponse -from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse -from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse -from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams +from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams +from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams +from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams +from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse +from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams +from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse +from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams -from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse +from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse +from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse -from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse -from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams -from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse -from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams -from .arrival_and_departure_retrieve_response import ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse -from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse -from .arrival_and_departure_retrieve_params import ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams -from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams -from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse -from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse -from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams -from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse -from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse -from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams -from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse -from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams -from .report_problem_with_stop_retrieve_params import ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams -from .report_problem_with_trip_retrieve_params import ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams -from .search_for_stop_list_response import SearchForStopListResponse as SearchForStopListResponse -from .search_for_stop_list_params import SearchForStopListParams as SearchForStopListParams -from .search_for_route_list_response import SearchForRouteListResponse as SearchForRouteListResponse -from .search_for_route_list_params import SearchForRouteListParams as SearchForRouteListParams -from .block_retrieve_response import BlockRetrieveResponse as BlockRetrieveResponse -from .shape_retrieve_response import ShapeRetrieveResponse as ShapeRetrieveResponse \ No newline at end of file +from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse +from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse +from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse +from .arrival_and_departure_retrieve_params import ( + ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, +) +from .arrival_and_departure_retrieve_response import ( + ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, +) +from .report_problem_with_stop_retrieve_params import ( + ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, +) +from .report_problem_with_trip_retrieve_params import ( + ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams, +) diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py index 4a5b82d..d972228 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["AgenciesWithCoverageListResponse", "AgenciesWithCoverageListResponseData", "AgenciesWithCoverageListResponseDataList"] class AgenciesWithCoverageListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 037963c..a599b3c 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["AgencyRetrieveResponse", "AgencyRetrieveResponseData", "AgencyRetrieveResponseDataEntry"] class AgencyRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py index 8205ce6..79b8ee0 100644 --- a/src/onebusaway/types/arrival_and_departure_list_params.py +++ b/src/onebusaway/types/arrival_and_departure_list_params.py @@ -2,16 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated - -from .._utils import PropertyInfo - from typing import Union - from datetime import datetime +from typing_extensions import Annotated, TypedDict -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes from .._utils import PropertyInfo __all__ = ["ArrivalAndDepartureListParams"] diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 87f8287..65e555a 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["ArrivalAndDepartureListResponse", "ArrivalAndDepartureListResponseData", "ArrivalAndDepartureListResponseDataEntry", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition"] class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py index 1bddc55..ea44970 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_params.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated, Required +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["ArrivalAndDepartureRetrieveParams"] class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index 78120ae..5b73f1f 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["ArrivalAndDepartureRetrieveResponse", "ArrivalAndDepartureRetrieveResponseData", "ArrivalAndDepartureRetrieveResponseDataEntry", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition"] class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py index ceb636d..abd6b68 100644 --- a/src/onebusaway/types/block_retrieve_response.py +++ b/src/onebusaway/types/block_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["BlockRetrieveResponse", "BlockRetrieveResponseData", "BlockRetrieveResponseDataEntry", "BlockRetrieveResponseDataEntryConfiguration", "BlockRetrieveResponseDataEntryConfigurationTrip", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime"] class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime(BaseModel): diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index ace5e26..c81ccf4 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["ConfigRetrieveResponse", "ConfigRetrieveResponseData", "ConfigRetrieveResponseDataEntry", "ConfigRetrieveResponseDataEntryGitProperties"] class ConfigRetrieveResponseDataEntryGitProperties(BaseModel): diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 80fc92a..90377e3 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["CurrentTimeRetrieveResponse", "CurrentTimeRetrieveResponseData", "CurrentTimeRetrieveResponseDataEntry"] class CurrentTimeRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py index 6889773..559f5b8 100644 --- a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Literal, Annotated +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["ReportProblemWithStopRetrieveParams"] class ReportProblemWithStopRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py index 94dc84e..03bd538 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Literal, Annotated +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["ReportProblemWithTripRetrieveParams"] class ReportProblemWithTripRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index 33d3468..520e852 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] class RouteIDsForAgencyListResponseData(BaseModel): diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index f5ca95a..aaf73fd 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["RouteRetrieveResponse", "RouteRetrieveResponseData", "RouteRetrieveResponseDataEntry"] class RouteRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 949b1ff..ccca9a8 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] class RoutesForAgencyListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py index cfabb8c..0773789 100644 --- a/src/onebusaway/types/routes_for_location_list_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Required, Annotated +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["RoutesForLocationListParams"] class RoutesForLocationListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index b91a72c..d053900 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["RoutesForLocationListResponse", "RoutesForLocationListResponseData", "RoutesForLocationListResponseDataList"] class RoutesForLocationListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py index 6b5fa6b..e763ac0 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -3,17 +3,11 @@ from __future__ import annotations import datetime - -from typing_extensions import TypedDict, Annotated - from typing import Union +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["ScheduleForRouteRetrieveParams"] class ScheduleForRouteRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 31d487b..4f02939 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -1,14 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List, Optional -from .shared.response_wrapper import ResponseWrapper - -from typing_extensions import Literal from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.response_wrapper import ResponseWrapper + __all__ = ["ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", "ScheduleForRouteRetrieveResponseDataEntryTrip"] class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py index 2fe81c7..fcfed09 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -3,17 +3,11 @@ from __future__ import annotations import datetime - -from typing_extensions import TypedDict, Annotated - from typing import Union +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["ScheduleForStopRetrieveParams"] class ScheduleForStopRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py index afc6eb7..619e319 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["ScheduleForStopRetrieveResponse", "ScheduleForStopRetrieveResponseData", "ScheduleForStopRetrieveResponseDataEntry", "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency"] class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime(BaseModel): diff --git a/src/onebusaway/types/search_for_route_list_params.py b/src/onebusaway/types/search_for_route_list_params.py index 979587c..885eb3e 100755 --- a/src/onebusaway/types/search_for_route_list_params.py +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Required, Annotated +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["SearchForRouteListParams"] class SearchForRouteListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py index 6c8e481..6d4b6d8 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] class SearchForRouteListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/search_for_stop_list_params.py b/src/onebusaway/types/search_for_stop_list_params.py index 9cf8c67..42ba10a 100755 --- a/src/onebusaway/types/search_for_stop_list_params.py +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Required, Annotated +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["SearchForStopListParams"] class SearchForStopListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 1b643cb..22d28a0 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List, Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] class SearchForStopListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py index d4e9b0d..e331899 100644 --- a/src/onebusaway/types/shape_retrieve_response.py +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -1,16 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] class ShapeRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index bed6854..4eca75f 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -1,15 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel - -from typing import Optional, List - -from typing_extensions import Literal - +from typing import List, Optional from typing_extensions import Literal from pydantic import Field as FieldInfo +from ..._models import BaseModel + __all__ = ["References", "Agency", "Route", "Situation", "SituationActiveWindow", "SituationAllAffect", "SituationConsequence", "SituationConsequenceConditionDetails", "SituationConsequenceConditionDetailsDiversionPath", "SituationDescription", "SituationPublicationWindow", "SituationSummary", "SituationURL", "Stop", "StopTime", "Trip"] class Agency(BaseModel): diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py index fcaf06c..77dae24 100644 --- a/src/onebusaway/types/shared/response_wrapper.py +++ b/src/onebusaway/types/shared/response_wrapper.py @@ -1,11 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel - -from typing_extensions import Literal from pydantic import Field as FieldInfo +from ..._models import BaseModel + __all__ = ["ResponseWrapper"] class ResponseWrapper(BaseModel): diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index 48489cd..bd9c2fe 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] class StopIDsForAgencyListResponseData(BaseModel): diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index eb259c5..49c171b 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List, Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] class StopRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index bf131b5..467880b 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -1,15 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List, Optional -from .shared.response_wrapper import ResponseWrapper +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - -from typing_extensions import Literal -from pydantic import Field as FieldInfo +from .shared.response_wrapper import ResponseWrapper __all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py index 6137ce8..4b672c6 100644 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Required, Annotated +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["StopsForLocationListParams"] class StopsForLocationListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index f9d4fca..c2404b9 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import List, Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] class StopsForLocationListResponseDataList(BaseModel): diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py index cad8058..c55ae9d 100644 --- a/src/onebusaway/types/stops_for_route_list_params.py +++ b/src/onebusaway/types/stops_for_route_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["StopsForRouteListParams"] class StopsForRouteListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index cd346b6..4528bac 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["StopsForRouteListResponse", "StopsForRouteListResponseData", "StopsForRouteListResponseDataEntry", "StopsForRouteListResponseDataEntryPolyline", "StopsForRouteListResponseDataEntryStopGrouping", "StopsForRouteListResponseDataEntryStopGroupingName", "StopsForRouteListResponseDataEntryStopGroupingPolyline"] class StopsForRouteListResponseDataEntryPolyline(BaseModel): diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py index 658d0a6..42a37db 100644 --- a/src/onebusaway/types/trip_detail_retrieve_params.py +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["TripDetailRetrieveParams"] class TripDetailRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 1846d1e..99d8166 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["TripDetailRetrieveResponse", "TripDetailRetrieveResponseData", "TripDetailRetrieveResponseDataEntry", "TripDetailRetrieveResponseDataEntrySchedule", "TripDetailRetrieveResponseDataEntryScheduleStopTime", "TripDetailRetrieveResponseDataEntryStatus", "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", "TripDetailRetrieveResponseDataEntryStatusPosition"] class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py index 325521b..7cf1876 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["TripForVehicleRetrieveParams"] class TripForVehicleRetrieveParams(TypedDict, total=False): diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index fab9984..cecc593 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["TripForVehicleRetrieveResponse", "TripForVehicleRetrieveResponseData", "TripForVehicleRetrieveResponseDataEntry", "TripForVehicleRetrieveResponseDataEntrySchedule", "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", "TripForVehicleRetrieveResponseDataEntryStatus", "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", "TripForVehicleRetrieveResponseDataEntryStatusPosition"] class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 37fbab7..7c3c1bc 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel - from typing import Optional -from .shared.references import References +from pydantic import Field as FieldInfo +from .._models import BaseModel +from .shared.references import References from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["TripRetrieveResponse", "TripRetrieveResponseData", "TripRetrieveResponseDataEntry"] class TripRetrieveResponseDataEntry(BaseModel): diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py index 6962798..5c50ae9 100644 --- a/src/onebusaway/types/trips_for_location_list_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Required, Annotated +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["TripsForLocationListParams"] class TripsForLocationListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 5e3c087..01b2233 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["TripsForLocationListResponse", "TripsForLocationListResponseData", "TripsForLocationListResponseDataList", "TripsForLocationListResponseDataListSchedule", "TripsForLocationListResponseDataListScheduleStopTime", "TripsForLocationListResponseDataListStatus", "TripsForLocationListResponseDataListStatusLastKnownLocation", "TripsForLocationListResponseDataListStatusPosition"] class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py index d3bf43f..e1dbb72 100644 --- a/src/onebusaway/types/trips_for_route_list_params.py +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -2,14 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict, Annotated +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["TripsForRouteListParams"] class TripsForRouteListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index efb7b6e..3e33f85 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["TripsForRouteListResponse", "TripsForRouteListResponseData", "TripsForRouteListResponseDataList", "TripsForRouteListResponseDataListSchedule", "TripsForRouteListResponseDataListScheduleStopTime", "TripsForRouteListResponseDataListStatus", "TripsForRouteListResponseDataListStatusLastKnownLocation", "TripsForRouteListResponseDataListStatusPosition"] class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py index 05937c8..808fd7a 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_params.py +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -4,10 +4,6 @@ from typing_extensions import TypedDict -from typing_extensions import Literal, TypedDict, Required, Annotated -from .._types import FileTypes -from .._utils import PropertyInfo - __all__ = ["VehiclesForAgencyListParams"] class VehiclesForAgencyListParams(TypedDict, total=False): diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index cd8ac35..05d11de 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .._models import BaseModel +from typing import List, Optional -from typing import Optional, List +from pydantic import Field as FieldInfo +from .._models import BaseModel from .shared.references import References - from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo - __all__ = ["VehiclesForAgencyListResponse", "VehiclesForAgencyListResponseData", "VehiclesForAgencyListResponseDataList", "VehiclesForAgencyListResponseDataListLocation", "VehiclesForAgencyListResponseDataListTripStatus", "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", "VehiclesForAgencyListResponseDataListTripStatusPosition"] class VehiclesForAgencyListResponseDataListLocation(BaseModel): diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py index 5b49882..31c169e 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import AgenciesWithCoverageListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import AgenciesWithCoverageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index bdfd649..a991b01 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import AgencyRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import AgencyRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index f371046..6af856f 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -2,22 +2,17 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import ArrivalAndDepartureRetrieveResponse, ArrivalAndDepartureListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import arrival_and_departure_retrieve_params -from onebusaway.types import arrival_and_departure_list_params -from onebusaway._utils import parse_datetime +from onebusaway.types import ( + ArrivalAndDepartureListResponse, + ArrivalAndDepartureRetrieveResponse, +) from onebusaway._utils import parse_datetime base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py index 0adb879..51df2aa 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import BlockRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import BlockRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py index 5692c29..c69064e 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import ConfigRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import ConfigRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py index a43fb0c..ff80f9e 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import CurrentTimeRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import CurrentTimeRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py index f7a4f54..4233004 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types.shared import ResponseWrapper - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import report_problem_with_stop_retrieve_params +from onebusaway.types.shared import ResponseWrapper base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index 8b23611..c92d0cf 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types.shared import ResponseWrapper - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import report_problem_with_trip_retrieve_params +from onebusaway.types.shared import ResponseWrapper base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index b27ce01..b046f5b 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import RouteRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import RouteRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py index f8ded3c..586c885 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import RouteIDsForAgencyListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import RouteIDsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 225d1f2..3c5e3d1 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import RoutesForAgencyListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import RoutesForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 35716ba..76683a4 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import RoutesForLocationListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import routes_for_location_list_params +from onebusaway.types import RoutesForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index 4dd1a1d..2fee578 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -2,21 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import ScheduleForRouteRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import schedule_for_route_retrieve_params -from onebusaway._utils import parse_date +from onebusaway.types import ScheduleForRouteRetrieveResponse from onebusaway._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py index ad705cf..beb7aea 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -2,21 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import ScheduleForStopRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import schedule_for_stop_retrieve_params -from onebusaway._utils import parse_date +from onebusaway.types import ScheduleForStopRetrieveResponse from onebusaway._utils import parse_date base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index 220353c..0726471 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import SearchForRouteListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import search_for_route_list_params +from onebusaway.types import SearchForRouteListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index aa138a1..8ff8b57 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import SearchForStopListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import search_for_stop_list_params +from onebusaway.types import SearchForStopListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py index 4ef8019..adfbf9f 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import ShapeRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import ShapeRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py index eacc5ad..dc113e5 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import StopRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import StopRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py index 56c9414..9a060b7 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import StopIDsForAgencyListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import StopIDsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py index 71230d1..ce3acaf 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import StopsForAgencyListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import StopsForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index 520184f..91440a5 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import StopsForLocationListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import stops_for_location_list_params +from onebusaway.types import StopsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py index 4e6787a..c2381e7 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import StopsForRouteListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import stops_for_route_list_params +from onebusaway.types import StopsForRouteListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index 7c39766..c7eeb0e 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -2,19 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import TripRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type +from onebusaway.types import TripRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py index 0db299e..41a8789 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import TripDetailRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import trip_detail_retrieve_params +from onebusaway.types import TripDetailRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py index 0a2d84f..c574a5b 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import TripForVehicleRetrieveResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import trip_for_vehicle_retrieve_params +from onebusaway.types import TripForVehicleRetrieveResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index c3dbfa3..75fc984 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import TripsForLocationListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import trips_for_location_list_params +from onebusaway.types import TripsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py index b301f38..ce2af07 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import TripsForRouteListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import trips_for_route_list_params +from onebusaway.types import TripsForRouteListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py index 4d2e659..078450d 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -2,20 +2,14 @@ from __future__ import annotations -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway.types import VehiclesForAgencyListResponse - -from typing import cast, Any - import os +from typing import Any, cast + import pytest -import httpx -from typing_extensions import get_args -from respx import MockRouter + from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import vehicles_for_agency_list_params +from onebusaway.types import VehiclesForAgencyListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/conftest.py b/tests/conftest.py index 763d201..cdab733 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,12 @@ from __future__ import annotations +import os import logging -from typing import Iterator +from typing import TYPE_CHECKING, Iterator, AsyncIterator import pytest from pytest_asyncio import is_async_test -import os -from typing import TYPE_CHECKING, AsyncIterator - from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK if TYPE_CHECKING: diff --git a/tests/test_client.py b/tests/test_client.py index 32505e6..0d603b3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,47 +2,38 @@ from __future__ import annotations -import httpx - -import subprocess - +import gc +import os import sys - +import json import time - -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK - -from onebusaway._exceptions import APITimeoutError, APIStatusError, APIResponseValidationError - -from typing import cast, Any, Union - -from pydantic import ValidationError - -from typing_extensions import Literal - -from textwrap import dedent - import asyncio -import gc import inspect -import json -import os +import subprocess import tracemalloc import urllib.parse +from typing import Any, Union, cast +from textwrap import dedent from unittest import mock +from typing_extensions import Literal import httpx import pytest from respx import MockRouter +from pydantic import ValidationError from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError -from onebusaway._models import FinalRequestOptions, BaseModel -from onebusaway._types import NOT_GIVEN, Headers, NotGiven, Query, Body, Timeout, Omit -from onebusaway._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, RequestOptions, make_request_options -from onebusaway._streaming import Stream, AsyncStream -from onebusaway._constants import RAW_RESPONSE_HEADER -from onebusaway._response import APIResponse, AsyncAPIResponse from onebusaway._types import Omit +from onebusaway._models import BaseModel, FinalRequestOptions +from onebusaway._constants import RAW_RESPONSE_HEADER +from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError +from onebusaway._base_client import ( + DEFAULT_TIMEOUT, + HTTPX_DEFAULT_TIMEOUT, + BaseClient, + make_request_options, +) + from .utils import update_env base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") From ae2f18c4204970d2f5021b0060c6be7c562dfb54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 03:16:33 +0000 Subject: [PATCH 217/397] chore(internal): codegen related update (#290) --- README.md | 21 +- requirements-dev.lock | 12 +- requirements.lock | 12 +- scripts/utils/ruffen-docs.py | 4 +- src/onebusaway/__init__.py | 43 +- src/onebusaway/_base_client.py | 11 +- src/onebusaway/_client.py | 448 ++++++++---- src/onebusaway/_constants.py | 2 +- src/onebusaway/_exceptions.py | 44 +- src/onebusaway/_resource.py | 8 +- src/onebusaway/_response.py | 7 - src/onebusaway/_streaming.py | 8 +- src/onebusaway/_utils/_typing.py | 7 +- src/onebusaway/resources/__init__.py | 171 ++++- .../resources/agencies_with_coverage.py | 52 +- src/onebusaway/resources/agency.py | 64 +- .../resources/arrival_and_departure.py | 220 +++--- src/onebusaway/resources/block.py | 64 +- src/onebusaway/resources/config.py | 52 +- src/onebusaway/resources/current_time.py | 52 +- .../resources/report_problem_with_stop.py | 124 ++-- .../resources/report_problem_with_trip.py | 178 +++-- src/onebusaway/resources/route.py | 64 +- .../resources/route_ids_for_agency.py | 64 +- src/onebusaway/resources/routes_for_agency.py | 64 +- .../resources/routes_for_location.py | 118 ++-- .../resources/schedule_for_route.py | 84 ++- src/onebusaway/resources/schedule_for_stop.py | 82 ++- src/onebusaway/resources/search_for_route.py | 86 ++- src/onebusaway/resources/search_for_stop.py | 86 ++- src/onebusaway/resources/shape.py | 64 +- src/onebusaway/resources/stop.py | 64 +- .../resources/stop_ids_for_agency.py | 64 +- src/onebusaway/resources/stops_for_agency.py | 64 +- .../resources/stops_for_location.py | 118 ++-- src/onebusaway/resources/stops_for_route.py | 98 ++- src/onebusaway/resources/trip.py | 64 +- src/onebusaway/resources/trip_details.py | 122 ++-- src/onebusaway/resources/trip_for_vehicle.py | 114 +-- .../resources/trips_for_location.py | 126 ++-- src/onebusaway/resources/trips_for_route.py | 106 +-- .../resources/vehicles_for_agency.py | 82 ++- .../agencies_with_coverage_list_response.py | 19 +- .../types/agency_retrieve_response.py | 11 +- .../arrival_and_departure_list_params.py | 5 +- .../arrival_and_departure_list_response.py | 131 ++-- .../arrival_and_departure_retrieve_params.py | 3 +- ...arrival_and_departure_retrieve_response.py | 125 ++-- .../types/block_retrieve_response.py | 51 +- .../types/config_retrieve_response.py | 61 +- .../types/current_time_retrieve_response.py | 7 +- ...eport_problem_with_stop_retrieve_params.py | 3 +- ...eport_problem_with_trip_retrieve_params.py | 12 +- .../route_ids_for_agency_list_response.py | 6 +- .../types/route_retrieve_response.py | 15 +- .../types/routes_for_agency_list_response.py | 17 +- .../types/routes_for_location_list_params.py | 3 +- .../routes_for_location_list_response.py | 25 +- .../schedule_for_route_retrieve_params.py | 5 +- .../schedule_for_route_retrieve_response.py | 93 ++- .../schedule_for_stop_retrieve_params.py | 5 +- .../schedule_for_stop_retrieve_response.py | 65 +- .../types/search_for_route_list_params.py | 3 +- .../types/search_for_route_list_response.py | 19 +- .../types/search_for_stop_list_params.py | 3 +- .../types/search_for_stop_list_response.py | 17 +- .../types/shape_retrieve_response.py | 5 +- src/onebusaway/types/shared/__init__.py | 2 +- src/onebusaway/types/shared/references.py | 135 ++-- .../types/shared/response_wrapper.py | 5 +- .../stop_ids_for_agency_list_response.py | 6 +- .../types/stop_retrieve_response.py | 13 +- .../types/stops_for_agency_list_response.py | 14 +- .../types/stops_for_location_list_params.py | 3 +- .../types/stops_for_location_list_response.py | 17 +- .../types/stops_for_route_list_params.py | 3 +- .../types/stops_for_route_list_response.py | 29 +- .../types/trip_detail_retrieve_params.py | 3 +- .../types/trip_detail_retrieve_response.py | 91 ++- .../types/trip_for_vehicle_retrieve_params.py | 3 +- .../trip_for_vehicle_retrieve_response.py | 91 ++- .../types/trip_retrieve_response.py | 25 +- .../types/trips_for_location_list_params.py | 3 +- .../types/trips_for_location_list_response.py | 95 ++- .../types/trips_for_route_list_params.py | 3 +- .../types/trips_for_route_list_response.py | 93 ++- .../types/vehicles_for_agency_list_params.py | 3 +- .../vehicles_for_agency_list_response.py | 81 ++- tests/__init__.py | 2 +- tests/api_resources/__init__.py | 2 +- .../test_agencies_with_coverage.py | 37 +- tests/api_resources/test_agency.py | 47 +- .../test_arrival_and_departure.py | 101 ++- tests/api_resources/test_block.py | 47 +- tests/api_resources/test_config.py | 37 +- tests/api_resources/test_current_time.py | 37 +- .../test_report_problem_with_stop.py | 51 +- .../test_report_problem_with_trip.py | 51 +- tests/api_resources/test_route.py | 47 +- .../test_route_ids_for_agency.py | 47 +- tests/api_resources/test_routes_for_agency.py | 47 +- .../api_resources/test_routes_for_location.py | 41 +- .../api_resources/test_schedule_for_route.py | 51 +- tests/api_resources/test_schedule_for_stop.py | 51 +- tests/api_resources/test_search_for_route.py | 41 +- tests/api_resources/test_search_for_stop.py | 41 +- tests/api_resources/test_shape.py | 47 +- tests/api_resources/test_stop.py | 47 +- .../api_resources/test_stop_ids_for_agency.py | 47 +- tests/api_resources/test_stops_for_agency.py | 47 +- .../api_resources/test_stops_for_location.py | 41 +- tests/api_resources/test_stops_for_route.py | 51 +- tests/api_resources/test_trip.py | 47 +- tests/api_resources/test_trip_details.py | 51 +- tests/api_resources/test_trip_for_vehicle.py | 51 +- .../api_resources/test_trips_for_location.py | 41 +- tests/api_resources/test_trips_for_route.py | 51 +- .../api_resources/test_vehicles_for_agency.py | 51 +- tests/conftest.py | 16 +- tests/test_client.py | 668 +++++++++++------- tests/test_models.py | 11 +- tests/test_streaming.py | 20 +- tests/test_transform.py | 16 +- 123 files changed, 4127 insertions(+), 2719 deletions(-) diff --git a/README.md b/README.md index fdae5e7..8bc5b4e 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,10 @@ client = AsyncOnebusawaySDK( api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted ) + async def main() -> None: - current_time = await client.current_time.retrieve() + current_time = await client.current_time.retrieve() + asyncio.run(main()) ``` @@ -90,7 +92,7 @@ try: client.current_time.retrieve() except onebusaway.APIConnectionError as e: print("The server could not be reached") - print(e.__cause__) # an underlying Exception, likely raised within httpx. + print(e.__cause__) # an underlying Exception, likely raised within httpx. except onebusaway.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") except onebusaway.APIStatusError as e: @@ -130,7 +132,7 @@ client = OnebusawaySDK( ) # Or, configure per-request: -client.with_options(max_retries = 5).current_time.retrieve() +client.with_options(max_retries=5).current_time.retrieve() ``` ### Timeouts @@ -153,7 +155,7 @@ client = OnebusawaySDK( ) # Override per-request: -client.with_options(timeout = 5.0).current_time.retrieve() +client.with_options(timeout=5.0).current_time.retrieve() ``` On timeout, an `APITimeoutError` is thrown. @@ -212,11 +214,11 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.current_time.with_streaming_response.retrieve() as response : - print(response.headers.get('X-My-Header')) +with client.current_time.with_streaming_response.retrieve() as response: + print(response.headers.get("X-My-Header")) for line in response.iter_lines(): - print(line) + print(line) ``` The context manager is required so that the response will reliably be closed. @@ -270,7 +272,10 @@ from onebusaway import OnebusawaySDK, DefaultHttpxClient client = OnebusawaySDK( # Or use the `ONEBUSAWAY_SDK_BASE_URL` env var base_url="http://my.test.server.example.com:8083", - http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")), + http_client=DefaultHttpxClient( + proxy="http://my.test.proxy.example.com", + transport=httpx.HTTPTransport(local_address="0.0.0.0"), + ), ) ``` diff --git a/requirements-dev.lock b/requirements-dev.lock index 1f3d089..e00b078 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -14,7 +14,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via sdk-pythonpackagename + # via onebusaway argcomplete==3.1.2 # via nox certifi==2023.7.22 @@ -26,7 +26,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via sdk-pythonpackagename + # via onebusaway exceptiongroup==1.2.2 # via anyio # via pytest @@ -37,8 +37,8 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 + # via onebusaway # via respx - # via sdk-pythonpackagename idna==3.4 # via anyio # via httpx @@ -64,7 +64,7 @@ platformdirs==3.11.0 pluggy==1.5.0 # via pytest pydantic==2.10.3 - # via sdk-pythonpackagename + # via onebusaway pydantic-core==2.27.1 # via pydantic pygments==2.18.0 @@ -86,7 +86,7 @@ six==1.16.0 # via python-dateutil sniffio==1.3.0 # via anyio - # via sdk-pythonpackagename + # via onebusaway time-machine==2.9.0 tomli==2.0.2 # via mypy @@ -94,10 +94,10 @@ tomli==2.0.2 typing-extensions==4.12.2 # via anyio # via mypy + # via onebusaway # via pydantic # via pydantic-core # via pyright - # via sdk-pythonpackagename virtualenv==20.24.5 # via nox zipp==3.17.0 diff --git a/requirements.lock b/requirements.lock index 26eb37b..cf5c8e0 100644 --- a/requirements.lock +++ b/requirements.lock @@ -14,12 +14,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via sdk-pythonpackagename + # via onebusaway certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via sdk-pythonpackagename + # via onebusaway exceptiongroup==1.2.2 # via anyio h11==0.14.0 @@ -27,19 +27,19 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 - # via sdk-pythonpackagename + # via onebusaway idna==3.4 # via anyio # via httpx pydantic==2.10.3 - # via sdk-pythonpackagename + # via onebusaway pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio - # via sdk-pythonpackagename + # via onebusaway typing-extensions==4.12.2 # via anyio + # via onebusaway # via pydantic # via pydantic-core - # via sdk-pythonpackagename diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py index 37b3d94..0cf2bd2 100644 --- a/scripts/utils/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 948ea95..10ff6d2 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -37,7 +37,46 @@ from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging -__all__ = ["types", "__version__", "__title__", "NoneType", "Transport", "ProxiesTypes", "NotGiven", "NOT_GIVEN", "Omit", "OnebusawaySDKError", "APIError", "APIStatusError", "APITimeoutError", "APIConnectionError", "APIResponseValidationError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError", "Timeout", "RequestOptions", "Client", "AsyncClient", "Stream", "AsyncStream", "OnebusawaySDK", "AsyncOnebusawaySDK", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", "DEFAULT_MAX_RETRIES", "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient"] +__all__ = [ + "types", + "__version__", + "__title__", + "NoneType", + "Transport", + "ProxiesTypes", + "NotGiven", + "NOT_GIVEN", + "Omit", + "OnebusawaySDKError", + "APIError", + "APIStatusError", + "APITimeoutError", + "APIConnectionError", + "APIResponseValidationError", + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", + "Timeout", + "RequestOptions", + "Client", + "AsyncClient", + "Stream", + "AsyncStream", + "OnebusawaySDK", + "AsyncOnebusawaySDK", + "file_from_path", + "BaseModel", + "DEFAULT_TIMEOUT", + "DEFAULT_MAX_RETRIES", + "DEFAULT_CONNECTION_LIMITS", + "DefaultHttpxClient", + "DefaultAsyncHttpxClient", +] _setup_logging() @@ -52,4 +91,4 @@ __locals[__name].__module__ = "onebusaway" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. - pass \ No newline at end of file + pass diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index f99a333..8ee4250 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -203,7 +203,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -291,7 +291,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -608,7 +608,7 @@ def default_headers(self) -> dict[str, str | Omit]: "Accept": "application/json", "Content-Type": "application/json", "User-Agent": self.user_agent, -**self.platform_headers(), + **self.platform_headers(), **self.auth_headers, **self._custom_headers, } @@ -994,7 +994,6 @@ def _request( response.reason_phrase, response.headers, ) - try: response.raise_for_status() @@ -1070,8 +1069,6 @@ def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: - - origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): @@ -1595,8 +1592,6 @@ async def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: - - origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e11449e..e14128b 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -62,7 +62,17 @@ AsyncAPIClient, ) -__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "OnebusawaySDK", "AsyncOnebusawaySDK", "Client", "AsyncClient"] +__all__ = [ + "Timeout", + "Transport", + "ProxiesTypes", + "RequestOptions", + "OnebusawaySDK", + "AsyncOnebusawaySDK", + "Client", + "AsyncClient", +] + class OnebusawaySDK(SyncAPIClient): agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource @@ -99,38 +109,56 @@ class OnebusawaySDK(SyncAPIClient): # client options api_key: str - def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. - http_client: httpx.Client | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False) -> None: + def __init__( + self, + *, + api_key: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + http_client: httpx.Client | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: """Construct a new synchronous OnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResource(self) self.agency = agency.AgencyResource(self) @@ -177,33 +205,42 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": "false", - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": "false", + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: + def copy( + self, + *, + api_key: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.Client | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError( - 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' - ) + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") if default_query is not None and set_default_query is not None: - raise ValueError( - 'The `default_query` and `set_default_query` arguments are mutually exclusive' - ) + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") headers = self._custom_headers if default_headers is not None: @@ -218,14 +255,29 @@ def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = params = set_default_query http_client = http_client or self._client - return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) + return self.__class__( + api_key=api_key or self.api_key, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -251,6 +303,7 @@ def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Resp return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) + class AsyncOnebusawaySDK(AsyncAPIClient): agencies_with_coverage: agencies_with_coverage.AsyncAgenciesWithCoverageResource agency: agency.AsyncAgencyResource @@ -286,38 +339,56 @@ class AsyncOnebusawaySDK(AsyncAPIClient): # client options api_key: str - def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. - http_client: httpx.AsyncClient | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False) -> None: + def __init__( + self, + *, + api_key: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + http_client: httpx.AsyncClient | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: """Construct a new async AsyncOnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResource(self) self.agency = agency.AsyncAgencyResource(self) @@ -364,33 +435,42 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": f'async:{get_async_library()}', - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": f"async:{get_async_library()}", + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: + def copy( + self, + *, + api_key: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.AsyncClient | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError( - 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' - ) + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") if default_query is not None and set_default_query is not None: - raise ValueError( - 'The `default_query` and `set_default_query` arguments are mutually exclusive' - ) + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") headers = self._custom_headers if default_headers is not None: @@ -405,14 +485,29 @@ def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = params = set_default_query http_client = http_client or self._client - return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) + return self.__class__( + api_key=api_key or self.api_key, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -438,130 +533,235 @@ def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Resp return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) + class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = agency.AgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse( + client.vehicles_for_agency + ) self.config = config.ConfigResourceWithRawResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithRawResponse(client.current_time) self.stops_for_location = stops_for_location.StopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = stops_for_route.StopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.StopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse( + client.stop_ids_for_agency + ) self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.RouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse(client.routes_for_location) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse( + client.routes_for_location + ) self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse( + client.arrival_and_departure + ) self.trip = trip.TripResourceWithRawResponse(client.trip) self.trips_for_location = trips_for_location.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = trip_details.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse( + client.report_problem_with_stop + ) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse( + client.report_problem_with_trip + ) self.search_for_stop = search_for_stop.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.BlockResourceWithRawResponse(client.block) self.shape = shape.ShapeResourceWithRawResponse(client.shape) + class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = agency.AsyncAgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse( + client.vehicles_for_agency + ) self.config = config.AsyncConfigResourceWithRawResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse( + client.stops_for_location + ) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.AsyncStopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse( + client.stop_ids_for_agency + ) self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.AsyncRouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse(client.routes_for_location) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse( + client.routes_for_location + ) self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse( + client.schedule_for_route + ) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse( + client.arrival_and_departure + ) self.trip = trip.AsyncTripResourceWithRawResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse( + client.trips_for_location + ) self.trip_details = trip_details.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse( + client.report_problem_with_stop + ) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse( + client.report_problem_with_trip + ) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.AsyncBlockResourceWithRawResponse(client.block) self.shape = shape.AsyncShapeResourceWithRawResponse(client.shape) + class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = agency.AgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse( + client.vehicles_for_agency + ) self.config = config.ConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) + self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse( + client.stops_for_location + ) self.stops_for_route = stops_for_route.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = stop.StopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse( + client.stop_ids_for_agency + ) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse( + client.schedule_for_stop + ) self.route = route.RouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse(client.routes_for_location) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse( + client.routes_for_location + ) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse( + client.routes_for_agency + ) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse( + client.schedule_for_route + ) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse( + client.arrival_and_departure + ) self.trip = trip.TripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) + self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse( + client.trips_for_location + ) self.trip_details = trip_details.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse( + client.report_problem_with_stop + ) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse( + client.report_problem_with_trip + ) self.search_for_stop = search_for_stop.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = block.BlockResourceWithStreamingResponse(client.block) self.shape = shape.ShapeResourceWithStreamingResponse(client.shape) + class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = agency.AsyncAgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse( + client.vehicles_for_agency + ) self.config = config.AsyncConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse(client.stops_for_location) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse( + client.stops_for_location + ) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse( + client.stops_for_agency + ) self.stop = stop.AsyncStopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse( + client.stop_ids_for_agency + ) + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse( + client.schedule_for_stop + ) self.route = route.AsyncRouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse(client.routes_for_location) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse( + client.route_ids_for_agency + ) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse( + client.routes_for_location + ) + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse( + client.routes_for_agency + ) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse( + client.schedule_for_route + ) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse( + client.arrival_and_departure + ) self.trip = trip.AsyncTripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse(client.trips_for_location) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse( + client.trips_for_location + ) self.trip_details = trip_details.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse( + client.trip_for_vehicle + ) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) + self.report_problem_with_stop = ( + report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse( + client.report_problem_with_stop + ) + ) + self.report_problem_with_trip = ( + report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse( + client.report_problem_with_trip + ) + ) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) + self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse( + client.search_for_route + ) self.block = block.AsyncBlockResourceWithStreamingResponse(client.block) self.shape = shape.AsyncShapeResourceWithStreamingResponse(client.shape) + Client = OnebusawaySDK -AsyncClient = AsyncOnebusawaySDK \ No newline at end of file +AsyncClient = AsyncOnebusawaySDK diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py index f32ba27..6ddf2c7 100644 --- a/src/onebusaway/_constants.py +++ b/src/onebusaway/_constants.py @@ -11,4 +11,4 @@ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) INITIAL_RETRY_DELAY = 0.5 -MAX_RETRY_DELAY = 8.0 \ No newline at end of file +MAX_RETRY_DELAY = 8.0 diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py index dad6a31..c76aabb 100644 --- a/src/onebusaway/_exceptions.py +++ b/src/onebusaway/_exceptions.py @@ -6,11 +6,22 @@ import httpx -__all__ = ["BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError"] +__all__ = [ + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", +] + class OnebusawaySDKError(Exception): pass + class APIError(OnebusawaySDKError): message: str request: httpx.Request @@ -32,6 +43,7 @@ def __init__(self, message: str, request: httpx.Request, *, body: object | None) self.message = message self.body = body + class APIResponseValidationError(APIError): response: httpx.Response status_code: int @@ -41,8 +53,10 @@ def __init__(self, response: httpx.Response, body: object | None, *, message: st self.response = response self.status_code = response.status_code + class APIStatusError(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" + response: httpx.Response status_code: int @@ -51,34 +65,44 @@ def __init__(self, message: str, *, response: httpx.Response, body: object | Non self.response = response self.status_code = response.status_code + class APIConnectionError(APIError): def __init__(self, *, message: str = "Connection error.", request: httpx.Request) -> None: super().__init__(message, request, body=None) + class APITimeoutError(APIConnectionError): def __init__(self, request: httpx.Request) -> None: - super().__init__(message= "Request timed out.", request=request) + super().__init__(message="Request timed out.", request=request) + class BadRequestError(APIStatusError): - status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] + class AuthenticationError(APIStatusError): - status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] + class PermissionDeniedError(APIStatusError): - status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] + class NotFoundError(APIStatusError): - status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] + class ConflictError(APIStatusError): - status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] + class UnprocessableEntityError(APIStatusError): - status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] + class RateLimitError(APIStatusError): - status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] + status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] + class InternalServerError(APIStatusError): - pass \ No newline at end of file + pass diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py index e20e5cd..153115b 100644 --- a/src/onebusaway/_resource.py +++ b/src/onebusaway/_resource.py @@ -8,7 +8,8 @@ import anyio if TYPE_CHECKING: - from ._client import OnebusawaySDK, AsyncOnebusawaySDK + from ._client import OnebusawaySDK, AsyncOnebusawaySDK + class SyncAPIResource: _client: OnebusawaySDK @@ -23,7 +24,8 @@ def __init__(self, client: OnebusawaySDK) -> None: self._get_api_list = client.get_api_list def _sleep(self, seconds: float) -> None: - time.sleep(seconds) + time.sleep(seconds) + class AsyncAPIResource: _client: AsyncOnebusawaySDK @@ -38,4 +40,4 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self._get_api_list = client.get_api_list async def _sleep(self, seconds: float) -> None: - await anyio.sleep(seconds) \ No newline at end of file + await anyio.sleep(seconds) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 21c87fc..16b6f2b 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -138,8 +138,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: origin = get_origin(cast_to) or cast_to - - if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -199,7 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") @@ -273,8 +270,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): - - @overload def parse(self, *, to: type[_T]) -> _T: ... @@ -377,8 +372,6 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): - - @overload async def parse(self, *, to: type[_T]) -> _T: ... diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 293ffe5..957b8da 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -53,10 +53,10 @@ def __stream__(self) -> Iterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed for _sse in iterator: ... @@ -117,10 +117,10 @@ async def __stream__(self) -> AsyncIterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed async for _sse in iterator: ... diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 5e9600b..278749b 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -49,16 +49,17 @@ def is_typevar(typ: type) -> bool: if sys.version_info >= (3, 12): _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) + def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: """Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) - #> True - Str = TypeAliasType('Str', str) + # > True + Str = TypeAliasType("Str", str) is_type_alias_type(Str) - #> True + # > True ``` """ return isinstance(tp, _TYPE_ALIAS_TYPES) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index c5f49f6..0a958d2 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -225,4 +225,173 @@ AsyncReportProblemWithTripResourceWithStreamingResponse, ) -__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource", "AgenciesWithCoverageResourceWithRawResponse", "AsyncAgenciesWithCoverageResourceWithRawResponse", "AgenciesWithCoverageResourceWithStreamingResponse", "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", "AsyncAgencyResourceWithRawResponse", "AgencyResourceWithStreamingResponse", "AsyncAgencyResourceWithStreamingResponse", "VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource", "VehiclesForAgencyResourceWithRawResponse", "AsyncVehiclesForAgencyResourceWithRawResponse", "VehiclesForAgencyResourceWithStreamingResponse", "AsyncVehiclesForAgencyResourceWithStreamingResponse", "ConfigResource", "AsyncConfigResource", "ConfigResourceWithRawResponse", "AsyncConfigResourceWithRawResponse", "ConfigResourceWithStreamingResponse", "AsyncConfigResourceWithStreamingResponse", "CurrentTimeResource", "AsyncCurrentTimeResource", "CurrentTimeResourceWithRawResponse", "AsyncCurrentTimeResourceWithRawResponse", "CurrentTimeResourceWithStreamingResponse", "AsyncCurrentTimeResourceWithStreamingResponse", "StopsForLocationResource", "AsyncStopsForLocationResource", "StopsForLocationResourceWithRawResponse", "AsyncStopsForLocationResourceWithRawResponse", "StopsForLocationResourceWithStreamingResponse", "AsyncStopsForLocationResourceWithStreamingResponse", "StopsForRouteResource", "AsyncStopsForRouteResource", "StopsForRouteResourceWithRawResponse", "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", "StopsForAgencyResource", "AsyncStopsForAgencyResource", "StopsForAgencyResourceWithRawResponse", "AsyncStopsForAgencyResourceWithRawResponse", "StopsForAgencyResourceWithStreamingResponse", "AsyncStopsForAgencyResourceWithStreamingResponse", "StopResource", "AsyncStopResource", "StopResourceWithRawResponse", "AsyncStopResourceWithRawResponse", "StopResourceWithStreamingResponse", "AsyncStopResourceWithStreamingResponse", "StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource", "StopIDsForAgencyResourceWithRawResponse", "AsyncStopIDsForAgencyResourceWithRawResponse", "StopIDsForAgencyResourceWithStreamingResponse", "AsyncStopIDsForAgencyResourceWithStreamingResponse", "ScheduleForStopResource", "AsyncScheduleForStopResource", "ScheduleForStopResourceWithRawResponse", "AsyncScheduleForStopResourceWithRawResponse", "ScheduleForStopResourceWithStreamingResponse", "AsyncScheduleForStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", "AsyncRouteResourceWithRawResponse", "RouteResourceWithStreamingResponse", "AsyncRouteResourceWithStreamingResponse", "RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource", "RouteIDsForAgencyResourceWithRawResponse", "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", "RoutesForLocationResource", "AsyncRoutesForLocationResource", "RoutesForLocationResourceWithRawResponse", "AsyncRoutesForLocationResourceWithRawResponse", "RoutesForLocationResourceWithStreamingResponse", "AsyncRoutesForLocationResourceWithStreamingResponse", "RoutesForAgencyResource", "AsyncRoutesForAgencyResource", "RoutesForAgencyResourceWithRawResponse", "AsyncRoutesForAgencyResourceWithRawResponse", "RoutesForAgencyResourceWithStreamingResponse", "AsyncRoutesForAgencyResourceWithStreamingResponse", "ScheduleForRouteResource", "AsyncScheduleForRouteResource", "ScheduleForRouteResourceWithRawResponse", "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", "AsyncArrivalAndDepartureResourceWithRawResponse", "ArrivalAndDepartureResourceWithStreamingResponse", "AsyncArrivalAndDepartureResourceWithStreamingResponse", "TripResource", "AsyncTripResource", "TripResourceWithRawResponse", "AsyncTripResourceWithRawResponse", "TripResourceWithStreamingResponse", "AsyncTripResourceWithStreamingResponse", "TripsForLocationResource", "AsyncTripsForLocationResource", "TripsForLocationResourceWithRawResponse", "AsyncTripsForLocationResourceWithRawResponse", "TripsForLocationResourceWithStreamingResponse", "AsyncTripsForLocationResourceWithStreamingResponse", "TripDetailsResource", "AsyncTripDetailsResource", "TripDetailsResourceWithRawResponse", "AsyncTripDetailsResourceWithRawResponse", "TripDetailsResourceWithStreamingResponse", "AsyncTripDetailsResourceWithStreamingResponse", "TripForVehicleResource", "AsyncTripForVehicleResource", "TripForVehicleResourceWithRawResponse", "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", "TripsForRouteResource", "AsyncTripsForRouteResource", "TripsForRouteResourceWithRawResponse", "AsyncTripsForRouteResourceWithRawResponse", "TripsForRouteResourceWithStreamingResponse", "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", "ReportProblemWithTripResource", "AsyncReportProblemWithTripResource", "ReportProblemWithTripResourceWithRawResponse", "AsyncReportProblemWithTripResourceWithRawResponse", "ReportProblemWithTripResourceWithStreamingResponse", "AsyncReportProblemWithTripResourceWithStreamingResponse", "SearchForStopResource", "AsyncSearchForStopResource", "SearchForStopResourceWithRawResponse", "AsyncSearchForStopResourceWithRawResponse", "SearchForStopResourceWithStreamingResponse", "AsyncSearchForStopResourceWithStreamingResponse", "SearchForRouteResource", "AsyncSearchForRouteResource", "SearchForRouteResourceWithRawResponse", "AsyncSearchForRouteResourceWithRawResponse", "SearchForRouteResourceWithStreamingResponse", "AsyncSearchForRouteResourceWithStreamingResponse", "BlockResource", "AsyncBlockResource", "BlockResourceWithRawResponse", "AsyncBlockResourceWithRawResponse", "BlockResourceWithStreamingResponse", "AsyncBlockResourceWithStreamingResponse", "ShapeResource", "AsyncShapeResource", "ShapeResourceWithRawResponse", "AsyncShapeResourceWithRawResponse", "ShapeResourceWithStreamingResponse", "AsyncShapeResourceWithStreamingResponse"] \ No newline at end of file +__all__ = [ + "AgenciesWithCoverageResource", + "AsyncAgenciesWithCoverageResource", + "AgenciesWithCoverageResourceWithRawResponse", + "AsyncAgenciesWithCoverageResourceWithRawResponse", + "AgenciesWithCoverageResourceWithStreamingResponse", + "AsyncAgenciesWithCoverageResourceWithStreamingResponse", + "AgencyResource", + "AsyncAgencyResource", + "AgencyResourceWithRawResponse", + "AsyncAgencyResourceWithRawResponse", + "AgencyResourceWithStreamingResponse", + "AsyncAgencyResourceWithStreamingResponse", + "VehiclesForAgencyResource", + "AsyncVehiclesForAgencyResource", + "VehiclesForAgencyResourceWithRawResponse", + "AsyncVehiclesForAgencyResourceWithRawResponse", + "VehiclesForAgencyResourceWithStreamingResponse", + "AsyncVehiclesForAgencyResourceWithStreamingResponse", + "ConfigResource", + "AsyncConfigResource", + "ConfigResourceWithRawResponse", + "AsyncConfigResourceWithRawResponse", + "ConfigResourceWithStreamingResponse", + "AsyncConfigResourceWithStreamingResponse", + "CurrentTimeResource", + "AsyncCurrentTimeResource", + "CurrentTimeResourceWithRawResponse", + "AsyncCurrentTimeResourceWithRawResponse", + "CurrentTimeResourceWithStreamingResponse", + "AsyncCurrentTimeResourceWithStreamingResponse", + "StopsForLocationResource", + "AsyncStopsForLocationResource", + "StopsForLocationResourceWithRawResponse", + "AsyncStopsForLocationResourceWithRawResponse", + "StopsForLocationResourceWithStreamingResponse", + "AsyncStopsForLocationResourceWithStreamingResponse", + "StopsForRouteResource", + "AsyncStopsForRouteResource", + "StopsForRouteResourceWithRawResponse", + "AsyncStopsForRouteResourceWithRawResponse", + "StopsForRouteResourceWithStreamingResponse", + "AsyncStopsForRouteResourceWithStreamingResponse", + "StopsForAgencyResource", + "AsyncStopsForAgencyResource", + "StopsForAgencyResourceWithRawResponse", + "AsyncStopsForAgencyResourceWithRawResponse", + "StopsForAgencyResourceWithStreamingResponse", + "AsyncStopsForAgencyResourceWithStreamingResponse", + "StopResource", + "AsyncStopResource", + "StopResourceWithRawResponse", + "AsyncStopResourceWithRawResponse", + "StopResourceWithStreamingResponse", + "AsyncStopResourceWithStreamingResponse", + "StopIDsForAgencyResource", + "AsyncStopIDsForAgencyResource", + "StopIDsForAgencyResourceWithRawResponse", + "AsyncStopIDsForAgencyResourceWithRawResponse", + "StopIDsForAgencyResourceWithStreamingResponse", + "AsyncStopIDsForAgencyResourceWithStreamingResponse", + "ScheduleForStopResource", + "AsyncScheduleForStopResource", + "ScheduleForStopResourceWithRawResponse", + "AsyncScheduleForStopResourceWithRawResponse", + "ScheduleForStopResourceWithStreamingResponse", + "AsyncScheduleForStopResourceWithStreamingResponse", + "RouteResource", + "AsyncRouteResource", + "RouteResourceWithRawResponse", + "AsyncRouteResourceWithRawResponse", + "RouteResourceWithStreamingResponse", + "AsyncRouteResourceWithStreamingResponse", + "RouteIDsForAgencyResource", + "AsyncRouteIDsForAgencyResource", + "RouteIDsForAgencyResourceWithRawResponse", + "AsyncRouteIDsForAgencyResourceWithRawResponse", + "RouteIDsForAgencyResourceWithStreamingResponse", + "AsyncRouteIDsForAgencyResourceWithStreamingResponse", + "RoutesForLocationResource", + "AsyncRoutesForLocationResource", + "RoutesForLocationResourceWithRawResponse", + "AsyncRoutesForLocationResourceWithRawResponse", + "RoutesForLocationResourceWithStreamingResponse", + "AsyncRoutesForLocationResourceWithStreamingResponse", + "RoutesForAgencyResource", + "AsyncRoutesForAgencyResource", + "RoutesForAgencyResourceWithRawResponse", + "AsyncRoutesForAgencyResourceWithRawResponse", + "RoutesForAgencyResourceWithStreamingResponse", + "AsyncRoutesForAgencyResourceWithStreamingResponse", + "ScheduleForRouteResource", + "AsyncScheduleForRouteResource", + "ScheduleForRouteResourceWithRawResponse", + "AsyncScheduleForRouteResourceWithRawResponse", + "ScheduleForRouteResourceWithStreamingResponse", + "AsyncScheduleForRouteResourceWithStreamingResponse", + "ArrivalAndDepartureResource", + "AsyncArrivalAndDepartureResource", + "ArrivalAndDepartureResourceWithRawResponse", + "AsyncArrivalAndDepartureResourceWithRawResponse", + "ArrivalAndDepartureResourceWithStreamingResponse", + "AsyncArrivalAndDepartureResourceWithStreamingResponse", + "TripResource", + "AsyncTripResource", + "TripResourceWithRawResponse", + "AsyncTripResourceWithRawResponse", + "TripResourceWithStreamingResponse", + "AsyncTripResourceWithStreamingResponse", + "TripsForLocationResource", + "AsyncTripsForLocationResource", + "TripsForLocationResourceWithRawResponse", + "AsyncTripsForLocationResourceWithRawResponse", + "TripsForLocationResourceWithStreamingResponse", + "AsyncTripsForLocationResourceWithStreamingResponse", + "TripDetailsResource", + "AsyncTripDetailsResource", + "TripDetailsResourceWithRawResponse", + "AsyncTripDetailsResourceWithRawResponse", + "TripDetailsResourceWithStreamingResponse", + "AsyncTripDetailsResourceWithStreamingResponse", + "TripForVehicleResource", + "AsyncTripForVehicleResource", + "TripForVehicleResourceWithRawResponse", + "AsyncTripForVehicleResourceWithRawResponse", + "TripForVehicleResourceWithStreamingResponse", + "AsyncTripForVehicleResourceWithStreamingResponse", + "TripsForRouteResource", + "AsyncTripsForRouteResource", + "TripsForRouteResourceWithRawResponse", + "AsyncTripsForRouteResourceWithRawResponse", + "TripsForRouteResourceWithStreamingResponse", + "AsyncTripsForRouteResourceWithStreamingResponse", + "ReportProblemWithStopResource", + "AsyncReportProblemWithStopResource", + "ReportProblemWithStopResourceWithRawResponse", + "AsyncReportProblemWithStopResourceWithRawResponse", + "ReportProblemWithStopResourceWithStreamingResponse", + "AsyncReportProblemWithStopResourceWithStreamingResponse", + "ReportProblemWithTripResource", + "AsyncReportProblemWithTripResource", + "ReportProblemWithTripResourceWithRawResponse", + "AsyncReportProblemWithTripResourceWithRawResponse", + "ReportProblemWithTripResourceWithStreamingResponse", + "AsyncReportProblemWithTripResourceWithStreamingResponse", + "SearchForStopResource", + "AsyncSearchForStopResource", + "SearchForStopResourceWithRawResponse", + "AsyncSearchForStopResourceWithRawResponse", + "SearchForStopResourceWithStreamingResponse", + "AsyncSearchForStopResourceWithStreamingResponse", + "SearchForRouteResource", + "AsyncSearchForRouteResource", + "SearchForRouteResourceWithRawResponse", + "AsyncSearchForRouteResourceWithRawResponse", + "SearchForRouteResourceWithStreamingResponse", + "AsyncSearchForRouteResourceWithStreamingResponse", + "BlockResource", + "AsyncBlockResource", + "BlockResourceWithRawResponse", + "AsyncBlockResourceWithRawResponse", + "BlockResourceWithStreamingResponse", + "AsyncBlockResourceWithStreamingResponse", + "ShapeResource", + "AsyncShapeResource", + "ShapeResourceWithRawResponse", + "AsyncShapeResourceWithRawResponse", + "ShapeResourceWithStreamingResponse", + "AsyncShapeResourceWithStreamingResponse", +] diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index ad26d0d..f543a88 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -18,6 +18,7 @@ __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] + class AgenciesWithCoverageResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: @@ -38,24 +39,29 @@ def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingRe """ return AgenciesWithCoverageResourceWithStreamingResponse(self) - def list(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=AgenciesWithCoverageListResponse, ) + class AsyncAgenciesWithCoverageResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: @@ -76,24 +82,29 @@ def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStream """ return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - async def list(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return await self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=AgenciesWithCoverageListResponse, ) + class AgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -102,6 +113,7 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) + class AsyncAgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -110,6 +122,7 @@ def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> agencies_with_coverage.list, ) + class AgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -118,10 +131,11 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) + class AsyncAgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage self.list = async_to_streamed_response_wrapper( agencies_with_coverage.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 90ac9ae..9141792 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -18,6 +18,7 @@ __all__ = ["AgencyResource", "AsyncAgencyResource"] + class AgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgencyResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> AgencyResourceWithStreamingResponse: """ return AgencyResourceWithStreamingResponse(self) - def retrieve(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: + def retrieve( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=AgencyRetrieveResponse, ) + class AsyncAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgencyResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncAgencyResourceWithStreamingResponse: """ return AsyncAgencyResourceWithStreamingResponse(self) - async def retrieve(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: + async def retrieve( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=AgencyRetrieveResponse, ) + class AgencyResourceWithRawResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -128,6 +135,7 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) + class AsyncAgencyResourceWithRawResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency @@ -136,6 +144,7 @@ def __init__(self, agency: AsyncAgencyResource) -> None: agency.retrieve, ) + class AgencyResourceWithStreamingResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -144,10 +153,11 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) + class AsyncAgencyResourceWithStreamingResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency self.retrieve = async_to_streamed_response_wrapper( agency.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 3daac58..8323a51 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -27,6 +27,7 @@ __all__ = ["ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource"] + class ArrivalAndDepartureResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ArrivalAndDepartureResourceWithRawResponse: @@ -47,20 +48,22 @@ def with_streaming_response(self) -> ArrivalAndDepartureResourceWithStreamingRes """ return ArrivalAndDepartureResourceWithStreamingResponse(self) - def retrieve(self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: + def retrieve( + self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -74,33 +77,42 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, + arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, + ), + ), cast_to=ArrivalAndDepartureRetrieveResponse, ) - def list(self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: + def list( + self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -120,19 +132,27 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, + arrival_and_departure_list_params.ArrivalAndDepartureListParams, + ), + ), cast_to=ArrivalAndDepartureListResponse, ) + class AsyncArrivalAndDepartureResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncArrivalAndDepartureResourceWithRawResponse: @@ -153,20 +173,22 @@ def with_streaming_response(self) -> AsyncArrivalAndDepartureResourceWithStreami """ return AsyncArrivalAndDepartureResourceWithStreamingResponse(self) - async def retrieve(self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: + async def retrieve( + self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -180,33 +202,42 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, + arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, + ), + ), cast_to=ArrivalAndDepartureRetrieveResponse, ) - async def list(self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: + async def list( + self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -226,19 +257,27 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, + arrival_and_departure_list_params.ArrivalAndDepartureListParams, + ), + ), cast_to=ArrivalAndDepartureListResponse, ) + class ArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -250,6 +289,7 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) + class AsyncArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -261,6 +301,7 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N arrival_and_departure.list, ) + class ArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -272,6 +313,7 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) + class AsyncArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -281,4 +323,4 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N ) self.list = async_to_streamed_response_wrapper( arrival_and_departure.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index 66e28a8..cbee583 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -18,6 +18,7 @@ __all__ = ["BlockResource", "AsyncBlockResource"] + class BlockResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BlockResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> BlockResourceWithStreamingResponse: """ return BlockResourceWithStreamingResponse(self) - def retrieve(self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: + def retrieve( + self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError( - f'Expected a non-empty value for `block_id` but received {block_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") return self._get( f"/api/where/block/{block_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=BlockRetrieveResponse, ) + class AsyncBlockResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncBlockResourceWithStreamingResponse: """ return AsyncBlockResourceWithStreamingResponse(self) - async def retrieve(self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: + async def retrieve( + self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError( - f'Expected a non-empty value for `block_id` but received {block_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") return await self._get( f"/api/where/block/{block_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=BlockRetrieveResponse, ) + class BlockResourceWithRawResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -128,6 +135,7 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) + class AsyncBlockResourceWithRawResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block @@ -136,6 +144,7 @@ def __init__(self, block: AsyncBlockResource) -> None: block.retrieve, ) + class BlockResourceWithStreamingResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -144,10 +153,11 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) + class AsyncBlockResourceWithStreamingResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block self.retrieve = async_to_streamed_response_wrapper( block.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index e52cb1e..4b3de23 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -18,6 +18,7 @@ __all__ = ["ConfigResource", "AsyncConfigResource"] + class ConfigResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigResourceWithRawResponse: @@ -38,21 +39,26 @@ def with_streaming_response(self) -> ConfigResourceWithStreamingResponse: """ return ConfigResourceWithStreamingResponse(self) - def retrieve(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: + def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConfigRetrieveResponse: """config""" return self._get( "/api/where/config.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=ConfigRetrieveResponse, ) + class AsyncConfigResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: @@ -73,21 +79,26 @@ def with_streaming_response(self) -> AsyncConfigResourceWithStreamingResponse: """ return AsyncConfigResourceWithStreamingResponse(self) - async def retrieve(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: + async def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConfigRetrieveResponse: """config""" return await self._get( "/api/where/config.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=ConfigRetrieveResponse, ) + class ConfigResourceWithRawResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -96,6 +107,7 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) + class AsyncConfigResourceWithRawResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config @@ -104,6 +116,7 @@ def __init__(self, config: AsyncConfigResource) -> None: config.retrieve, ) + class ConfigResourceWithStreamingResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -112,10 +125,11 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) + class AsyncConfigResourceWithStreamingResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config self.retrieve = async_to_streamed_response_wrapper( config.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index b4b29d5..1dcc9a8 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -18,6 +18,7 @@ __all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] + class CurrentTimeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CurrentTimeResourceWithRawResponse: @@ -38,21 +39,26 @@ def with_streaming_response(self) -> CurrentTimeResourceWithStreamingResponse: """ return CurrentTimeResourceWithStreamingResponse(self) - def retrieve(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: + def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CurrentTimeRetrieveResponse: """current-time""" return self._get( "/api/where/current-time.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=CurrentTimeRetrieveResponse, ) + class AsyncCurrentTimeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCurrentTimeResourceWithRawResponse: @@ -73,21 +79,26 @@ def with_streaming_response(self) -> AsyncCurrentTimeResourceWithStreamingRespon """ return AsyncCurrentTimeResourceWithStreamingResponse(self) - async def retrieve(self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: + async def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CurrentTimeRetrieveResponse: """current-time""" return await self._get( "/api/where/current-time.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=CurrentTimeRetrieveResponse, ) + class CurrentTimeResourceWithRawResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -96,6 +107,7 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) + class AsyncCurrentTimeResourceWithRawResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time @@ -104,6 +116,7 @@ def __init__(self, current_time: AsyncCurrentTimeResource) -> None: current_time.retrieve, ) + class CurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -112,10 +125,11 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) + class AsyncCurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time self.retrieve = async_to_streamed_response_wrapper( current_time.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index 0c26ff9..d1614f6 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -25,6 +25,7 @@ __all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] + class ReportProblemWithStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: @@ -45,20 +46,23 @@ def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingR """ return ReportProblemWithStopResourceWithStreamingResponse(self) - def retrieve(self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: + def retrieve( + self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] + | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -82,21 +86,29 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, + report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, + ), + ), cast_to=ResponseWrapper, ) + class AsyncReportProblemWithStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: @@ -117,20 +129,23 @@ def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStrea """ return AsyncReportProblemWithStopResourceWithStreamingResponse(self) - async def retrieve(self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: + async def retrieve( + self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] + | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -154,21 +169,29 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, + report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, + ), + ), cast_to=ResponseWrapper, ) + class ReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -177,6 +200,7 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) + class AsyncReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -185,6 +209,7 @@ def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) report_problem_with_stop.retrieve, ) + class ReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -193,10 +218,11 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) + class AsyncReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop self.retrieve = async_to_streamed_response_wrapper( report_problem_with_stop.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index b2506b5..d0f9733 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -25,6 +25,7 @@ __all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] + class ReportProblemWithTripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: @@ -45,25 +46,35 @@ def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingR """ return ReportProblemWithTripResourceWithStreamingResponse(self) - def retrieve(self, - trip_id: str, - *, - code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: + def retrieve( + self, + trip_id: str, + *, + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] + | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -97,26 +108,34 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, + report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, + ), + ), cast_to=ResponseWrapper, ) + class AsyncReportProblemWithTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: @@ -137,25 +156,35 @@ def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStrea """ return AsyncReportProblemWithTripResourceWithStreamingResponse(self) - async def retrieve(self, - trip_id: str, - *, - code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: + async def retrieve( + self, + trip_id: str, + *, + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] + | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -189,26 +218,34 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, + report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, + ), + ), cast_to=ResponseWrapper, ) + class ReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -217,6 +254,7 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) + class AsyncReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -225,6 +263,7 @@ def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) report_problem_with_trip.retrieve, ) + class ReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -233,10 +272,11 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) + class AsyncReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip self.retrieve = async_to_streamed_response_wrapper( report_problem_with_trip.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index adc785a..62ae14a 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -18,6 +18,7 @@ __all__ = ["RouteResource", "AsyncRouteResource"] + class RouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> RouteResourceWithStreamingResponse: """ return RouteResourceWithStreamingResponse(self) - def retrieve(self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: + def retrieve( + self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( f"/api/where/route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RouteRetrieveResponse, ) + class AsyncRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncRouteResourceWithStreamingResponse: """ return AsyncRouteResourceWithStreamingResponse(self) - async def retrieve(self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: + async def retrieve( + self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( f"/api/where/route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RouteRetrieveResponse, ) + class RouteResourceWithRawResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -128,6 +135,7 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) + class AsyncRouteResourceWithRawResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route @@ -136,6 +144,7 @@ def __init__(self, route: AsyncRouteResource) -> None: route.retrieve, ) + class RouteResourceWithStreamingResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -144,10 +153,11 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) + class AsyncRouteResourceWithStreamingResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route self.retrieve = async_to_streamed_response_wrapper( route.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index 7a33d59..e5ddfa3 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -18,6 +18,7 @@ __all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] + class RouteIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> RouteIDsForAgencyResourceWithStreamingRespo """ return RouteIDsForAgencyResourceWithStreamingResponse(self) - def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -60,15 +63,16 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RouteIDsForAgencyListResponse, ) + class AsyncRouteIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncRouteIDsForAgencyResourceWithStreaming """ return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self) - async def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -111,15 +117,16 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RouteIDsForAgencyListResponse, ) + class RouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -128,6 +135,7 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) + class AsyncRouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -136,6 +144,7 @@ def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None route_ids_for_agency.list, ) + class RouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -144,10 +153,11 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) + class AsyncRouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency self.list = async_to_streamed_response_wrapper( route_ids_for_agency.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index 7f1b5ba..ff7a8cd 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -18,6 +18,7 @@ __all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] + class RoutesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> RoutesForAgencyResourceWithStreamingRespons """ return RoutesForAgencyResourceWithStreamingResponse(self) - def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -60,15 +63,16 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RoutesForAgencyListResponse, ) + class AsyncRoutesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncRoutesForAgencyResourceWithStreamingRe """ return AsyncRoutesForAgencyResourceWithStreamingResponse(self) - async def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -111,15 +117,16 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=RoutesForAgencyListResponse, ) + class RoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -128,6 +135,7 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) + class AsyncRoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -136,6 +144,7 @@ def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: routes_for_agency.list, ) + class RoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -144,10 +153,11 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) + class AsyncRoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency self.list = async_to_streamed_response_wrapper( routes_for_agency.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index f43e196..d315909 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -23,6 +23,7 @@ __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] + class RoutesForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: @@ -43,20 +44,22 @@ def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingRespo """ return RoutesForLocationResourceWithStreamingResponse(self) - def list(self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: + def list( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -71,17 +74,27 @@ def list(self, """ return self._get( "/api/where/routes-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, routes_for_location_list_params.RoutesForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + routes_for_location_list_params.RoutesForLocationListParams, + ), + ), cast_to=RoutesForLocationListResponse, ) + class AsyncRoutesForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: @@ -102,20 +115,22 @@ def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreaming """ return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def list(self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: + async def list( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -130,17 +145,27 @@ async def list(self, """ return await self._get( "/api/where/routes-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, routes_for_location_list_params.RoutesForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + routes_for_location_list_params.RoutesForLocationListParams, + ), + ), cast_to=RoutesForLocationListResponse, ) + class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -149,6 +174,7 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) + class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -157,6 +183,7 @@ def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: routes_for_location.list, ) + class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -165,10 +192,11 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) + class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location self.list = async_to_streamed_response_wrapper( routes_for_location.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 53a5303..3d5509d 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -26,6 +26,7 @@ __all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] + class ScheduleForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: @@ -46,16 +47,18 @@ def with_streaming_response(self) -> ScheduleForRouteResourceWithStreamingRespon """ return ScheduleForRouteResourceWithStreamingResponse(self) - def retrieve(self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: + def retrieve( + self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -72,17 +75,22 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "date": date - }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams + ), + ), cast_to=ScheduleForRouteRetrieveResponse, ) + class AsyncScheduleForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: @@ -103,16 +111,18 @@ def with_streaming_response(self) -> AsyncScheduleForRouteResourceWithStreamingR """ return AsyncScheduleForRouteResourceWithStreamingResponse(self) - async def retrieve(self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: + async def retrieve( + self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -129,17 +139,22 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "date": date - }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams + ), + ), cast_to=ScheduleForRouteRetrieveResponse, ) + class ScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -148,6 +163,7 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) + class AsyncScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -156,6 +172,7 @@ def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) + class ScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -164,10 +181,11 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) + class AsyncScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route self.retrieve = async_to_streamed_response_wrapper( schedule_for_route.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index f1dd499..78b4d36 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -26,6 +26,7 @@ __all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] + class ScheduleForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: @@ -46,16 +47,18 @@ def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingRespons """ return ScheduleForStopResourceWithStreamingResponse(self) - def retrieve(self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: + def retrieve( + self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -72,17 +75,20 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "date": date - }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams), + ), cast_to=ScheduleForStopRetrieveResponse, ) + class AsyncScheduleForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: @@ -103,16 +109,18 @@ def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingRe """ return AsyncScheduleForStopResourceWithStreamingResponse(self) - async def retrieve(self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: + async def retrieve( + self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -129,17 +137,22 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "date": date - }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams + ), + ), cast_to=ScheduleForStopRetrieveResponse, ) + class ScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -148,6 +161,7 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) + class AsyncScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -156,6 +170,7 @@ def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) + class ScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -164,10 +179,11 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) + class AsyncScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop self.retrieve = async_to_streamed_response_wrapper( schedule_for_stop.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index b4b3968..fe1d9a2 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -23,6 +23,7 @@ __all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] + class SearchForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: @@ -43,16 +44,18 @@ def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse """ return SearchForRouteResourceWithStreamingResponse(self) - def list(self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: + def list( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -71,13 +74,23 @@ def list(self, """ return self._get( "/api/where/search/route.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "input": input, - "max_count": max_count, - }, search_for_route_list_params.SearchForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_route_list_params.SearchForRouteListParams, + ), + ), cast_to=SearchForRouteListResponse, ) + class AsyncSearchForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: @@ -98,16 +111,18 @@ def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingRes """ return AsyncSearchForRouteResourceWithStreamingResponse(self) - async def list(self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: + async def list( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -126,13 +141,23 @@ async def list(self, """ return await self._get( "/api/where/search/route.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "input": input, - "max_count": max_count, - }, search_for_route_list_params.SearchForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_route_list_params.SearchForRouteListParams, + ), + ), cast_to=SearchForRouteListResponse, ) + class SearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -141,6 +166,7 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) + class AsyncSearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -149,6 +175,7 @@ def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: search_for_route.list, ) + class SearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -157,10 +184,11 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) + class AsyncSearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route self.list = async_to_streamed_response_wrapper( search_for_route.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 2aba780..8efb8ad 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -23,6 +23,7 @@ __all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] + class SearchForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForStopResourceWithRawResponse: @@ -43,16 +44,18 @@ def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: """ return SearchForStopResourceWithStreamingResponse(self) - def list(self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: + def list( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -71,13 +74,23 @@ def list(self, """ return self._get( "/api/where/search/stop.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "input": input, - "max_count": max_count, - }, search_for_stop_list_params.SearchForStopListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_stop_list_params.SearchForStopListParams, + ), + ), cast_to=SearchForStopListResponse, ) + class AsyncSearchForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: @@ -98,16 +111,18 @@ def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResp """ return AsyncSearchForStopResourceWithStreamingResponse(self) - async def list(self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: + async def list( + self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -126,13 +141,23 @@ async def list(self, """ return await self._get( "/api/where/search/stop.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "input": input, - "max_count": max_count, - }, search_for_stop_list_params.SearchForStopListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "input": input, + "max_count": max_count, + }, + search_for_stop_list_params.SearchForStopListParams, + ), + ), cast_to=SearchForStopListResponse, ) + class SearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -141,6 +166,7 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) + class AsyncSearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -149,6 +175,7 @@ def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: search_for_stop.list, ) + class SearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -157,10 +184,11 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) + class AsyncSearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop self.list = async_to_streamed_response_wrapper( search_for_stop.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 7ae390c..0b4c291 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -18,6 +18,7 @@ __all__ = ["ShapeResource", "AsyncShapeResource"] + class ShapeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ShapeResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> ShapeResourceWithStreamingResponse: """ return ShapeResourceWithStreamingResponse(self) - def retrieve(self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: + def retrieve( + self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError( - f'Expected a non-empty value for `shape_id` but received {shape_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") return self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=ShapeRetrieveResponse, ) + class AsyncShapeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncShapeResourceWithStreamingResponse: """ return AsyncShapeResourceWithStreamingResponse(self) - async def retrieve(self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: + async def retrieve( + self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError( - f'Expected a non-empty value for `shape_id` but received {shape_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") return await self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=ShapeRetrieveResponse, ) + class ShapeResourceWithRawResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -128,6 +135,7 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) + class AsyncShapeResourceWithRawResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape @@ -136,6 +144,7 @@ def __init__(self, shape: AsyncShapeResource) -> None: shape.retrieve, ) + class ShapeResourceWithStreamingResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -144,10 +153,11 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) + class AsyncShapeResourceWithStreamingResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape self.retrieve = async_to_streamed_response_wrapper( shape.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 5d1f22e..502f8ce 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -18,6 +18,7 @@ __all__ = ["StopResource", "AsyncStopResource"] + class StopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> StopResourceWithStreamingResponse: """ return StopResourceWithStreamingResponse(self) - def retrieve(self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: + def retrieve( + self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopRetrieveResponse: """ Get details of a specific stop @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopRetrieveResponse, ) + class AsyncStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse: """ return AsyncStopResourceWithStreamingResponse(self) - async def retrieve(self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: + async def retrieve( + self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopRetrieveResponse: """ Get details of a specific stop @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError( - f'Expected a non-empty value for `stop_id` but received {stop_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopRetrieveResponse, ) + class StopResourceWithRawResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -128,6 +135,7 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) + class AsyncStopResourceWithRawResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop @@ -136,6 +144,7 @@ def __init__(self, stop: AsyncStopResource) -> None: stop.retrieve, ) + class StopResourceWithStreamingResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -144,10 +153,11 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) + class AsyncStopResourceWithStreamingResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop self.retrieve = async_to_streamed_response_wrapper( stop.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 5311acd..3850d16 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -18,6 +18,7 @@ __all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] + class StopIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingRespon """ return StopIDsForAgencyResourceWithStreamingResponse(self) - def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -60,15 +63,16 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopIDsForAgencyListResponse, ) + class AsyncStopIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingR """ return AsyncStopIDsForAgencyResourceWithStreamingResponse(self) - async def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -111,15 +117,16 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopIDsForAgencyListResponse, ) + class StopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -128,6 +135,7 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) + class AsyncStopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -136,6 +144,7 @@ def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) + class StopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -144,10 +153,11 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) + class AsyncStopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency self.list = async_to_streamed_response_wrapper( stop_ids_for_agency.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 8458527..834ab5c 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -18,6 +18,7 @@ __all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] + class StopsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForAgencyResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> StopsForAgencyResourceWithStreamingResponse """ return StopsForAgencyResourceWithStreamingResponse(self) - def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: + def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -60,15 +63,16 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopsForAgencyListResponse, ) + class AsyncStopsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForAgencyResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncStopsForAgencyResourceWithStreamingRes """ return AsyncStopsForAgencyResourceWithStreamingResponse(self) - async def list(self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: + async def list( + self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -111,15 +117,16 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=StopsForAgencyListResponse, ) + class StopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -128,6 +135,7 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) + class AsyncStopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -136,6 +144,7 @@ def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: stops_for_agency.list, ) + class StopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -144,10 +153,11 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) + class AsyncStopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency self.list = async_to_streamed_response_wrapper( stops_for_agency.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 3da78db..80322e3 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -23,6 +23,7 @@ __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] + class StopsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: @@ -43,20 +44,22 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon """ return StopsForLocationResourceWithStreamingResponse(self) - def list(self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: + def list( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForLocationListResponse: """ stops-for-location @@ -79,17 +82,27 @@ def list(self, """ return self._get( "/api/where/stops-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, stops_for_location_list_params.StopsForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + stops_for_location_list_params.StopsForLocationListParams, + ), + ), cast_to=StopsForLocationListResponse, ) + class AsyncStopsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: @@ -110,20 +123,22 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR """ return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def list(self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: + async def list( + self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForLocationListResponse: """ stops-for-location @@ -146,17 +161,27 @@ async def list(self, """ return await self._get( "/api/where/stops-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, stops_for_location_list_params.StopsForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, + stops_for_location_list_params.StopsForLocationListParams, + ), + ), cast_to=StopsForLocationListResponse, ) + class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -165,6 +190,7 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) + class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -173,6 +199,7 @@ def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: stops_for_location.list, ) + class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -181,10 +208,11 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) + class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location self.list = async_to_streamed_response_wrapper( stops_for_location.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index d4c1d80..36f7514 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -23,6 +23,7 @@ __all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] + class StopsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForRouteResourceWithRawResponse: @@ -43,17 +44,19 @@ def with_streaming_response(self) -> StopsForRouteResourceWithStreamingResponse: """ return StopsForRouteResourceWithStreamingResponse(self) - def list(self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: + def list( + self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -71,18 +74,26 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "include_polylines": include_polylines, - "time": time, - }, stops_for_route_list_params.StopsForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_polylines": include_polylines, + "time": time, + }, + stops_for_route_list_params.StopsForRouteListParams, + ), + ), cast_to=StopsForRouteListResponse, ) + class AsyncStopsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse: @@ -103,17 +114,19 @@ def with_streaming_response(self) -> AsyncStopsForRouteResourceWithStreamingResp """ return AsyncStopsForRouteResourceWithStreamingResponse(self) - async def list(self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: + async def list( + self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -131,18 +144,26 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "include_polylines": include_polylines, - "time": time, - }, stops_for_route_list_params.StopsForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_polylines": include_polylines, + "time": time, + }, + stops_for_route_list_params.StopsForRouteListParams, + ), + ), cast_to=StopsForRouteListResponse, ) + class StopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -151,6 +172,7 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) + class AsyncStopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -159,6 +181,7 @@ def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: stops_for_route.list, ) + class StopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -167,10 +190,11 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) + class AsyncStopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route self.list = async_to_streamed_response_wrapper( stops_for_route.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index c570387..9b7e137 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -18,6 +18,7 @@ __all__ = ["TripResource", "AsyncTripResource"] + class TripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripResourceWithRawResponse: @@ -38,15 +39,17 @@ def with_streaming_response(self) -> TripResourceWithStreamingResponse: """ return TripResourceWithStreamingResponse(self) - def retrieve(self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: + def retrieve( + self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripRetrieveResponse: """ Get details of a specific trip @@ -60,15 +63,16 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=TripRetrieveResponse, ) + class AsyncTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripResourceWithRawResponse: @@ -89,15 +93,17 @@ def with_streaming_response(self) -> AsyncTripResourceWithStreamingResponse: """ return AsyncTripResourceWithStreamingResponse(self) - async def retrieve(self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: + async def retrieve( + self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripRetrieveResponse: """ Get details of a specific trip @@ -111,15 +117,16 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), cast_to=TripRetrieveResponse, ) + class TripResourceWithRawResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -128,6 +135,7 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) + class AsyncTripResourceWithRawResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip @@ -136,6 +144,7 @@ def __init__(self, trip: AsyncTripResource) -> None: trip.retrieve, ) + class TripResourceWithStreamingResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -144,10 +153,11 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) + class AsyncTripResourceWithStreamingResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip self.retrieve = async_to_streamed_response_wrapper( trip.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 4c4fe91..71092c9 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -23,6 +23,7 @@ __all__ = ["TripDetailsResource", "AsyncTripDetailsResource"] + class TripDetailsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripDetailsResourceWithRawResponse: @@ -43,20 +44,22 @@ def with_streaming_response(self) -> TripDetailsResourceWithStreamingResponse: """ return TripDetailsResourceWithStreamingResponse(self) - def retrieve(self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: + def retrieve( + self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -83,21 +86,29 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, trip_detail_retrieve_params.TripDetailRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, + trip_detail_retrieve_params.TripDetailRetrieveParams, + ), + ), cast_to=TripDetailRetrieveResponse, ) + class AsyncTripDetailsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: @@ -118,20 +129,22 @@ def with_streaming_response(self) -> AsyncTripDetailsResourceWithStreamingRespon """ return AsyncTripDetailsResourceWithStreamingResponse(self) - async def retrieve(self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: + async def retrieve( + self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -158,21 +171,29 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError( - f'Expected a non-empty value for `trip_id` but received {trip_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, trip_detail_retrieve_params.TripDetailRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, + trip_detail_retrieve_params.TripDetailRetrieveParams, + ), + ), cast_to=TripDetailRetrieveResponse, ) + class TripDetailsResourceWithRawResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -181,6 +202,7 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) + class AsyncTripDetailsResourceWithRawResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details @@ -189,6 +211,7 @@ def __init__(self, trip_details: AsyncTripDetailsResource) -> None: trip_details.retrieve, ) + class TripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -197,10 +220,11 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) + class AsyncTripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details self.retrieve = async_to_streamed_response_wrapper( trip_details.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 1a993a1..4417b48 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -23,6 +23,7 @@ __all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"] + class TripForVehicleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: @@ -43,19 +44,21 @@ def with_streaming_response(self) -> TripForVehicleResourceWithStreamingResponse """ return TripForVehicleResourceWithStreamingResponse(self) - def retrieve(self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: + def retrieve( + self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -80,20 +83,28 @@ def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError( - f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, + trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, + ), + ), cast_to=TripForVehicleRetrieveResponse, ) + class AsyncTripForVehicleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse: @@ -114,19 +125,21 @@ def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingRes """ return AsyncTripForVehicleResourceWithStreamingResponse(self) - async def retrieve(self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: + async def retrieve( + self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -151,20 +164,28 @@ async def retrieve(self, timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError( - f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return await self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, + trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, + ), + ), cast_to=TripForVehicleRetrieveResponse, ) + class TripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -173,6 +194,7 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) + class AsyncTripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -181,6 +203,7 @@ def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) + class TripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -189,10 +212,11 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) + class AsyncTripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle self.retrieve = async_to_streamed_response_wrapper( trip_for_vehicle.retrieve, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index f3decf4..84958f9 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -23,6 +23,7 @@ __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] + class TripsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: @@ -43,21 +44,23 @@ def with_streaming_response(self) -> TripsForLocationResourceWithStreamingRespon """ return TripsForLocationResourceWithStreamingResponse(self) - def list(self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: + def list( + self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -88,18 +91,28 @@ def list(self, """ return self._get( "/api/where/trips-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, trips_for_location_list_params.TripsForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, + trips_for_location_list_params.TripsForLocationListParams, + ), + ), cast_to=TripsForLocationListResponse, ) + class AsyncTripsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: @@ -120,21 +133,23 @@ def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingR """ return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def list(self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: + async def list( + self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -165,18 +180,28 @@ async def list(self, """ return await self._get( "/api/where/trips-for-location.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, trips_for_location_list_params.TripsForLocationListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, + trips_for_location_list_params.TripsForLocationListParams, + ), + ), cast_to=TripsForLocationListResponse, ) + class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -185,6 +210,7 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) + class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -193,6 +219,7 @@ def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: trips_for_location.list, ) + class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -201,10 +228,11 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) + class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location self.list = async_to_streamed_response_wrapper( trips_for_location.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index 129ab33..a5ca21d 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -23,6 +23,7 @@ __all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] + class TripsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: @@ -43,18 +44,20 @@ def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: """ return TripsForRouteResourceWithStreamingResponse(self) - def list(self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: + def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -75,19 +78,27 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, trips_for_route_list_params.TripsForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), cast_to=TripsForRouteListResponse, ) + class AsyncTripsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: @@ -108,18 +119,20 @@ def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResp """ return AsyncTripsForRouteResourceWithStreamingResponse(self) - async def list(self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: + async def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -140,19 +153,27 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError( - f'Expected a non-empty value for `route_id` but received {route_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, trips_for_route_list_params.TripsForRouteListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), cast_to=TripsForRouteListResponse, ) + class TripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -161,6 +182,7 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) + class AsyncTripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -169,6 +191,7 @@ def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: trips_for_route.list, ) + class TripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -177,10 +200,11 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) + class AsyncTripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route self.list = async_to_streamed_response_wrapper( trips_for_route.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 2cd39db..3f8697d 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -23,6 +23,7 @@ __all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] + class VehiclesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: @@ -43,16 +44,18 @@ def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingRespo """ return VehiclesForAgencyResourceWithStreamingResponse(self) - def list(self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: + def list( + self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -68,17 +71,20 @@ def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ - "time": time - }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams), + ), cast_to=VehiclesForAgencyListResponse, ) + class AsyncVehiclesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: @@ -99,16 +105,18 @@ def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreaming """ return AsyncVehiclesForAgencyResourceWithStreamingResponse(self) - async def list(self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: + async def list( + self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -124,17 +132,22 @@ async def list(self, timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError( - f'Expected a non-empty value for `agency_id` but received {agency_id!r}' - ) + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ - "time": time - }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams + ), + ), cast_to=VehiclesForAgencyListResponse, ) + class VehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -143,6 +156,7 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) + class AsyncVehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -151,6 +165,7 @@ def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) + class VehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -159,10 +174,11 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) + class AsyncVehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency self.list = async_to_streamed_response_wrapper( vehicles_for_agency.list, - ) \ No newline at end of file + ) diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py index d972228..13f182b 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -8,25 +8,32 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["AgenciesWithCoverageListResponse", "AgenciesWithCoverageListResponseData", "AgenciesWithCoverageListResponseDataList"] +__all__ = [ + "AgenciesWithCoverageListResponse", + "AgenciesWithCoverageListResponseData", + "AgenciesWithCoverageListResponseDataList", +] + class AgenciesWithCoverageListResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") lat: float - lat_span: float = FieldInfo(alias = "latSpan") + lat_span: float = FieldInfo(alias="latSpan") lon: float - lon_span: float = FieldInfo(alias = "lonSpan") + lon_span: float = FieldInfo(alias="lonSpan") + class AgenciesWithCoverageListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[AgenciesWithCoverageListResponseDataList] references: References + class AgenciesWithCoverageListResponse(ResponseWrapper): - data: AgenciesWithCoverageListResponseData \ No newline at end of file + data: AgenciesWithCoverageListResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index a599b3c..61d8e79 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -10,6 +10,7 @@ __all__ = ["AgencyRetrieveResponse", "AgencyRetrieveResponseData", "AgencyRetrieveResponseDataEntry"] + class AgencyRetrieveResponseDataEntry(BaseModel): id: str @@ -23,20 +24,22 @@ class AgencyRetrieveResponseDataEntry(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) + fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) + private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) + class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") references: References + class AgencyRetrieveResponse(ResponseWrapper): - data: AgencyRetrieveResponseData \ No newline at end of file + data: AgencyRetrieveResponseData diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py index 79b8ee0..fd1f0c0 100644 --- a/src/onebusaway/types/arrival_and_departure_list_params.py +++ b/src/onebusaway/types/arrival_and_departure_list_params.py @@ -10,6 +10,7 @@ __all__ = ["ArrivalAndDepartureListParams"] + class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_after: Annotated[int, PropertyInfo(alias="minutesAfter")] """Include vehicles arriving or departing in the next n minutes.""" @@ -17,5 +18,5 @@ class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_before: Annotated[int, PropertyInfo(alias="minutesBefore")] """Include vehicles having arrived or departed in the previous n minutes.""" - time: Annotated[Union[str, datetime], PropertyInfo(format = "iso8601")] - """The specific time for querying the system status.""" \ No newline at end of file + time: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The specific time for querying the system status.""" diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 65e555a..cbabf18 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -8,7 +8,16 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["ArrivalAndDepartureListResponse", "ArrivalAndDepartureListResponseData", "ArrivalAndDepartureListResponseDataEntry", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition"] +__all__ = [ + "ArrivalAndDepartureListResponse", + "ArrivalAndDepartureListResponseData", + "ArrivalAndDepartureListResponseDataEntry", + "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", + "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", + "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", + "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition", +] + class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -17,6 +26,7 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLast lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -24,38 +34,39 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -64,10 +75,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -76,10 +87,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -88,16 +99,18 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[ + ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation + ] = FieldInfo(alias="lastKnownLocation", default=None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -109,152 +122,160 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas position: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias = "departureEnabled") + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias = "stopId") + stop_id: str = FieldInfo(alias="stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias = "stopSequence") + stop_sequence: int = FieldInfo(alias="stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias = "tripHeadsign") + trip_headsign: str = FieldInfo(alias="tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias = "vehicleId") + vehicle_id: str = FieldInfo(alias="vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) + last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) + predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) + predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) + route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) + scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo(alias = "tripStatus", default = None) + trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( + alias="tripStatus", default=None + ) """Trip-specific status for the arriving transit vehicle.""" + class ArrivalAndDepartureListResponseDataEntry(BaseModel): - arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo(alias = "arrivalsAndDepartures") + arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( + alias="arrivalsAndDepartures" + ) + class ArrivalAndDepartureListResponseData(BaseModel): entry: ArrivalAndDepartureListResponseDataEntry references: References + class ArrivalAndDepartureListResponse(ResponseWrapper): - data: ArrivalAndDepartureListResponseData \ No newline at end of file + data: ArrivalAndDepartureListResponseData diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py index ea44970..3451b73 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_params.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_params.py @@ -8,6 +8,7 @@ __all__ = ["ArrivalAndDepartureRetrieveParams"] + class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): service_date: Required[Annotated[int, PropertyInfo(alias="serviceDate")]] @@ -17,4 +18,4 @@ class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): time: int - vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] \ No newline at end of file + vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index 5b73f1f..a0bc771 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -8,7 +8,15 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["ArrivalAndDepartureRetrieveResponse", "ArrivalAndDepartureRetrieveResponseData", "ArrivalAndDepartureRetrieveResponseDataEntry", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition"] +__all__ = [ + "ArrivalAndDepartureRetrieveResponse", + "ArrivalAndDepartureRetrieveResponseData", + "ArrivalAndDepartureRetrieveResponseDataEntry", + "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", + "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", + "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition", +] + class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -17,6 +25,7 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(Ba lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -24,38 +33,39 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -64,10 +74,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -76,10 +86,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -88,16 +98,18 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -109,149 +121,154 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): position: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias = "departureEnabled") + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias = "stopId") + stop_id: str = FieldInfo(alias="stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias = "stopSequence") + stop_sequence: int = FieldInfo(alias="stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias = "tripHeadsign") + trip_headsign: str = FieldInfo(alias="tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias = "vehicleId") + vehicle_id: str = FieldInfo(alias="vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) + last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) + predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) + predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) + route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) + scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo(alias = "tripStatus", default = None) + trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( + alias="tripStatus", default=None + ) """Trip-specific status for the arriving transit vehicle.""" + class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry references: References + class ArrivalAndDepartureRetrieveResponse(ResponseWrapper): - data: ArrivalAndDepartureRetrieveResponseData \ No newline at end of file + data: ArrivalAndDepartureRetrieveResponseData diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py index abd6b68..aecb822 100644 --- a/src/onebusaway/types/block_retrieve_response.py +++ b/src/onebusaway/types/block_retrieve_response.py @@ -8,53 +8,70 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["BlockRetrieveResponse", "BlockRetrieveResponseData", "BlockRetrieveResponseDataEntry", "BlockRetrieveResponseDataEntryConfiguration", "BlockRetrieveResponseDataEntryConfigurationTrip", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime"] +__all__ = [ + "BlockRetrieveResponse", + "BlockRetrieveResponseData", + "BlockRetrieveResponseDataEntry", + "BlockRetrieveResponseDataEntryConfiguration", + "BlockRetrieveResponseDataEntryConfigurationTrip", + "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", + "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime", +] + class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime(BaseModel): - arrival_time: int = FieldInfo(alias = "arrivalTime") + arrival_time: int = FieldInfo(alias="arrivalTime") + + departure_time: int = FieldInfo(alias="departureTime") - departure_time: int = FieldInfo(alias = "departureTime") + stop_id: str = FieldInfo(alias="stopId") - stop_id: str = FieldInfo(alias = "stopId") + drop_off_type: Optional[int] = FieldInfo(alias="dropOffType", default=None) - drop_off_type: Optional[int] = FieldInfo(alias = "dropOffType", default = None) + pickup_type: Optional[int] = FieldInfo(alias="pickupType", default=None) - pickup_type: Optional[int] = FieldInfo(alias = "pickupType", default = None) class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime(BaseModel): - accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") + accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") - block_sequence: int = FieldInfo(alias = "blockSequence") + block_sequence: int = FieldInfo(alias="blockSequence") - distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + distance_along_block: float = FieldInfo(alias="distanceAlongBlock") + + stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias="stopTime") - stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias = "stopTime") class BlockRetrieveResponseDataEntryConfigurationTrip(BaseModel): - accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") + accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") + + block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo( + alias="blockStopTimes" + ) - block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo(alias = "blockStopTimes") + distance_along_block: float = FieldInfo(alias="distanceAlongBlock") - distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + trip_id: str = FieldInfo(alias="tripId") - trip_id: str = FieldInfo(alias = "tripId") class BlockRetrieveResponseDataEntryConfiguration(BaseModel): - active_service_ids: List[str] = FieldInfo(alias = "activeServiceIds") + active_service_ids: List[str] = FieldInfo(alias="activeServiceIds") trips: List[BlockRetrieveResponseDataEntryConfigurationTrip] - inactive_service_ids: Optional[List[str]] = FieldInfo(alias = "inactiveServiceIds", default = None) + inactive_service_ids: Optional[List[str]] = FieldInfo(alias="inactiveServiceIds", default=None) + class BlockRetrieveResponseDataEntry(BaseModel): id: str configurations: List[BlockRetrieveResponseDataEntryConfiguration] + class BlockRetrieveResponseData(BaseModel): entry: BlockRetrieveResponseDataEntry references: References + class BlockRetrieveResponse(ResponseWrapper): - data: BlockRetrieveResponseData \ No newline at end of file + data: BlockRetrieveResponseData diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index c81ccf4..eaa7cf9 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -8,64 +8,75 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["ConfigRetrieveResponse", "ConfigRetrieveResponseData", "ConfigRetrieveResponseDataEntry", "ConfigRetrieveResponseDataEntryGitProperties"] +__all__ = [ + "ConfigRetrieveResponse", + "ConfigRetrieveResponseData", + "ConfigRetrieveResponseDataEntry", + "ConfigRetrieveResponseDataEntryGitProperties", +] + class ConfigRetrieveResponseDataEntryGitProperties(BaseModel): - git_branch: Optional[str] = FieldInfo(alias = "git.branch", default = None) + git_branch: Optional[str] = FieldInfo(alias="git.branch", default=None) + + git_build_host: Optional[str] = FieldInfo(alias="git.build.host", default=None) - git_build_host: Optional[str] = FieldInfo(alias = "git.build.host", default = None) + git_build_time: Optional[str] = FieldInfo(alias="git.build.time", default=None) - git_build_time: Optional[str] = FieldInfo(alias = "git.build.time", default = None) + git_build_user_email: Optional[str] = FieldInfo(alias="git.build.user.email", default=None) - git_build_user_email: Optional[str] = FieldInfo(alias = "git.build.user.email", default = None) + git_build_user_name: Optional[str] = FieldInfo(alias="git.build.user.name", default=None) - git_build_user_name: Optional[str] = FieldInfo(alias = "git.build.user.name", default = None) + git_build_version: Optional[str] = FieldInfo(alias="git.build.version", default=None) - git_build_version: Optional[str] = FieldInfo(alias = "git.build.version", default = None) + git_closest_tag_commit_count: Optional[str] = FieldInfo(alias="git.closest.tag.commit.count", default=None) - git_closest_tag_commit_count: Optional[str] = FieldInfo(alias = "git.closest.tag.commit.count", default = None) + git_closest_tag_name: Optional[str] = FieldInfo(alias="git.closest.tag.name", default=None) - git_closest_tag_name: Optional[str] = FieldInfo(alias = "git.closest.tag.name", default = None) + git_commit_id: Optional[str] = FieldInfo(alias="git.commit.id", default=None) - git_commit_id: Optional[str] = FieldInfo(alias = "git.commit.id", default = None) + git_commit_id_abbrev: Optional[str] = FieldInfo(alias="git.commit.id.abbrev", default=None) - git_commit_id_abbrev: Optional[str] = FieldInfo(alias = "git.commit.id.abbrev", default = None) + git_commit_id_describe: Optional[str] = FieldInfo(alias="git.commit.id.describe", default=None) - git_commit_id_describe: Optional[str] = FieldInfo(alias = "git.commit.id.describe", default = None) + git_commit_id_describe_short: Optional[str] = FieldInfo(alias="git.commit.id.describe-short", default=None) - git_commit_id_describe_short: Optional[str] = FieldInfo(alias = "git.commit.id.describe-short", default = None) + git_commit_message_full: Optional[str] = FieldInfo(alias="git.commit.message.full", default=None) - git_commit_message_full: Optional[str] = FieldInfo(alias = "git.commit.message.full", default = None) + git_commit_message_short: Optional[str] = FieldInfo(alias="git.commit.message.short", default=None) - git_commit_message_short: Optional[str] = FieldInfo(alias = "git.commit.message.short", default = None) + git_commit_time: Optional[str] = FieldInfo(alias="git.commit.time", default=None) - git_commit_time: Optional[str] = FieldInfo(alias = "git.commit.time", default = None) + git_commit_user_email: Optional[str] = FieldInfo(alias="git.commit.user.email", default=None) - git_commit_user_email: Optional[str] = FieldInfo(alias = "git.commit.user.email", default = None) + git_commit_user_name: Optional[str] = FieldInfo(alias="git.commit.user.name", default=None) - git_commit_user_name: Optional[str] = FieldInfo(alias = "git.commit.user.name", default = None) + git_dirty: Optional[str] = FieldInfo(alias="git.dirty", default=None) - git_dirty: Optional[str] = FieldInfo(alias = "git.dirty", default = None) + git_remote_origin_url: Optional[str] = FieldInfo(alias="git.remote.origin.url", default=None) - git_remote_origin_url: Optional[str] = FieldInfo(alias = "git.remote.origin.url", default = None) + git_tags: Optional[str] = FieldInfo(alias="git.tags", default=None) - git_tags: Optional[str] = FieldInfo(alias = "git.tags", default = None) class ConfigRetrieveResponseDataEntry(BaseModel): id: Optional[str] = None - git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo(alias = "gitProperties", default = None) + git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo( + alias="gitProperties", default=None + ) name: Optional[str] = None - service_date_from: Optional[str] = FieldInfo(alias = "serviceDateFrom", default = None) + service_date_from: Optional[str] = FieldInfo(alias="serviceDateFrom", default=None) + + service_date_to: Optional[str] = FieldInfo(alias="serviceDateTo", default=None) - service_date_to: Optional[str] = FieldInfo(alias = "serviceDateTo", default = None) class ConfigRetrieveResponseData(BaseModel): entry: ConfigRetrieveResponseDataEntry references: References + class ConfigRetrieveResponse(ResponseWrapper): - data: ConfigRetrieveResponseData \ No newline at end of file + data: ConfigRetrieveResponseData diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 90377e3..20fddb2 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -10,15 +10,18 @@ __all__ = ["CurrentTimeRetrieveResponse", "CurrentTimeRetrieveResponseData", "CurrentTimeRetrieveResponseDataEntry"] + class CurrentTimeRetrieveResponseDataEntry(BaseModel): - readable_time: Optional[str] = FieldInfo(alias = "readableTime", default = None) + readable_time: Optional[str] = FieldInfo(alias="readableTime", default=None) time: Optional[int] = None + class CurrentTimeRetrieveResponseData(BaseModel): entry: CurrentTimeRetrieveResponseDataEntry references: References + class CurrentTimeRetrieveResponse(ResponseWrapper): - data: CurrentTimeRetrieveResponseData \ No newline at end of file + data: CurrentTimeRetrieveResponseData diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py index 559f5b8..609f03f 100644 --- a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -8,6 +8,7 @@ __all__ = ["ReportProblemWithStopRetrieveParams"] + class ReportProblemWithStopRetrieveParams(TypedDict, total=False): code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] """A string code identifying the nature of the problem""" @@ -22,4 +23,4 @@ class ReportProblemWithStopRetrieveParams(TypedDict, total=False): """The reporting user’s location accuracy, in meters""" user_lon: Annotated[float, PropertyInfo(alias="userLon")] - """The reporting user’s current longitude""" \ No newline at end of file + """The reporting user’s current longitude""" diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py index 03bd538..f55386d 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -8,8 +8,16 @@ __all__ = ["ReportProblemWithTripRetrieveParams"] + class ReportProblemWithTripRetrieveParams(TypedDict, total=False): - code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] + code: Literal[ + "vehicle_never_came", + "vehicle_came_early", + "vehicle_came_late", + "wrong_headsign", + "vehicle_does_not_stop_here", + "other", + ] """A string code identifying the nature of the problem""" service_date: Annotated[int, PropertyInfo(alias="serviceDate")] @@ -37,4 +45,4 @@ class ReportProblemWithTripRetrieveParams(TypedDict, total=False): """The vehicle number, as reported by the user""" vehicle_id: Annotated[str, PropertyInfo(alias="vehicleID")] - """The vehicle actively serving the trip""" \ No newline at end of file + """The vehicle actively serving the trip""" diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index 520e852..193704e 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -10,12 +10,14 @@ __all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] + class RouteIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[str] references: References + class RouteIDsForAgencyListResponse(ResponseWrapper): - data: RouteIDsForAgencyListResponseData \ No newline at end of file + data: RouteIDsForAgencyListResponseData diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index aaf73fd..a0dfa1e 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -10,10 +10,11 @@ __all__ = ["RouteRetrieveResponse", "RouteRetrieveResponseData", "RouteRetrieveResponseDataEntry"] + class RouteRetrieveResponseDataEntry(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -21,20 +22,22 @@ class RouteRetrieveResponseDataEntry(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias = "longName", default = None) + long_name: Optional[str] = FieldInfo(alias="longName", default=None) - null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) - short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) - text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) url: Optional[str] = None + class RouteRetrieveResponseData(BaseModel): entry: RouteRetrieveResponseDataEntry references: References + class RouteRetrieveResponse(ResponseWrapper): - data: RouteRetrieveResponseData \ No newline at end of file + data: RouteRetrieveResponseData diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index ccca9a8..672141d 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -10,10 +10,11 @@ __all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] + class RoutesForAgencyListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -21,22 +22,24 @@ class RoutesForAgencyListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias = "longName", default = None) + long_name: Optional[str] = FieldInfo(alias="longName", default=None) - null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) - short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) - text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) url: Optional[str] = None + class RoutesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[RoutesForAgencyListResponseDataList] references: References + class RoutesForAgencyListResponse(ResponseWrapper): - data: RoutesForAgencyListResponseData \ No newline at end of file + data: RoutesForAgencyListResponseData diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py index 0773789..033ec2a 100644 --- a/src/onebusaway/types/routes_for_location_list_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -8,6 +8,7 @@ __all__ = ["RoutesForLocationListParams"] + class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -19,4 +20,4 @@ class RoutesForLocationListParams(TypedDict, total=False): query: str - radius: float \ No newline at end of file + radius: float diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index d053900..0393f01 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -8,12 +8,17 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["RoutesForLocationListResponse", "RoutesForLocationListResponseData", "RoutesForLocationListResponseDataList"] +__all__ = [ + "RoutesForLocationListResponse", + "RoutesForLocationListResponseData", + "RoutesForLocationListResponseDataList", +] + class RoutesForLocationListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -21,24 +26,26 @@ class RoutesForLocationListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias = "longName", default = None) + long_name: Optional[str] = FieldInfo(alias="longName", default=None) - null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) - short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) - text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) url: Optional[str] = None + class RoutesForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[RoutesForLocationListResponseDataList] - out_of_range: bool = FieldInfo(alias = "outOfRange") + out_of_range: bool = FieldInfo(alias="outOfRange") references: References + class RoutesForLocationListResponse(ResponseWrapper): - data: RoutesForLocationListResponseData \ No newline at end of file + data: RoutesForLocationListResponseData diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py index e763ac0..6d4d029 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -10,9 +10,10 @@ __all__ = ["ScheduleForRouteRetrieveParams"] + class ScheduleForRouteRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to current date) - """ \ No newline at end of file + """ diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 4f02939..8266786 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -7,7 +7,17 @@ from .._models import BaseModel from .shared.response_wrapper import ResponseWrapper -__all__ = ["ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", "ScheduleForRouteRetrieveResponseDataEntryTrip"] +__all__ = [ + "ScheduleForRouteRetrieveResponse", + "ScheduleForRouteRetrieveResponseData", + "ScheduleForRouteRetrieveResponseDataEntry", + "ScheduleForRouteRetrieveResponseDataEntryStop", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", + "ScheduleForRouteRetrieveResponseDataEntryTrip", +] + class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): id: str @@ -20,89 +30,102 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") - arrival_time: int = FieldInfo(alias = "arrivalTime") + arrival_time: int = FieldInfo(alias="arrivalTime") - departure_enabled: bool = FieldInfo(alias = "departureEnabled") + departure_enabled: bool = FieldInfo(alias="departureEnabled") - departure_time: int = FieldInfo(alias = "departureTime") + departure_time: int = FieldInfo(alias="departureTime") - stop_id: str = FieldInfo(alias = "stopId") + stop_id: str = FieldInfo(alias="stopId") - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") - service_id: Optional[str] = FieldInfo(alias = "serviceId", default = None) + service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime(BaseModel): - stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo( + alias="stopTimes" + ) + + trip_id: str = FieldInfo(alias="tripId") - trip_id: str = FieldInfo(alias = "tripId") class ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping(BaseModel): - direction_id: str = FieldInfo(alias = "directionId") + direction_id: str = FieldInfo(alias="directionId") - stop_ids: List[str] = FieldInfo(alias = "stopIds") + stop_ids: List[str] = FieldInfo(alias="stopIds") - trip_headsigns: List[str] = FieldInfo(alias = "tripHeadsigns") + trip_headsigns: List[str] = FieldInfo(alias="tripHeadsigns") - trip_ids: List[str] = FieldInfo(alias = "tripIds") + trip_ids: List[str] = FieldInfo(alias="tripIds") + + trips_with_stop_times: Optional[ + List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime] + ] = FieldInfo(alias="tripsWithStopTimes", default=None) - trips_with_stop_times: Optional[List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime]] = FieldInfo(alias = "tripsWithStopTimes", default = None) class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): id: str - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") + + service_id: str = FieldInfo(alias="serviceId") - service_id: str = FieldInfo(alias = "serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) - block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) + direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) - direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) + peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) - peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) + shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) - shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) - time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) + trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) - trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") - schedule_date: int = FieldInfo(alias = "scheduleDate") + schedule_date: int = FieldInfo(alias="scheduleDate") - service_ids: List[str] = FieldInfo(alias = "serviceIds") + service_ids: List[str] = FieldInfo(alias="serviceIds") stops: List[ScheduleForRouteRetrieveResponseDataEntryStop] - stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo(alias = "stopTripGroupings") + stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo( + alias="stopTripGroupings" + ) trips: List[ScheduleForRouteRetrieveResponseDataEntryTrip] + class ScheduleForRouteRetrieveResponseData(BaseModel): entry: ScheduleForRouteRetrieveResponseDataEntry + class ScheduleForRouteRetrieveResponse(ResponseWrapper): - data: ScheduleForRouteRetrieveResponseData \ No newline at end of file + data: ScheduleForRouteRetrieveResponseData diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py index fcfed09..99b89f7 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -10,9 +10,10 @@ __all__ = ["ScheduleForStopRetrieveParams"] + class ScheduleForStopRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to the current date) - """ \ No newline at end of file + """ diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py index 619e319..83d1985 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -8,59 +8,82 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["ScheduleForStopRetrieveResponse", "ScheduleForStopRetrieveResponseData", "ScheduleForStopRetrieveResponseDataEntry", "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency"] +__all__ = [ + "ScheduleForStopRetrieveResponse", + "ScheduleForStopRetrieveResponseData", + "ScheduleForStopRetrieveResponseDataEntry", + "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", + "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency", +] + class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + + arrival_time: int = FieldInfo(alias="arrivalTime") - arrival_time: int = FieldInfo(alias = "arrivalTime") + departure_enabled: bool = FieldInfo(alias="departureEnabled") - departure_enabled: bool = FieldInfo(alias = "departureEnabled") + departure_time: int = FieldInfo(alias="departureTime") - departure_time: int = FieldInfo(alias = "departureTime") + service_id: str = FieldInfo(alias="serviceId") - service_id: str = FieldInfo(alias = "serviceId") + trip_id: str = FieldInfo(alias="tripId") - trip_id: str = FieldInfo(alias = "tripId") + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency(BaseModel): - end_time: int = FieldInfo(alias = "endTime") + end_time: int = FieldInfo(alias="endTime") headway: int - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") - service_id: str = FieldInfo(alias = "serviceId") + service_id: str = FieldInfo(alias="serviceId") - start_time: int = FieldInfo(alias = "startTime") + start_time: int = FieldInfo(alias="startTime") + + trip_id: str = FieldInfo(alias="tripId") - trip_id: str = FieldInfo(alias = "tripId") class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule(BaseModel): - schedule_stop_times: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime] = FieldInfo(alias = "scheduleStopTimes") + schedule_stop_times: List[ + ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime + ] = FieldInfo(alias="scheduleStopTimes") + + trip_headsign: str = FieldInfo(alias="tripHeadsign") - trip_headsign: str = FieldInfo(alias = "tripHeadsign") + schedule_frequencies: Optional[ + List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency] + ] = FieldInfo(alias="scheduleFrequencies", default=None) - schedule_frequencies: Optional[List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency]] = FieldInfo(alias = "scheduleFrequencies", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule(BaseModel): - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") + + stop_route_direction_schedules: List[ + ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule + ] = FieldInfo(alias="stopRouteDirectionSchedules") - stop_route_direction_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule] = FieldInfo(alias = "stopRouteDirectionSchedules") class ScheduleForStopRetrieveResponseDataEntry(BaseModel): date: int - stop_id: str = FieldInfo(alias = "stopId") + stop_id: str = FieldInfo(alias="stopId") + + stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo( + alias="stopRouteSchedules" + ) - stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo(alias = "stopRouteSchedules") class ScheduleForStopRetrieveResponseData(BaseModel): entry: ScheduleForStopRetrieveResponseDataEntry references: References + class ScheduleForStopRetrieveResponse(ResponseWrapper): - data: ScheduleForStopRetrieveResponseData \ No newline at end of file + data: ScheduleForStopRetrieveResponseData diff --git a/src/onebusaway/types/search_for_route_list_params.py b/src/onebusaway/types/search_for_route_list_params.py index 885eb3e..76f767b 100755 --- a/src/onebusaway/types/search_for_route_list_params.py +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -8,9 +8,10 @@ __all__ = ["SearchForRouteListParams"] + class SearchForRouteListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" \ No newline at end of file + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py index 6d4b6d8..e54153a 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -10,10 +10,11 @@ __all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] + class SearchForRouteListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -21,24 +22,26 @@ class SearchForRouteListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias = "longName", default = None) + long_name: Optional[str] = FieldInfo(alias="longName", default=None) - null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) - short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) - text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) url: Optional[str] = None + class SearchForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[SearchForRouteListResponseDataList] - out_of_range: bool = FieldInfo(alias = "outOfRange") + out_of_range: bool = FieldInfo(alias="outOfRange") references: References + class SearchForRouteListResponse(ResponseWrapper): - data: Optional[SearchForRouteListResponseData] = None \ No newline at end of file + data: Optional[SearchForRouteListResponseData] = None diff --git a/src/onebusaway/types/search_for_stop_list_params.py b/src/onebusaway/types/search_for_stop_list_params.py index 42ba10a..012f802 100755 --- a/src/onebusaway/types/search_for_stop_list_params.py +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -8,9 +8,10 @@ __all__ = ["SearchForStopListParams"] + class SearchForStopListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" \ No newline at end of file + """The max number of results to return. Defaults to 20.""" diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 22d28a0..502455c 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -10,6 +10,7 @@ __all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] + class SearchForStopListResponseDataList(BaseModel): id: str @@ -21,26 +22,28 @@ class SearchForStopListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class SearchForStopListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[SearchForStopListResponseDataList] - out_of_range: bool = FieldInfo(alias = "outOfRange") + out_of_range: bool = FieldInfo(alias="outOfRange") references: References + class SearchForStopListResponse(ResponseWrapper): - data: Optional[SearchForStopListResponseData] = None \ No newline at end of file + data: Optional[SearchForStopListResponseData] = None diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py index e331899..07a3b6a 100644 --- a/src/onebusaway/types/shape_retrieve_response.py +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -8,6 +8,7 @@ __all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] + class ShapeRetrieveResponseDataEntry(BaseModel): length: int @@ -16,10 +17,12 @@ class ShapeRetrieveResponseDataEntry(BaseModel): levels: Optional[str] = None + class ShapeRetrieveResponseData(BaseModel): entry: ShapeRetrieveResponseDataEntry references: References + class ShapeRetrieveResponse(ResponseWrapper): - data: ShapeRetrieveResponseData \ No newline at end of file + data: ShapeRetrieveResponseData diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py index 5991736..1da019e 100644 --- a/src/onebusaway/types/shared/__init__.py +++ b/src/onebusaway/types/shared/__init__.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .references import References as References -from .response_wrapper import ResponseWrapper as ResponseWrapper \ No newline at end of file +from .response_wrapper import ResponseWrapper as ResponseWrapper diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 4eca75f..8c6deab 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -7,7 +7,25 @@ from ..._models import BaseModel -__all__ = ["References", "Agency", "Route", "Situation", "SituationActiveWindow", "SituationAllAffect", "SituationConsequence", "SituationConsequenceConditionDetails", "SituationConsequenceConditionDetailsDiversionPath", "SituationDescription", "SituationPublicationWindow", "SituationSummary", "SituationURL", "Stop", "StopTime", "Trip"] +__all__ = [ + "References", + "Agency", + "Route", + "Situation", + "SituationActiveWindow", + "SituationAllAffect", + "SituationConsequence", + "SituationConsequenceConditionDetails", + "SituationConsequenceConditionDetailsDiversionPath", + "SituationDescription", + "SituationPublicationWindow", + "SituationSummary", + "SituationURL", + "Stop", + "StopTime", + "Trip", +] + class Agency(BaseModel): id: str @@ -22,18 +40,19 @@ class Agency(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) + fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) + private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) + class Route(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -41,42 +60,45 @@ class Route(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias = "longName", default = None) + long_name: Optional[str] = FieldInfo(alias="longName", default=None) - null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) - short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) - text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) + text_color: Optional[str] = FieldInfo(alias="textColor", default=None) url: Optional[str] = None + class SituationActiveWindow(BaseModel): - from_: Optional[int] = FieldInfo(alias = "from", default = None) + from_: Optional[int] = FieldInfo(alias="from", default=None) """Start time of the active window as a Unix timestamp.""" to: Optional[int] = None """End time of the active window as a Unix timestamp.""" + class SituationAllAffect(BaseModel): - agency_id: Optional[str] = FieldInfo(alias = "agencyId", default = None) + agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) """Identifier for the agency.""" - application_id: Optional[str] = FieldInfo(alias = "applicationId", default = None) + application_id: Optional[str] = FieldInfo(alias="applicationId", default=None) """Identifier for the application.""" - direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) + direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) """Identifier for the direction.""" - route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) + route_id: Optional[str] = FieldInfo(alias="routeId", default=None) """Identifier for the route.""" - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) """Identifier for the stop.""" - trip_id: Optional[str] = FieldInfo(alias = "tripId", default = None) + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) """Identifier for the trip.""" + class SituationConsequenceConditionDetailsDiversionPath(BaseModel): length: Optional[int] = None """Length of the diversion path.""" @@ -87,16 +109,23 @@ class SituationConsequenceConditionDetailsDiversionPath(BaseModel): points: Optional[str] = None """Points of the diversion path.""" + class SituationConsequenceConditionDetails(BaseModel): - diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo(alias = "diversionPath", default = None) + diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo( + alias="diversionPath", default=None + ) + + diversion_stop_ids: Optional[List[str]] = FieldInfo(alias="diversionStopIds", default=None) - diversion_stop_ids: Optional[List[str]] = FieldInfo(alias = "diversionStopIds", default = None) class SituationConsequence(BaseModel): condition: Optional[str] = None """Condition of the consequence.""" - condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo(alias = "conditionDetails", default = None) + condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo( + alias="conditionDetails", default=None + ) + class SituationDescription(BaseModel): lang: Optional[str] = None @@ -105,13 +134,15 @@ class SituationDescription(BaseModel): value: Optional[str] = None """Longer description of the situation.""" + class SituationPublicationWindow(BaseModel): - from_: int = FieldInfo(alias = "from") + from_: int = FieldInfo(alias="from") """Start time of the time window as a Unix timestamp.""" to: int """End time of the time window as a Unix timestamp.""" + class SituationSummary(BaseModel): lang: Optional[str] = None """Language of the summary.""" @@ -119,6 +150,7 @@ class SituationSummary(BaseModel): value: Optional[str] = None """Short summary of the situation.""" + class SituationURL(BaseModel): lang: Optional[str] = None """Language of the URL.""" @@ -126,27 +158,32 @@ class SituationURL(BaseModel): value: Optional[str] = None """URL for more information about the situation.""" + class Situation(BaseModel): id: str """Unique identifier for the situation.""" - creation_time: int = FieldInfo(alias = "creationTime") + creation_time: int = FieldInfo(alias="creationTime") """Unix timestamp of when this situation was created.""" - active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias = "activeWindows", default = None) + active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias="activeWindows", default=None) - all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias = "allAffects", default = None) + all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias="allAffects", default=None) - consequence_message: Optional[str] = FieldInfo(alias = "consequenceMessage", default = None) + consequence_message: Optional[str] = FieldInfo(alias="consequenceMessage", default=None) """Message regarding the consequence of the situation.""" consequences: Optional[List[SituationConsequence]] = None description: Optional[SituationDescription] = None - publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo(alias = "publicationWindows", default = None) + publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo( + alias="publicationWindows", default=None + ) - reason: Optional[Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"]] = None + reason: Optional[ + Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"] + ] = None """Reason for the service alert, taken from TPEG codes.""" severity: Optional[str] = None @@ -156,6 +193,7 @@ class Situation(BaseModel): url: Optional[SituationURL] = None + class Stop(BaseModel): id: str @@ -167,53 +205,56 @@ class Stop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) - distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class Trip(BaseModel): id: str - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") + + service_id: str = FieldInfo(alias="serviceId") - service_id: str = FieldInfo(alias = "serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) - block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) + direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) - direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) + peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) - peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) + shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) - shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) - time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) + trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) - trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class References(BaseModel): agencies: List[Agency] @@ -224,6 +265,6 @@ class References(BaseModel): stops: List[Stop] - stop_times: List[StopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[StopTime] = FieldInfo(alias="stopTimes") - trips: List[Trip] \ No newline at end of file + trips: List[Trip] diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py index 77dae24..72ecc38 100644 --- a/src/onebusaway/types/shared/response_wrapper.py +++ b/src/onebusaway/types/shared/response_wrapper.py @@ -7,11 +7,12 @@ __all__ = ["ResponseWrapper"] + class ResponseWrapper(BaseModel): code: int - current_time: int = FieldInfo(alias = "currentTime") + current_time: int = FieldInfo(alias="currentTime") text: str - version: int \ No newline at end of file + version: int diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index bd9c2fe..3ae9947 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -10,12 +10,14 @@ __all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] + class StopIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[str] references: References + class StopIDsForAgencyListResponse(ResponseWrapper): - data: StopIDsForAgencyListResponseData \ No newline at end of file + data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 49c171b..6a69553 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -10,6 +10,7 @@ __all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] + class StopRetrieveResponseDataEntry(BaseModel): id: str @@ -21,22 +22,24 @@ class StopRetrieveResponseDataEntry(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopRetrieveResponseData(BaseModel): entry: StopRetrieveResponseDataEntry references: References + class StopRetrieveResponse(ResponseWrapper): - data: StopRetrieveResponseData \ No newline at end of file + data: StopRetrieveResponseData diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index 467880b..422c5ee 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -10,6 +10,7 @@ __all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] + class StopsForAgencyListResponseList(BaseModel): id: str @@ -21,23 +22,24 @@ class StopsForAgencyListResponseList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForAgencyListResponse(ResponseWrapper): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[StopsForAgencyListResponseList] references: References - out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) \ No newline at end of file + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py index 4b672c6..3174257 100644 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -8,6 +8,7 @@ __all__ = ["StopsForLocationListParams"] + class StopsForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -23,4 +24,4 @@ class StopsForLocationListParams(TypedDict, total=False): """A search query string to filter the results""" radius: float - """The radius in meters to search within""" \ No newline at end of file + """The radius in meters to search within""" diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index c2404b9..e075eb1 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -10,6 +10,7 @@ __all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] + class StopsForLocationListResponseDataList(BaseModel): id: str @@ -21,26 +22,28 @@ class StopsForLocationListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias = "routeIds") + route_ids: List[str] = FieldInfo(alias="routeIds") - static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + location_type: Optional[int] = FieldInfo(alias="locationType", default=None) + + wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[StopsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + class StopsForLocationListResponse(ResponseWrapper): - data: StopsForLocationListResponseData \ No newline at end of file + data: StopsForLocationListResponseData diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py index c55ae9d..ddf40d0 100644 --- a/src/onebusaway/types/stops_for_route_list_params.py +++ b/src/onebusaway/types/stops_for_route_list_params.py @@ -8,9 +8,10 @@ __all__ = ["StopsForRouteListParams"] + class StopsForRouteListParams(TypedDict, total=False): include_polylines: Annotated[bool, PropertyInfo(alias="includePolylines")] """Include polyline elements in the response (default true)""" time: str - """Specify service date (YYYY-MM-DD or epoch) (default today)""" \ No newline at end of file + """Specify service date (YYYY-MM-DD or epoch) (default today)""" diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 4528bac..53cff4e 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -8,7 +8,16 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopsForRouteListResponse", "StopsForRouteListResponseData", "StopsForRouteListResponseDataEntry", "StopsForRouteListResponseDataEntryPolyline", "StopsForRouteListResponseDataEntryStopGrouping", "StopsForRouteListResponseDataEntryStopGroupingName", "StopsForRouteListResponseDataEntryStopGroupingPolyline"] +__all__ = [ + "StopsForRouteListResponse", + "StopsForRouteListResponseData", + "StopsForRouteListResponseDataEntry", + "StopsForRouteListResponseDataEntryPolyline", + "StopsForRouteListResponseDataEntryStopGrouping", + "StopsForRouteListResponseDataEntryStopGroupingName", + "StopsForRouteListResponseDataEntryStopGroupingPolyline", +] + class StopsForRouteListResponseDataEntryPolyline(BaseModel): length: Optional[int] = None @@ -17,6 +26,7 @@ class StopsForRouteListResponseDataEntryPolyline(BaseModel): points: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): name: Optional[str] = None @@ -24,6 +34,7 @@ class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): type: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None @@ -31,6 +42,7 @@ class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): id: Optional[str] = None @@ -38,21 +50,26 @@ class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryStopGroupingPolyline]] = None - stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) + stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) + class StopsForRouteListResponseDataEntry(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryPolyline]] = None - route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) + route_id: Optional[str] = FieldInfo(alias="routeId", default=None) + + stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo( + alias="stopGroupings", default=None + ) - stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo(alias = "stopGroupings", default = None) + stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) - stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) class StopsForRouteListResponseData(BaseModel): entry: StopsForRouteListResponseDataEntry references: References + class StopsForRouteListResponse(ResponseWrapper): - data: StopsForRouteListResponseData \ No newline at end of file + data: StopsForRouteListResponseData diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py index 42a37db..a8529bf 100644 --- a/src/onebusaway/types/trip_detail_retrieve_params.py +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -8,6 +8,7 @@ __all__ = ["TripDetailRetrieveParams"] + class TripDetailRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -31,4 +32,4 @@ class TripDetailRetrieveParams(TypedDict, total=False): """Service date for the trip as Unix time in milliseconds (optional).""" time: int - """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file + """Time parameter to query the system at a specific time (optional).""" diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 99d8166..4b76689 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -8,32 +8,44 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["TripDetailRetrieveResponse", "TripDetailRetrieveResponseData", "TripDetailRetrieveResponseDataEntry", "TripDetailRetrieveResponseDataEntrySchedule", "TripDetailRetrieveResponseDataEntryScheduleStopTime", "TripDetailRetrieveResponseDataEntryStatus", "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", "TripDetailRetrieveResponseDataEntryStatusPosition"] +__all__ = [ + "TripDetailRetrieveResponse", + "TripDetailRetrieveResponseData", + "TripDetailRetrieveResponseDataEntry", + "TripDetailRetrieveResponseDataEntrySchedule", + "TripDetailRetrieveResponseDataEntryScheduleStopTime", + "TripDetailRetrieveResponseDataEntryStatus", + "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", + "TripDetailRetrieveResponseDataEntryStatusPosition", +] + class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) - departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias = "nextTripId") + next_trip_id: str = FieldInfo(alias="nextTripId") - previous_trip_id: str = FieldInfo(alias = "previousTripId") + previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - time_zone: str = FieldInfo(alias = "timeZone") + time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None + class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -41,6 +53,7 @@ class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -48,38 +61,39 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -88,10 +102,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -100,10 +114,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -112,16 +126,18 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -133,35 +149,38 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripDetailRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class TripDetailRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None + class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry references: References + class TripDetailRetrieveResponse(ResponseWrapper): - data: TripDetailRetrieveResponseData \ No newline at end of file + data: TripDetailRetrieveResponseData diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py index 7cf1876..3e8240c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -8,6 +8,7 @@ __all__ = ["TripForVehicleRetrieveParams"] + class TripForVehicleRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -29,4 +30,4 @@ class TripForVehicleRetrieveParams(TypedDict, total=False): """ time: int - """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file + """Time parameter to query the system at a specific time (optional).""" diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index cecc593..136b96c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -8,32 +8,44 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["TripForVehicleRetrieveResponse", "TripForVehicleRetrieveResponseData", "TripForVehicleRetrieveResponseDataEntry", "TripForVehicleRetrieveResponseDataEntrySchedule", "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", "TripForVehicleRetrieveResponseDataEntryStatus", "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", "TripForVehicleRetrieveResponseDataEntryStatusPosition"] +__all__ = [ + "TripForVehicleRetrieveResponse", + "TripForVehicleRetrieveResponseData", + "TripForVehicleRetrieveResponseDataEntry", + "TripForVehicleRetrieveResponseDataEntrySchedule", + "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", + "TripForVehicleRetrieveResponseDataEntryStatus", + "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", + "TripForVehicleRetrieveResponseDataEntryStatusPosition", +] + class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) - departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias = "nextTripId") + next_trip_id: str = FieldInfo(alias="nextTripId") - previous_trip_id: str = FieldInfo(alias = "previousTripId") + previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - time_zone: str = FieldInfo(alias = "timeZone") + time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None + class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -41,6 +53,7 @@ class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -48,38 +61,39 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -88,10 +102,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -100,10 +114,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -112,16 +126,18 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -133,35 +149,38 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class TripForVehicleRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None + class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry references: References + class TripForVehicleRetrieveResponse(ResponseWrapper): - data: TripForVehicleRetrieveResponseData \ No newline at end of file + data: TripForVehicleRetrieveResponseData diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 7c3c1bc..152bfa2 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -10,33 +10,36 @@ __all__ = ["TripRetrieveResponse", "TripRetrieveResponseData", "TripRetrieveResponseDataEntry"] + class TripRetrieveResponseDataEntry(BaseModel): id: str - route_id: str = FieldInfo(alias = "routeId") + route_id: str = FieldInfo(alias="routeId") + + service_id: str = FieldInfo(alias="serviceId") - service_id: str = FieldInfo(alias = "serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) - block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) + direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) - direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) + peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) - peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) + shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) - shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) - time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) + trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) - trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class TripRetrieveResponseData(BaseModel): entry: TripRetrieveResponseDataEntry references: References + class TripRetrieveResponse(ResponseWrapper): - data: TripRetrieveResponseData \ No newline at end of file + data: TripRetrieveResponseData diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py index 5c50ae9..69a9186 100644 --- a/src/onebusaway/types/trips_for_location_list_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -8,6 +8,7 @@ __all__ = ["TripsForLocationListParams"] + class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] """The latitude coordinate of the search center""" @@ -34,4 +35,4 @@ class TripsForLocationListParams(TypedDict, total=False): """ time: int - """Specific time for the query. Defaults to the current time.""" \ No newline at end of file + """Specific time for the query. Defaults to the current time.""" diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 01b2233..68ae881 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -8,32 +8,44 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["TripsForLocationListResponse", "TripsForLocationListResponseData", "TripsForLocationListResponseDataList", "TripsForLocationListResponseDataListSchedule", "TripsForLocationListResponseDataListScheduleStopTime", "TripsForLocationListResponseDataListStatus", "TripsForLocationListResponseDataListStatusLastKnownLocation", "TripsForLocationListResponseDataListStatusPosition"] +__all__ = [ + "TripsForLocationListResponse", + "TripsForLocationListResponseData", + "TripsForLocationListResponseDataList", + "TripsForLocationListResponseDataListSchedule", + "TripsForLocationListResponseDataListScheduleStopTime", + "TripsForLocationListResponseDataListStatus", + "TripsForLocationListResponseDataListStatusLastKnownLocation", + "TripsForLocationListResponseDataListStatusPosition", +] + class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) - departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForLocationListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias = "nextTripId") + next_trip_id: str = FieldInfo(alias="nextTripId") - previous_trip_id: str = FieldInfo(alias = "previousTripId") + previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - time_zone: str = FieldInfo(alias = "timeZone") + time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None + class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -41,6 +53,7 @@ class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class TripsForLocationListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -48,38 +61,39 @@ class TripsForLocationListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class TripsForLocationListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -88,10 +102,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -100,10 +114,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -112,16 +126,18 @@ class TripsForLocationListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -133,41 +149,44 @@ class TripsForLocationListResponseDataListStatus(BaseModel): position: Optional[TripsForLocationListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class TripsForLocationListResponseDataList(BaseModel): schedule: TripsForLocationListResponseDataListSchedule status: TripsForLocationListResponseDataListStatus - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") """Indicates if the limit of trips has been exceeded""" list: List[TripsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) """Indicates if the search location is out of range""" + class TripsForLocationListResponse(ResponseWrapper): - data: TripsForLocationListResponseData \ No newline at end of file + data: TripsForLocationListResponseData diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py index e1dbb72..c2f7ec0 100644 --- a/src/onebusaway/types/trips_for_route_list_params.py +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -8,6 +8,7 @@ __all__ = ["TripsForRouteListParams"] + class TripsForRouteListParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """Determine whether full schedule elements are included. Defaults to false.""" @@ -19,4 +20,4 @@ class TripsForRouteListParams(TypedDict, total=False): """ time: int - """Query the system at a specific time. Useful for testing.""" \ No newline at end of file + """Query the system at a specific time. Useful for testing.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index 3e33f85..f9bc2d8 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -8,32 +8,44 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["TripsForRouteListResponse", "TripsForRouteListResponseData", "TripsForRouteListResponseDataList", "TripsForRouteListResponseDataListSchedule", "TripsForRouteListResponseDataListScheduleStopTime", "TripsForRouteListResponseDataListStatus", "TripsForRouteListResponseDataListStatusLastKnownLocation", "TripsForRouteListResponseDataListStatusPosition"] +__all__ = [ + "TripsForRouteListResponse", + "TripsForRouteListResponseData", + "TripsForRouteListResponseDataList", + "TripsForRouteListResponseDataListSchedule", + "TripsForRouteListResponseDataListScheduleStopTime", + "TripsForRouteListResponseDataListStatus", + "TripsForRouteListResponseDataListStatusLastKnownLocation", + "TripsForRouteListResponseDataListStatusPosition", +] + class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) - departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) - historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForRouteListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias = "nextTripId") + next_trip_id: str = FieldInfo(alias="nextTripId") - previous_trip_id: str = FieldInfo(alias = "previousTripId") + previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - time_zone: str = FieldInfo(alias = "timeZone") + time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None + class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -41,6 +53,7 @@ class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class TripsForRouteListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -48,38 +61,39 @@ class TripsForRouteListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class TripsForRouteListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -88,10 +102,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -100,10 +114,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -112,16 +126,18 @@ class TripsForRouteListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -133,37 +149,40 @@ class TripsForRouteListResponseDataListStatus(BaseModel): position: Optional[TripsForRouteListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class TripsForRouteListResponseDataList(BaseModel): schedule: TripsForRouteListResponseDataListSchedule status: TripsForRouteListResponseDataListStatus - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[TripsForRouteListResponseDataList] references: References + class TripsForRouteListResponse(ResponseWrapper): - data: TripsForRouteListResponseData \ No newline at end of file + data: TripsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py index 808fd7a..ebf92d1 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_params.py +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -6,6 +6,7 @@ __all__ = ["VehiclesForAgencyListParams"] + class VehiclesForAgencyListParams(TypedDict, total=False): time: str - """Specific time for querying the status (timestamp format)""" \ No newline at end of file + """Specific time for querying the status (timestamp format)""" diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 05d11de..34601dd 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -8,13 +8,23 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["VehiclesForAgencyListResponse", "VehiclesForAgencyListResponseData", "VehiclesForAgencyListResponseDataList", "VehiclesForAgencyListResponseDataListLocation", "VehiclesForAgencyListResponseDataListTripStatus", "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", "VehiclesForAgencyListResponseDataListTripStatusPosition"] +__all__ = [ + "VehiclesForAgencyListResponse", + "VehiclesForAgencyListResponseData", + "VehiclesForAgencyListResponseDataList", + "VehiclesForAgencyListResponseDataListLocation", + "VehiclesForAgencyListResponseDataListTripStatus", + "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", + "VehiclesForAgencyListResponseDataListTripStatusPosition", +] + class VehiclesForAgencyListResponseDataListLocation(BaseModel): lat: Optional[float] = None lon: Optional[float] = None + class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -22,6 +32,7 @@ class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" + class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -29,38 +40,39 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" + class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias = "activeTripId") + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias = "closestStop") + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias = "occupancyCount") + occupancy_count: int = FieldInfo(alias="occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias = "occupancyStatus") + occupancy_status: str = FieldInfo(alias="occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -69,10 +81,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias = "serviceDate") + service_date: int = FieldInfo(alias="serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -81,10 +93,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -93,16 +105,18 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) + last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -114,47 +128,50 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): position: Optional[VehiclesForAgencyListResponseDataListTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" + class VehiclesForAgencyListResponseDataList(BaseModel): - last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") - last_update_time: int = FieldInfo(alias = "lastUpdateTime") + last_update_time: int = FieldInfo(alias="lastUpdateTime") location: VehiclesForAgencyListResponseDataListLocation - trip_id: str = FieldInfo(alias = "tripId") + trip_id: str = FieldInfo(alias="tripId") - trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias = "tripStatus") + trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias="tripStatus") - vehicle_id: str = FieldInfo(alias = "vehicleId") + vehicle_id: str = FieldInfo(alias="vehicleId") - occupancy_capacity: Optional[int] = FieldInfo(alias = "occupancyCapacity", default = None) + occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - occupancy_count: Optional[int] = FieldInfo(alias = "occupancyCount", default = None) + occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) phase: Optional[str] = None status: Optional[str] = None + class VehiclesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias = "limitExceeded") + limit_exceeded: bool = FieldInfo(alias="limitExceeded") list: List[VehiclesForAgencyListResponseDataList] references: References + class VehiclesForAgencyListResponse(ResponseWrapper): - data: VehiclesForAgencyListResponseData \ No newline at end of file + data: VehiclesForAgencyListResponseData diff --git a/tests/__init__.py b/tests/__init__.py index bd67c17..fd8019a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py index bd67c17..fd8019a 100644 --- a/tests/api_resources/__init__.py +++ b/tests/api_resources/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py index 31c169e..fad1087 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -13,61 +13,60 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: agencies_with_coverage = client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.list() as response : + with client.agencies_with_coverage.with_streaming_response.list() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: agencies_with_coverage = await async_client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.list() as response : + async with async_client.agencies_with_coverage.with_streaming_response.list() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index a991b01..05b83a8 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: agency = client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.agency.with_streaming_response.retrieve( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.agency.with_raw_response.retrieve( - "", - ) -class TestAsyncAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.agency.with_raw_response.retrieve( + "", + ) +class TestAsyncAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: agency = await async_client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.agency.with_streaming_response.retrieve( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) + assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.agency.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.agency.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index 6af856f..0ba8109 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -17,9 +17,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestArrivalAndDeparture: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestArrivalAndDeparture: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: @@ -28,7 +28,7 @@ def test_method_retrieve(self, client: OnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -40,11 +40,10 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -52,9 +51,9 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: @@ -62,30 +61,30 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -95,43 +94,43 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) -class TestAsyncArrivalAndDeparture: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) +class TestAsyncArrivalAndDeparture: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.retrieve( @@ -139,7 +138,7 @@ async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -151,11 +150,10 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -163,9 +161,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: @@ -173,30 +171,30 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + await async_client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -206,36 +204,35 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) \ No newline at end of file + await async_client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py index 51df2aa..a07a29b 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestBlock: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestBlock: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: block = client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.block.with_streaming_response.retrieve( "blockID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - client.block.with_raw_response.retrieve( - "", - ) -class TestAsyncBlock: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.block.with_raw_response.retrieve( + "", + ) +class TestAsyncBlock: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: block = await async_client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.block.with_streaming_response.retrieve( "blockID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=['response']) + assert_matches_type(BlockRetrieveResponse, block, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - await async_client.block.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.block.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py index c69064e..62bdd91 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -13,61 +13,60 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestConfig: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestConfig: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: config = client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.config.with_streaming_response.retrieve() as response : + with client.config.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncConfig: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncConfig: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: config = await async_client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.config.with_streaming_response.retrieve() as response : + async with async_client.config.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=['response']) + assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py index ff80f9e..1a05528 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -13,61 +13,60 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestCurrentTime: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestCurrentTime: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: current_time = client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.current_time.with_streaming_response.retrieve() as response : + with client.current_time.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncCurrentTime: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncCurrentTime: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: current_time = await async_client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.current_time.with_streaming_response.retrieve() as response : + async with async_client.current_time.with_streaming_response.retrieve() as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py index 4233004..0b15883 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestReportProblemWithStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestReportProblemWithStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_stop = client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +34,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) -class TestAsyncReportProblemWithStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) +class TestAsyncReportProblemWithStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,36 +88,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) \ No newline at end of file + await async_client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index c92d0cf..0bc9cf2 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestReportProblemWithTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestReportProblemWithTrip: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_trip = client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -39,49 +39,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) -class TestAsyncReportProblemWithTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) +class TestAsyncReportProblemWithTrip: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_trip = await async_client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -98,36 +98,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) \ No newline at end of file + await async_client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index b046f5b..8b773cf 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: route = client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.route.with_streaming_response.retrieve( "routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.route.with_raw_response.retrieve( - "", - ) -class TestAsyncRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.route.with_raw_response.retrieve( + "", + ) +class TestAsyncRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: route = await async_client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route.with_streaming_response.retrieve( "routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=['response']) + assert_matches_type(RouteRetrieveResponse, route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.route.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.route.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py index 586c885..867c19a 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestRouteIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestRouteIDsForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: route_ids_for_agency = client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.route_ids_for_agency.with_raw_response.list( - "", - ) -class TestAsyncRouteIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.route_ids_for_agency.with_raw_response.list( + "", + ) +class TestAsyncRouteIDsForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: route_ids_for_agency = await async_client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.route_ids_for_agency.with_raw_response.list( - "", - ) \ No newline at end of file + await async_client.route_ids_for_agency.with_raw_response.list( + "", + ) diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 3c5e3d1..1fe2d56 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestRoutesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestRoutesForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: routes_for_agency = client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.routes_for_agency.with_raw_response.list( - "", - ) -class TestAsyncRoutesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.routes_for_agency.with_raw_response.list( + "", + ) +class TestAsyncRoutesForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: routes_for_agency = await async_client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.routes_for_agency.with_raw_response.list( - "", - ) \ No newline at end of file + await async_client.routes_for_agency.with_raw_response.list( + "", + ) diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 76683a4..55fbc31 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestRoutesForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestRoutesForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +23,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,45 +35,45 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncRoutesForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncRoutesForLocation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,31 +85,30 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index 2fee578..6973a7e 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -14,16 +14,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestScheduleForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestScheduleForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_route = client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) -class TestAsyncScheduleForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) +class TestAsyncScheduleForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_route = await async_client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,36 +81,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) \ No newline at end of file + await async_client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py index beb7aea..0154e44 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -14,16 +14,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestScheduleForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestScheduleForStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_stop = client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) -class TestAsyncScheduleForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) +class TestAsyncScheduleForStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_stop = await async_client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,36 +81,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) \ No newline at end of file + await async_client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index 0726471..76114f6 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestSearchForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestSearchForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_route = client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +30,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_route.with_streaming_response.list( input="input", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncSearchForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncSearchForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_route = await async_client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,29 +73,28 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_route.with_streaming_response.list( input="input", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index 8ff8b57..bed17ea 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestSearchForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestSearchForStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_stop = client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +30,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_stop.with_streaming_response.list( input="input", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncSearchForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncSearchForStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_stop = await async_client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,29 +73,28 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_stop.with_streaming_response.list( input="input", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py index adfbf9f..369da7d 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestShape: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestShape: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: shape = client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.shape.with_streaming_response.retrieve( "shapeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - client.shape.with_raw_response.retrieve( - "", - ) -class TestAsyncShape: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.shape.with_raw_response.retrieve( + "", + ) +class TestAsyncShape: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: shape = await async_client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.shape.with_streaming_response.retrieve( "shapeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) + assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - await async_client.shape.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.shape.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py index dc113e5..9286176 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestStop: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: stop = client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.stop.with_streaming_response.retrieve( "stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.stop.with_raw_response.retrieve( - "", - ) -class TestAsyncStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.stop.with_raw_response.retrieve( + "", + ) +class TestAsyncStop: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: stop = await async_client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop.with_streaming_response.retrieve( "stopID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=['response']) + assert_matches_type(StopRetrieveResponse, stop, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.stop.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.stop.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py index 9a060b7..923a743 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestStopIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestStopIDsForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stop_ids_for_agency = client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stop_ids_for_agency.with_raw_response.list( - "", - ) -class TestAsyncStopIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.stop_ids_for_agency.with_raw_response.list( + "", + ) +class TestAsyncStopIDsForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stop_ids_for_agency = await async_client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stop_ids_for_agency.with_raw_response.list( - "", - ) \ No newline at end of file + await async_client.stop_ids_for_agency.with_raw_response.list( + "", + ) diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py index ce3acaf..7c6538e 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestStopsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestStopsForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_agency = client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stops_for_agency.with_raw_response.list( - "", - ) -class TestAsyncStopsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.stops_for_agency.with_raw_response.list( + "", + ) +class TestAsyncStopsForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_agency = await async_client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stops_for_agency.with_raw_response.list( - "", - ) \ No newline at end of file + await async_client.stops_for_agency.with_raw_response.list( + "", + ) diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index 91440a5..fcb2f07 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestStopsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestStopsForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +23,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,45 +35,45 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncStopsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncStopsForLocation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,31 +85,30 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py index c2381e7..e062f7d 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestStopsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestStopsForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_route = client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.stops_for_route.with_raw_response.list( - route_id="", - ) -class TestAsyncStopsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.stops_for_route.with_raw_response.list( + route_id="", + ) +class TestAsyncStopsForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_route = await async_client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -82,36 +82,35 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.stops_for_route.with_raw_response.list( - route_id="", - ) \ No newline at end of file + await async_client.stops_for_route.with_raw_response.list( + route_id="", + ) diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index c7eeb0e..ef2bd7f 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -13,87 +13,86 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestTrip: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip = client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip.with_streaming_response.retrieve( "tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip.with_raw_response.retrieve( - "", - ) -class TestAsyncTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.trip.with_raw_response.retrieve( + "", + ) +class TestAsyncTrip: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip = await async_client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip.with_streaming_response.retrieve( "tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=['response']) + assert_matches_type(TripRetrieveResponse, trip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip.with_raw_response.retrieve( - "", - ) \ No newline at end of file + await async_client.trip.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py index 41a8789..82d00d9 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestTripDetails: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestTripDetails: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_detail = client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +34,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip_details.with_raw_response.retrieve( - trip_id="", - ) -class TestAsyncTripDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.trip_details.with_raw_response.retrieve( + trip_id="", + ) +class TestAsyncTripDetails: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_detail = await async_client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,36 +88,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip_details.with_raw_response.retrieve( - trip_id="", - ) \ No newline at end of file + await async_client.trip_details.with_raw_response.retrieve( + trip_id="", + ) diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py index c574a5b..be96fa6 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestTripForVehicle: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestTripForVehicle: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_for_vehicle = client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -33,49 +33,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) -class TestAsyncTripForVehicle: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) +class TestAsyncTripForVehicle: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_for_vehicle = await async_client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -86,36 +86,35 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - await async_client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) \ No newline at end of file + await async_client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 75fc984..050d552 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestTripsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestTripsForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -25,7 +25,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -38,11 +38,10 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -51,9 +50,9 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: @@ -62,18 +61,19 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: lat_span=0, lon=0, lon_span=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncTripsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestAsyncTripsForLocation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: trips_for_location = await async_client.trips_for_location.list( @@ -82,7 +82,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -95,11 +95,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -108,9 +107,9 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -119,11 +118,11 @@ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) - lat_span=0, lon=0, lon_span=0, - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) - assert cast(Any, response.is_closed) is True \ No newline at end of file + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py index ce2af07..0ef4092 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestTripsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestTripsForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: trips_for_route = client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -32,49 +32,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.trips_for_route.with_raw_response.list( - route_id="", - ) -class TestAsyncTripsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.trips_for_route.with_raw_response.list( + route_id="", + ) +class TestAsyncTripsForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: trips_for_route = await async_client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -84,36 +84,35 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.trips_for_route.with_raw_response.list( - route_id="", - ) \ No newline at end of file + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py index 078450d..5f201f2 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestVehiclesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) +class TestVehiclesForAgency: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: vehicles_for_agency = client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,49 +30,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) -class TestAsyncVehiclesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) +class TestAsyncVehiclesForAgency: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: vehicles_for_agency = await async_client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -80,36 +80,35 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response : + ) as response: assert not response.is_closed - assert response.http_request.headers.get('X-Stainless-Lang') == 'python' + assert response.http_request.headers.get("X-Stainless-Lang") == "python" vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) \ No newline at end of file + await async_client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) diff --git a/tests/conftest.py b/tests/conftest.py index cdab733..d166173 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") @@ -30,20 +30,22 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: api_key = "My API Key" + @pytest.fixture(scope="session") def client(request: FixtureRequest) -> Iterator[OnebusawaySDK]: - strict = getattr(request, 'param', True) + strict = getattr(request, "param", True) if not isinstance(strict, bool): - raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') + raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : + with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: yield client + @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOnebusawaySDK]: - strict = getattr(request, 'param', True) + strict = getattr(request, "param", True) if not isinstance(strict, bool): - raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') + raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : + async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: yield client diff --git a/tests/test_client.py b/tests/test_client.py index 0d603b3..e95582b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -39,14 +39,17 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" + def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]: - request = client._build_request(FinalRequestOptions(method="get", url='/foo')) - url = httpx.URL(request.url) - return dict(url.params) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + return dict(url.params) + def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 + def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -54,6 +57,7 @@ def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: pool = transport._pool return len(pool._requests) + class TestOnebusawaySDK: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -68,7 +72,9 @@ def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) response = self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -100,58 +106,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "bar" - }) - assert client.default_headers['X-Foo'] == 'bar' + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + assert client.default_headers["X-Foo"] == "bar" # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers["X-Foo"] == "bar" # merges already given headers - copied = client.copy(default_headers={'X-Bar': 'stainless'}) - assert copied.default_headers['X-Foo'] == 'bar' - assert copied.default_headers['X-Bar'] == 'stainless' + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" # uses new values for any already given headers - copied = client.copy(default_headers={'X-Foo': 'stainless'}) - assert copied.default_headers['X-Foo'] == 'stainless' + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get('X-Foo') is None + assert copied.default_headers.get("X-Foo") is None - copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) - assert copied.default_headers['X-Bar'] == 'Robert' + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" with pytest.raises( - ValueError, - match='`default_headers` and `set_default_headers` arguments are mutually exclusive', + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): - client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) def test_copy_default_query(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ - "foo": "bar" - }) - assert _get_params(client)['foo'] == 'bar' + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} + ) + assert _get_params(client)["foo"] == "bar" # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)['foo'] == 'bar' + assert _get_params(copied)["foo"] == "bar" # merges already given params - copied = client.copy(default_query={'bar': 'stainless'}) + copied = client.copy(default_query={"bar": "stainless"}) params = _get_params(copied) - assert params['foo'] == 'bar' - assert params['bar'] == 'stainless' + assert params["foo"] == "bar" + assert params["bar"] == "stainless" # uses new values for any already given headers - copied = client.copy(default_query={'foo': 'stainless'}) - assert _get_params(copied)['foo'] == 'stainless' + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" # set_default_query @@ -159,21 +165,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={'bar': 'Robert'}) - assert _get_params(copied)['bar'] == 'Robert' + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" with pytest.raises( - ValueError, - # TODO: update - match='`default_query` and `set_default_query` arguments are mutually exclusive', + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", ): - client.copy(set_default_query={}, default_query={'foo': 'Bar', "key": api_key}) + client.copy(set_default_query={}, default_query={"foo": "Bar", "key": api_key}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -259,7 +265,9 @@ def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) def test_client_timeout_option(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) + ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -268,54 +276,70 @@ def test_client_timeout_option(self) -> None: def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default async def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match='Invalid `http_client` arg') : - async with httpx.AsyncClient() as http_client : - OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + async with httpx.AsyncClient() as http_client: + OnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) def test_default_headers_option(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "bar" - }) - request = client._build_request(FinalRequestOptions(method="get", url='/foo')) - assert request.headers.get('x-foo') == 'bar' - assert request.headers.get('x-stainless-lang') == 'python' - - client2 = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }) - request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) - assert request.headers.get('x-foo') == 'stainless' - assert request.headers.get('x-stainless-lang') == 'my-overriding-header' + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = OnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" def test_default_query_option(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ - "query_param": "bar" - }) - request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + client = OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) url = httpx.URL(request.url) assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -327,7 +351,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -410,7 +434,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'bar': '1', 'foo': '2', "key": api_key} + assert params == {"bar": "1", "foo": "2", "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -424,7 +448,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'foo': '2', "key": api_key} + assert params == {"foo": "2", "key": api_key} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -463,27 +487,29 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == 'bar' + assert response.foo == "bar" + @pytest.mark.respx(base_url=base_url) def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" + class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == 'bar' + assert response.foo == "bar" - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -494,6 +520,7 @@ def test_non_application_json_content_type_for_json_data(self, respx_mock: MockR """ Response that sets Content-Type to something other than application/json but returns json data """ + class Model(BaseModel): foo: int @@ -510,7 +537,9 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = OnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + client = OnebusawaySDK( + base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True + ) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -518,11 +547,25 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): - client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == 'http://localhost:5000/from/env/' + with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): + client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" - @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -534,7 +577,21 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -546,7 +603,21 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + OnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) def test_absolute_request_url(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -572,9 +643,9 @@ def test_copied_client_does_not_close_http(self) -> None: def test_client_context_manager(self) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -591,7 +662,9 @@ class Model(BaseModel): def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) + OnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) + ) @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: @@ -603,7 +676,7 @@ class Model(BaseModel): strict_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - strict_client.get("/foo", cast_to=Model) + strict_client.get("/foo", cast_to=Model) client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -611,26 +684,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [ 3, "20", 20 ], - [ 3, "0", 0.5 ], - [ 3, "-10", 0.5 ], - [ 3, "60", 60 ], - [ 3, "61", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], - [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], - [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], - [ 3, "99999999999999999999999999999999999", 0.5 ], - [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], - [ 3, "", 0.5 ], - [ 2, "", 0.5 * 2.0 ], - [ 1, "", 0.5 * 4.0 ], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -638,7 +711,7 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -646,7 +719,11 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) + self.client.get( + "/api/where/current-time.json", + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) assert _get_open_connections(self.client) == 0 @@ -656,7 +733,11 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) + self.client.get( + "/api/where/current-time.json", + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) assert _get_open_connections(self.client) == 0 @@ -669,7 +750,7 @@ def test_retries_taken( client: OnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter + respx_mock: MockRouter, ) -> None: client = client.with_options(max_retries=4) @@ -680,7 +761,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -695,10 +776,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_omit_retry_count_header( - self, - client: OnebusawaySDK, - failures_before_success: int, - respx_mock: MockRouter + self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -713,18 +791,15 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) + response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": Omit()}) - assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_overwrite_retry_count_header( - self, - client: OnebusawaySDK, - failures_before_success: int, - respx_mock: MockRouter + self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -739,9 +814,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) + response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + - assert response.http_request.headers.get('x-stainless-retry-count') == '42' class TestAsyncOnebusawaySDK: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -758,7 +835,9 @@ async def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) response = await self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -790,58 +869,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "bar" - }) - assert client.default_headers['X-Foo'] == 'bar' + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + assert client.default_headers["X-Foo"] == "bar" # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers["X-Foo"] == "bar" # merges already given headers - copied = client.copy(default_headers={'X-Bar': 'stainless'}) - assert copied.default_headers['X-Foo'] == 'bar' - assert copied.default_headers['X-Bar'] == 'stainless' + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" # uses new values for any already given headers - copied = client.copy(default_headers={'X-Foo': 'stainless'}) - assert copied.default_headers['X-Foo'] == 'stainless' + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get('X-Foo') is None + assert copied.default_headers.get("X-Foo") is None - copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) - assert copied.default_headers['X-Bar'] == 'Robert' + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" with pytest.raises( - ValueError, - match='`default_headers` and `set_default_headers` arguments are mutually exclusive', + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): - client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) def test_copy_default_query(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ - "foo": "bar" - }) - assert _get_params(client)['foo'] == 'bar' + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} + ) + assert _get_params(client)["foo"] == "bar" # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)['foo'] == 'bar' + assert _get_params(copied)["foo"] == "bar" # merges already given params - copied = client.copy(default_query={'bar': 'stainless'}) + copied = client.copy(default_query={"bar": "stainless"}) params = _get_params(copied) - assert params['foo'] == 'bar' - assert params['bar'] == 'stainless' + assert params["foo"] == "bar" + assert params["bar"] == "stainless" # uses new values for any already given headers - copied = client.copy(default_query={'foo': 'stainless'}) - assert _get_params(copied)['foo'] == 'stainless' + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" # set_default_query @@ -849,21 +928,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={'bar': 'Robert'}) - assert _get_params(copied)['bar'] == 'Robert' + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" with pytest.raises( - ValueError, - # TODO: update - match='`default_query` and `set_default_query` arguments are mutually exclusive', + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", ): - client.copy(set_default_query={}, default_query={'foo': 'Bar'}) + client.copy(set_default_query={}, default_query={"foo": "Bar"}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -948,7 +1027,9 @@ async def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) async def test_client_timeout_option(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) + ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -957,54 +1038,70 @@ async def test_client_timeout_option(self) -> None: async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match='Invalid `http_client` arg') : - with httpx.Client() as http_client : - AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + with httpx.Client() as http_client: + AsyncOnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) def test_default_headers_option(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "bar" - }) - request = client._build_request(FinalRequestOptions(method="get", url='/foo')) - assert request.headers.get('x-foo') == 'bar' - assert request.headers.get('x-stainless-lang') == 'python' - - client2 = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }) - request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) - assert request.headers.get('x-foo') == 'stainless' - assert request.headers.get('x-stainless-lang') == 'my-overriding-header' + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = AsyncOnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" def test_default_query_option(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ - "query_param": "bar" - }) - request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + client = AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) url = httpx.URL(request.url) # Include the 'key' in the expected params assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -1017,7 +1114,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1100,7 +1197,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'bar': '1', 'foo': '2', "key": api_key} + assert params == {"bar": "1", "foo": "2", "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( FinalRequestOptions( @@ -1113,7 +1210,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'foo': '2', "key": api_key} + assert params == {"foo": "2", "key": api_key} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1152,27 +1249,29 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == 'bar' + assert response.foo == "bar" + @pytest.mark.respx(base_url=base_url) async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" + class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == 'bar' + assert response.foo == "bar" - respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -1183,6 +1282,7 @@ async def test_non_application_json_content_type_for_json_data(self, respx_mock: """ Response that sets Content-Type to something other than application/json but returns json data """ + class Model(BaseModel): foo: int @@ -1199,7 +1299,9 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = AsyncOnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + client = AsyncOnebusawaySDK( + base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True + ) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -1207,11 +1309,25 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): - client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == 'http://localhost:5000/from/env/' + with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): + client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" - @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1223,7 +1339,21 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: excepted_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == excepted_url - @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1236,7 +1366,21 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) + @pytest.mark.parametrize( + "client", + [ + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncOnebusawaySDK( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1263,9 +1407,9 @@ async def test_copied_client_does_not_close_http(self) -> None: async def test_client_context_manager(self) -> None: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -1283,7 +1427,9 @@ class Model(BaseModel): async def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) + AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) + ) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio @@ -1296,7 +1442,7 @@ class Model(BaseModel): strict_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - await strict_client.get("/foo", cast_to=Model) + await strict_client.get("/foo", cast_to=Model) client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -1304,26 +1450,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [ 3, "20", 20 ], - [ 3, "0", 0.5 ], - [ 3, "-10", 0.5 ], - [ 3, "60", 60 ], - [ 3, "61", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], - [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], - [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], - [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], - [ 3, "99999999999999999999999999999999999", 0.5 ], - [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], - [ 3, "", 0.5 ], - [ 2, "", 0.5 * 2.0 ], - [ 1, "", 0.5 * 4.0 ], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @pytest.mark.asyncio async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: @@ -1332,7 +1478,7 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1340,7 +1486,11 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) + await self.client.get( + "/api/where/current-time.json", + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) assert _get_open_connections(self.client) == 0 @@ -1350,7 +1500,11 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) + await self.client.get( + "/api/where/current-time.json", + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) assert _get_open_connections(self.client) == 0 @@ -1364,7 +1518,7 @@ async def test_retries_taken( async_client: AsyncOnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter + respx_mock: MockRouter, ) -> None: client = async_client.with_options(max_retries=4) @@ -1375,7 +1529,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -1391,10 +1545,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_omit_retry_count_header( - self, - async_client: AsyncOnebusawaySDK, - failures_before_success: int, - respx_mock: MockRouter + self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1409,19 +1560,18 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) + response = await client.current_time.with_raw_response.retrieve( + extra_headers={"x-stainless-retry-count": Omit()} + ) - assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_overwrite_retry_count_header( - self, - async_client: AsyncOnebusawaySDK, - failures_before_success: int, - respx_mock: MockRouter + self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1436,9 +1586,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) + response = await client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) - assert response.http_request.headers.get('x-stainless-retry-count') == '42' + assert response.http_request.headers.get("x-stainless-retry-count") == "42" def test_get_platform(self) -> None: # A previous implementation of asyncify could leave threads unterminated when @@ -1474,17 +1624,13 @@ async def test_main() -> None: return_code = process.poll() if return_code is not None: if return_code != 0: - raise AssertionError( - "calling get_platform using asyncify resulted in a non-zero exit code" - ) + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") # success break if time.monotonic() - start_time > timeout: process.kill() - raise AssertionError( - "calling get_platform using asyncify resulted in a hung process" - ) + raise AssertionError("calling get_platform using asyncify resulted in a hung process") time.sleep(0.1) diff --git a/tests/test_models.py b/tests/test_models.py index 682ff07..d3499d2 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -520,7 +520,6 @@ class Model(BaseModel): assert m3.to_dict(exclude_none=True) == {} assert m3.to_dict(exclude_defaults=True) == {} - class Model2(BaseModel): created_at: datetime @@ -831,20 +830,20 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason='TypeAliasType is not supported in Pydantic v1') +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) class Model(BaseModel): alias: Alias union: Union[int, Alias] - - m = construct_type(value={'alias': 'foo', 'union': 'bar'}, type_=Model) + + m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) assert isinstance(m, Model) assert isinstance(m.alias, str) - assert m.alias == 'foo' + assert m.alias == "foo" assert isinstance(m.union, str) - assert m.union == 'bar' + assert m.union == "bar" @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") diff --git a/tests/test_streaming.py b/tests/test_streaming.py index c82ceb3..64498cb 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -28,9 +28,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_data_missing_event( - sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK -) -> None: +async def test_data_missing_event(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: def body() -> Iterator[bytes]: yield b'data: {"foo":true}\n' yield b"\n" @@ -46,9 +44,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_event_missing_data( - sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK -) -> None: +async def test_event_missing_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -64,9 +60,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events( - sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK -) -> None: +async def test_multiple_events(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -88,9 +82,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events_with_data( - sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK -) -> None: +async def test_multiple_events_with_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b'data: {"foo":true}\n' @@ -157,9 +149,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_data_lines( - sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK -) -> None: +async def test_multiple_data_lines(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"data: {\n" diff --git a/tests/test_transform.py b/tests/test_transform.py index ee24d7b..352d7ae 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -191,16 +191,18 @@ async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") tz = "Z" if PYDANTIC_V2 else "+00:00" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] @parametrize @@ -390,11 +392,9 @@ def my_iter() -> Iterable[Baz8]: @pytest.mark.asyncio async def test_dictionary_items(use_async: bool) -> None: class DictItems(TypedDict): - foo_baz: Annotated[str, PropertyInfo(alias='fooBaz')] + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] - assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == { - "foo": {"fooBaz": "bar"} - } + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} class TypedDictIterableUnionStr(TypedDict): From f74def5e32618dc6ff2fb364cad51c01940af849 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 02:45:02 +0000 Subject: [PATCH 218/397] chore(internal): slight transform perf improvement (#291) --- src/onebusaway/_utils/_transform.py | 22 ++++++++++++++++++++++ tests/test_transform.py | 12 ++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 7ac2e17..3ec6208 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -184,6 +188,15 @@ def _transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -332,6 +345,15 @@ async def _async_transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): diff --git a/tests/test_transform.py b/tests/test_transform.py index 352d7ae..53b0f57 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -432,3 +432,15 @@ async def test_base64_file_input(use_async: bool) -> None: assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { "foo": "SGVsbG8sIHdvcmxkIQ==" } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] From 3ba0a52f74ffdc7b0cabdf2dfdd44537c132dc06 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 03:03:37 +0000 Subject: [PATCH 219/397] chore(internal): expand CI branch coverage --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b286e5..53a3a09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -33,7 +33,6 @@ jobs: test: name: test runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From c2e056e95068b3ffb80279d69b5a7603ffbc256c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 03:07:27 +0000 Subject: [PATCH 220/397] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53a3a09..81f6dc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: From 3ef7f7b6a016058d1d68e912d12e81e4c7b8f10f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 02:54:29 +0000 Subject: [PATCH 221/397] fix(perf): skip traversing types for NotGiven values --- src/onebusaway/_utils/_transform.py | 11 +++++++++++ tests/test_transform.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 3ec6208..3b2b8e0 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -12,6 +12,7 @@ from ._utils import ( is_list, + is_given, is_mapping, is_iterable, ) @@ -258,6 +259,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -415,6 +421,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is diff --git a/tests/test_transform.py b/tests/test_transform.py index 53b0f57..6db9c52 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from onebusaway._types import Base64FileInput +from onebusaway._types import NOT_GIVEN, Base64FileInput from onebusaway._utils import ( PropertyInfo, transform as _transform, @@ -444,3 +444,10 @@ async def test_transform_skipping(use_async: bool) -> None: # iterables of ints are converted to a list data = iter([1, 2, 3]) assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} From ddf06ce0964f841e82a46417d233bc309740e169 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 02:55:39 +0000 Subject: [PATCH 222/397] fix(perf): optimize some hot paths --- src/onebusaway/_utils/_transform.py | 14 +++++++++++++- src/onebusaway/_utils/_typing.py | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index 3b2b8e0..b0cc20a 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -5,7 +5,7 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic @@ -13,6 +13,7 @@ from ._utils import ( is_list, is_given, + lru_cache, is_mapping, is_iterable, ) @@ -109,6 +110,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -433,3 +435,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 278749b..1958820 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -13,6 +13,7 @@ get_origin, ) +from ._utils import lru_cache from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) From 2ae2b08d43f3bbbede02afcdf204d75962d0de8c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 18:55:31 +0000 Subject: [PATCH 223/397] release: 1.8.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2171c6e..988d5cb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.5" + ".": "1.8.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7545938..2362f98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 1.8.6 (2025-05-15) + +Full Changelog: [v1.8.5...v1.8.6](https://github.com/OneBusAway/python-sdk/compare/v1.8.5...v1.8.6) + +### Bug Fixes + +* **perf:** optimize some hot paths ([ddf06ce](https://github.com/OneBusAway/python-sdk/commit/ddf06ce0964f841e82a46417d233bc309740e169)) +* **perf:** skip traversing types for NotGiven values ([3ef7f7b](https://github.com/OneBusAway/python-sdk/commit/3ef7f7b6a016058d1d68e912d12e81e4c7b8f10f)) + + +### Chores + +* **internal:** codegen related update ([#290](https://github.com/OneBusAway/python-sdk/issues/290)) ([ae2f18c](https://github.com/OneBusAway/python-sdk/commit/ae2f18c4204970d2f5021b0060c6be7c562dfb54)) +* **internal:** expand CI branch coverage ([3ba0a52](https://github.com/OneBusAway/python-sdk/commit/3ba0a52f74ffdc7b0cabdf2dfdd44537c132dc06)) +* **internal:** reduce CI branch coverage ([c2e056e](https://github.com/OneBusAway/python-sdk/commit/c2e056e95068b3ffb80279d69b5a7603ffbc256c)) +* **internal:** slight transform perf improvement ([#291](https://github.com/OneBusAway/python-sdk/issues/291)) ([f74def5](https://github.com/OneBusAway/python-sdk/commit/f74def5e32618dc6ff2fb364cad51c01940af849)) + ## 1.8.5 (2025-05-15) Full Changelog: [v1.8.4...v1.8.5](https://github.com/OneBusAway/python-sdk/compare/v1.8.4...v1.8.5) diff --git a/pyproject.toml b/pyproject.toml index ee6e992..4455939 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.5" +version = "1.8.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ac2c376..047f93f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.5" # x-release-please-version +__version__ = "1.8.6" # x-release-please-version From 3a1f6255316b831eec27a42deecfd7a51d55bb24 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Fri, 16 May 2025 00:42:10 +0300 Subject: [PATCH 224/397] chore: formatting --- src/onebusaway/__init__.py | 2 +- tests/test_client.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 10ff6d2..2e0349f 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -88,7 +88,7 @@ for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "onebusaway" + __locals[__name].__module__ = "onebusaway" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass diff --git a/tests/test_client.py b/tests/test_client.py index e95582b..7b650cc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -28,10 +28,10 @@ from onebusaway._constants import RAW_RESPONSE_HEADER from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from onebusaway._base_client import ( - DEFAULT_TIMEOUT, - HTTPX_DEFAULT_TIMEOUT, - BaseClient, - make_request_options, + DEFAULT_TIMEOUT, + HTTPX_DEFAULT_TIMEOUT, + BaseClient, + make_request_options, ) from .utils import update_env From 6f86de60f85548d408891725075ac596b6a756f5 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Fri, 16 May 2025 01:47:54 +0300 Subject: [PATCH 225/397] fix: suppress type checking warnings in stops_for_location.py --- examples/stops_for_location.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index 118d8f7..283aca5 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -36,10 +36,10 @@ for route_id in stop.route_ids: # TODO: add type to route - route: Any = reference_map[route_id] + route: Any = reference_map[route_id] # type: ignore # Get a string that looks like "D Line - Blue Ridge/Crown Hill - Ballard - Downtown Seattle" - description_list = [route.null_safe_short_name, route.description] - description_list = [e for e in description_list if e] - description_str = " - ".join(description_list) + description_list = [route.null_safe_short_name, route.description] # type: ignore + description_list = [e for e in description_list if e] # type: ignore + description_str = " - ".join(description_list) # type: ignore print(f" {description_str}") From 78752fb2e2757500df6fbe2243f8c958d21d45b1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:39:00 +0000 Subject: [PATCH 226/397] feat(client): support digest authentication From 2583feac4ae8ea9a480be9694dd1bbfbf36c8e24 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 03:13:45 +0000 Subject: [PATCH 227/397] chore(internal): update pyright settings --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4455939..7be1bc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,6 +147,7 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false From 46ef2ca789d1cda13173d4cb9eb13cd45926436d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 03:15:20 +0000 Subject: [PATCH 228/397] chore(client): minor internal fixes --- src/onebusaway/_base_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 8ee4250..0430103 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -409,7 +409,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 idempotency_header = self._idempotency_header if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + options.idempotency_key = options.idempotency_key or self._idempotency_key() + headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. @@ -943,6 +944,10 @@ def _request( request = self._build_request(options, retries_taken=retries_taken) self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth @@ -1475,6 +1480,10 @@ async def _request( request = self._build_request(options, retries_taken=retries_taken) await self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth From 372d33b378a44bc1f7a37282c7c5a6617978b105 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:57:15 +0000 Subject: [PATCH 229/397] chore(internal): bump pyright version --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- src/onebusaway/_base_client.py | 6 +++++- src/onebusaway/_models.py | 1 - src/onebusaway/_utils/_typing.py | 2 +- tests/conftest.py | 2 +- tests/test_models.py | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7be1bc1..aaa6710 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ Repository = "https://github.com/OneBusAway/python-sdk" managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright>=1.1.359", + "pyright==1.1.399", "mypy", "respx", "pytest", diff --git a/requirements-dev.lock b/requirements-dev.lock index e00b078..e778717 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -69,7 +69,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.392.post0 +pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 0430103..a45573c 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -98,7 +98,11 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) if TYPE_CHECKING: - from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG else: try: from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 3493571..58b9263 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -19,7 +19,6 @@ ) import pydantic -import pydantic.generics from pydantic.fields import FieldInfo from ._types import ( diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 1958820..1bac954 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -110,7 +110,7 @@ class MyResponse(Foo[_T]): ``` """ cls = cast(object, get_origin(typ) or typ) - if cls in generic_bases: + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] # we're given the class directly return extract_type_arg(typ, index) diff --git a/tests/conftest.py b/tests/conftest.py index d166173..116f6d4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") diff --git a/tests/test_models.py b/tests/test_models.py index d3499d2..2099d51 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -832,7 +832,7 @@ class B(BaseModel): @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: - Alias = TypeAliasType("Alias", str) + Alias = TypeAliasType("Alias", str) # pyright: ignore class Model(BaseModel): alias: Alias From 5dcff0e41a90577caf12e799b9388e88661afdaf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:57:47 +0000 Subject: [PATCH 230/397] chore(internal): base client updates --- src/onebusaway/_base_client.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index a45573c..f7b2902 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -119,6 +119,7 @@ class PageInfo: url: URL | NotGiven params: Query | NotGiven + json: Body | NotGiven @overload def __init__( @@ -134,19 +135,30 @@ def __init__( params: Query, ) -> None: ... + @overload + def __init__( + self, + *, + json: Body, + ) -> None: ... + def __init__( self, *, url: URL | NotGiven = NOT_GIVEN, + json: Body | NotGiven = NOT_GIVEN, params: Query | NotGiven = NOT_GIVEN, ) -> None: self.url = url + self.json = json self.params = params @override def __repr__(self) -> str: if self.url: return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" return f"{self.__class__.__name__}(params={self.params})" @@ -195,6 +207,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: options.url = str(url) return options + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + raise ValueError("Unexpected PageInfo state") From 6d50ec101d12998985b8b3559a2ae06d9f9f8f91 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 03:04:04 +0000 Subject: [PATCH 231/397] chore(internal): update models test --- tests/test_models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_models.py b/tests/test_models.py index 2099d51..38568b6 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -492,12 +492,15 @@ class Model(BaseModel): resource_id: Optional[str] = None m = Model.construct() + assert m.resource_id is None assert "resource_id" not in m.model_fields_set m = Model.construct(resource_id=None) + assert m.resource_id is None assert "resource_id" in m.model_fields_set m = Model.construct(resource_id="foo") + assert m.resource_id == "foo" assert "resource_id" in m.model_fields_set From 4f9bf3f56e7a4121c02d0b42940758c5ee8d15a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:47:02 +0000 Subject: [PATCH 232/397] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81f6dc2..04b083c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: @@ -30,6 +31,7 @@ jobs: run: ./scripts/lint test: + timeout-minutes: 10 name: test runs-on: ubuntu-latest steps: From 55369d4913d0db14d4f8a5f0b177513e29c49246 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:47:36 +0000 Subject: [PATCH 233/397] chore(internal): import reformatting --- src/onebusaway/_client.py | 5 +---- src/onebusaway/resources/arrival_and_departure.py | 5 +---- src/onebusaway/resources/report_problem_with_stop.py | 5 +---- src/onebusaway/resources/report_problem_with_trip.py | 5 +---- src/onebusaway/resources/routes_for_location.py | 5 +---- src/onebusaway/resources/schedule_for_route.py | 5 +---- src/onebusaway/resources/schedule_for_stop.py | 5 +---- src/onebusaway/resources/search_for_route.py | 5 +---- src/onebusaway/resources/search_for_stop.py | 5 +---- src/onebusaway/resources/stops_for_location.py | 5 +---- src/onebusaway/resources/stops_for_route.py | 5 +---- src/onebusaway/resources/trip_details.py | 5 +---- src/onebusaway/resources/trip_for_vehicle.py | 5 +---- src/onebusaway/resources/trips_for_location.py | 5 +---- src/onebusaway/resources/trips_for_route.py | 5 +---- src/onebusaway/resources/vehicles_for_agency.py | 5 +---- 16 files changed, 16 insertions(+), 64 deletions(-) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e14128b..3180875 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -19,10 +19,7 @@ ProxiesTypes, RequestOptions, ) -from ._utils import ( - is_given, - get_async_library, -) +from ._utils import is_given, get_async_library from ._version import __version__ from .resources import ( stop, diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 8323a51..c58f4d5 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -9,10 +9,7 @@ from ..types import arrival_and_departure_list_params, arrival_and_departure_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index d1614f6..755cbe2 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -8,10 +8,7 @@ from ..types import report_problem_with_stop_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index d0f9733..848dc0e 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -8,10 +8,7 @@ from ..types import report_problem_with_trip_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index d315909..af9e1f1 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -6,10 +6,7 @@ from ..types import routes_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 3d5509d..c40d4b6 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -9,10 +9,7 @@ from ..types import schedule_for_route_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 78b4d36..a530f94 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -9,10 +9,7 @@ from ..types import schedule_for_stop_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index fe1d9a2..6f12050 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -6,10 +6,7 @@ from ..types import search_for_route_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 8efb8ad..3458a57 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -6,10 +6,7 @@ from ..types import search_for_stop_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 80322e3..52afc2d 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -6,10 +6,7 @@ from ..types import stops_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 36f7514..17c867e 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -6,10 +6,7 @@ from ..types import stops_for_route_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 71092c9..267b195 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -6,10 +6,7 @@ from ..types import trip_detail_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 4417b48..073358e 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -6,10 +6,7 @@ from ..types import trip_for_vehicle_retrieve_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 84958f9..1d0a342 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -6,10 +6,7 @@ from ..types import trips_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index a5ca21d..c6de3f2 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -6,10 +6,7 @@ from ..types import trips_for_route_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 3f8697d..e66ba88 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -6,10 +6,7 @@ from ..types import vehicles_for_agency_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( From 2401f32e86b394778db413a97be0ece06ea34346 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:02:18 +0000 Subject: [PATCH 234/397] chore(internal): fix list file params --- src/onebusaway/_utils/_utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index e5811bb..ea3cf3f 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -72,8 +72,16 @@ def _extract_items( from .._files import assert_is_file_content # We have exhausted the path, return the entry we found. - assert_is_file_content(obj, key=flattened_key) assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) return [(flattened_key, cast(FileTypes, obj))] index += 1 From f034ad2291495dc12c523e297f7871cf4bdccc42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:03:00 +0000 Subject: [PATCH 235/397] chore(internal): refactor retries to not use recursion --- src/onebusaway/_base_client.py | 414 ++++++++++++++------------------- 1 file changed, 175 insertions(+), 239 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index f7b2902..e4955bb 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -437,8 +437,7 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 headers = httpx.Headers(headers_dict) idempotency_header = self._idempotency_header - if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - options.idempotency_key = options.idempotency_key or self._idempotency_key() + if idempotency_header and options.idempotency_key and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check @@ -903,7 +902,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[True], stream_cls: Type[_StreamT], @@ -914,7 +912,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, ) -> ResponseT: ... @@ -924,7 +921,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, @@ -934,125 +930,109 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) + cast_to = self._maybe_override_cast_to(cast_to, options) - def _request( - self, - *, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - retries_taken: int, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) - - cast_to = self._maybe_override_cast_to(cast_to, options) - options = self._prepare_options(options) - - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - self._prepare_request(request) - - if options.idempotency_key: + if input_options.idempotency_key is None and input_options.method.lower() != "get": # ensure the idempotency key is reused between requests - input_options.idempotency_key = options.idempotency_key + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - log.debug("Sending HTTP Request: %s %s", request.method, request.url) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) - try: - response = self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err - - log.debug( - 'HTTP Response: %s %s "%i %s" %s', - request.method, - request.url, - response.status_code, - response.reason_phrase, - response.headers, - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - err.response.close() - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - err.response.read() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return self._process_response( cast_to=cast_to, options=options, @@ -1062,37 +1042,20 @@ def _request( retries_taken=retries_taken, ) - def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) - # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a - # different thread if necessary. time.sleep(timeout) - return self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - def _process_response( self, *, @@ -1436,7 +1399,6 @@ async def request( options: FinalRequestOptions, *, stream: Literal[False] = False, - remaining_retries: Optional[int] = None, ) -> ResponseT: ... @overload @@ -1447,7 +1409,6 @@ async def request( *, stream: Literal[True], stream_cls: type[_AsyncStreamT], - remaining_retries: Optional[int] = None, ) -> _AsyncStreamT: ... @overload @@ -1458,7 +1419,6 @@ async def request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: ... async def request( @@ -1468,120 +1428,111 @@ async def request( *, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return await self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) - - async def _request( - self, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - retries_taken: int, ) -> ResponseT | _AsyncStreamT: if self._platform is None: # `get_platform` can make blocking IO calls so we # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + cast_to = self._maybe_override_cast_to(cast_to, options) + # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) - - cast_to = self._maybe_override_cast_to(cast_to, options) - options = await self._prepare_options(options) - - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - await self._prepare_request(request) - - if options.idempotency_key: + if input_options.idempotency_key is None and input_options.method.lower() != "get": # ensure the idempotency key is reused between requests - input_options.idempotency_key = options.idempotency_key + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - try: - response = await self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - await err.response.aclose() - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - await err.response.aread() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return await self._process_response( cast_to=cast_to, options=options, @@ -1591,35 +1542,20 @@ async def _request( retries_taken=retries_taken, ) - async def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - ) -> ResponseT | _AsyncStreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) - return await self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - async def _process_response( self, *, From 0bf5ca29079b4844d824aeffa45701d453aee07f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:03:30 +0000 Subject: [PATCH 236/397] fix(pydantic v1): more robust ModelField.annotation check --- src/onebusaway/_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 58b9263..798956f 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -626,8 +626,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, # Note: if one variant defines an alias then they all should discriminator_alias = field_info.alias - if field_info.annotation and is_literal_type(field_info.annotation): - for entry in get_args(field_info.annotation): + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant From 769fecb626b4d8c82b26d156a5583c635c8471f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:41:21 +0000 Subject: [PATCH 237/397] chore(internal): minor formatting changes --- src/onebusaway/types/shared/response_wrapper.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py index 72ecc38..2adf543 100644 --- a/src/onebusaway/types/shared/response_wrapper.py +++ b/src/onebusaway/types/shared/response_wrapper.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel From f2c26ec71b462bee6c57253056c2e35ac26bea59 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:42:08 +0000 Subject: [PATCH 238/397] chore(internal): codegen related update --- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04b083c..3382042 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -33,7 +33,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 13dc1e5..59e560e 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 908ad72..fda6116 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 if: github.repository == 'OneBusAway/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From b943cd6d8a741d5b0eb46f0e3f071c05243d7a96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:42:41 +0000 Subject: [PATCH 239/397] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3382042..0f7bee8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -33,7 +33,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 59e560e..13dc1e5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -11,7 +11,7 @@ on: jobs: publish: name: publish - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index fda6116..908ad72 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest if: github.repository == 'OneBusAway/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: From 4ac9df4564811ba3a7874ed2fccdcedf0ee9f926 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:44:03 +0000 Subject: [PATCH 240/397] chore: broadly detect json family of content-type headers --- src/onebusaway/_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 16b6f2b..cc4f68e 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -235,7 +235,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: # split is required to handle cases where additional information is included # in the response, e.g. application/json; charset=utf-8 content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": + if not content_type.endswith("json"): if is_basemodel(cast_to): try: data = response.json() From 442412cf7414b96fcc111b099b0899be6dda2c62 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:39:00 +0000 Subject: [PATCH 241/397] feat(client): support digest authentication From 645fab1f917aa2911f8a202962c14497703a6e4a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:39:00 +0000 Subject: [PATCH 242/397] feat(client): support digest authentication From 7968d8ec213da1e0f7c6006a262f4490d33dc189 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:39:00 +0000 Subject: [PATCH 243/397] feat(client): support digest authentication From f4394bdcec5805043ffa880a1ca8b5df1a0e3208 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 22:48:20 +0000 Subject: [PATCH 244/397] release: 1.9.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 988d5cb..c3c9552 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.6" + ".": "1.9.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2362f98..5a52108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,40 @@ # Changelog +## 1.9.0 (2025-05-15) + +Full Changelog: [v1.8.6...v1.9.0](https://github.com/OneBusAway/python-sdk/compare/v1.8.6...v1.9.0) + +### Features + +* **client:** support digest authentication ([7968d8e](https://github.com/OneBusAway/python-sdk/commit/7968d8ec213da1e0f7c6006a262f4490d33dc189)) +* **client:** support digest authentication ([645fab1](https://github.com/OneBusAway/python-sdk/commit/645fab1f917aa2911f8a202962c14497703a6e4a)) +* **client:** support digest authentication ([442412c](https://github.com/OneBusAway/python-sdk/commit/442412cf7414b96fcc111b099b0899be6dda2c62)) +* **client:** support digest authentication ([78752fb](https://github.com/OneBusAway/python-sdk/commit/78752fb2e2757500df6fbe2243f8c958d21d45b1)) + + +### Bug Fixes + +* **pydantic v1:** more robust ModelField.annotation check ([0bf5ca2](https://github.com/OneBusAway/python-sdk/commit/0bf5ca29079b4844d824aeffa45701d453aee07f)) +* suppress type checking warnings in stops_for_location.py ([6f86de6](https://github.com/OneBusAway/python-sdk/commit/6f86de60f85548d408891725075ac596b6a756f5)) + + +### Chores + +* broadly detect json family of content-type headers ([4ac9df4](https://github.com/OneBusAway/python-sdk/commit/4ac9df4564811ba3a7874ed2fccdcedf0ee9f926)) +* **ci:** add timeout thresholds for CI jobs ([4f9bf3f](https://github.com/OneBusAway/python-sdk/commit/4f9bf3f56e7a4121c02d0b42940758c5ee8d15a9)) +* **ci:** only use depot for staging repos ([b943cd6](https://github.com/OneBusAway/python-sdk/commit/b943cd6d8a741d5b0eb46f0e3f071c05243d7a96)) +* **client:** minor internal fixes ([46ef2ca](https://github.com/OneBusAway/python-sdk/commit/46ef2ca789d1cda13173d4cb9eb13cd45926436d)) +* formatting ([3a1f625](https://github.com/OneBusAway/python-sdk/commit/3a1f6255316b831eec27a42deecfd7a51d55bb24)) +* **internal:** base client updates ([5dcff0e](https://github.com/OneBusAway/python-sdk/commit/5dcff0e41a90577caf12e799b9388e88661afdaf)) +* **internal:** bump pyright version ([372d33b](https://github.com/OneBusAway/python-sdk/commit/372d33b378a44bc1f7a37282c7c5a6617978b105)) +* **internal:** codegen related update ([f2c26ec](https://github.com/OneBusAway/python-sdk/commit/f2c26ec71b462bee6c57253056c2e35ac26bea59)) +* **internal:** fix list file params ([2401f32](https://github.com/OneBusAway/python-sdk/commit/2401f32e86b394778db413a97be0ece06ea34346)) +* **internal:** import reformatting ([55369d4](https://github.com/OneBusAway/python-sdk/commit/55369d4913d0db14d4f8a5f0b177513e29c49246)) +* **internal:** minor formatting changes ([769fecb](https://github.com/OneBusAway/python-sdk/commit/769fecb626b4d8c82b26d156a5583c635c8471f9)) +* **internal:** refactor retries to not use recursion ([f034ad2](https://github.com/OneBusAway/python-sdk/commit/f034ad2291495dc12c523e297f7871cf4bdccc42)) +* **internal:** update models test ([6d50ec1](https://github.com/OneBusAway/python-sdk/commit/6d50ec101d12998985b8b3559a2ae06d9f9f8f91)) +* **internal:** update pyright settings ([2583fea](https://github.com/OneBusAway/python-sdk/commit/2583feac4ae8ea9a480be9694dd1bbfbf36c8e24)) + ## 1.8.6 (2025-05-15) Full Changelog: [v1.8.5...v1.8.6](https://github.com/OneBusAway/python-sdk/compare/v1.8.5...v1.8.6) diff --git a/pyproject.toml b/pyproject.toml index aaa6710..08bda30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.6" +version = "1.9.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 047f93f..6a496db 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.6" # x-release-please-version +__version__ = "1.9.0" # x-release-please-version From d996edfce7df8c642feda6c88a46e3e9638e2364 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 03:50:07 +0000 Subject: [PATCH 245/397] chore(internal): codegen related update --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++ scripts/utils/upload-artifact.sh | 25 +++++++++++++++++++++++ src/onebusaway/__init__.py | 5 +++++ src/onebusaway/_utils/_proxy.py | 5 ++++- src/onebusaway/_utils/_resources_proxy.py | 24 ++++++++++++++++++++++ tests/test_utils/test_proxy.py | 11 ++++++++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 scripts/utils/upload-artifact.sh create mode 100644 src/onebusaway/_utils/_resources_proxy.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f7bee8..c521a9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,30 @@ jobs: - name: Run lints run: ./scripts/lint + upload: + if: github.repository == 'stainless-sdks/open-transit-python' + timeout-minutes: 10 + name: upload + permissions: + contents: read + id-token: write + runs-on: depot-ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Get GitHub OIDC Token + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + test: timeout-minutes: 10 name: test diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 0000000..20d2cbf --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/open-transit-python/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 2e0349f..ea3444e 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import typing as _t + from . import types from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path @@ -78,6 +80,9 @@ "DefaultAsyncHttpxClient", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py index ffd883e..0f239a3 100644 --- a/src/onebusaway/_utils/_proxy.py +++ b/src/onebusaway/_utils/_proxy.py @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]: @property # type: ignore @override def __class__(self) -> type: # pyright: ignore - proxied = self.__get_proxied__() + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) if issubclass(type(proxied), LazyProxy): return type(proxied) return proxied.__class__ diff --git a/src/onebusaway/_utils/_resources_proxy.py b/src/onebusaway/_utils/_resources_proxy.py new file mode 100644 index 0000000..c0f7783 --- /dev/null +++ b/src/onebusaway/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `onebusaway.resources` module. + + This is used so that we can lazily import `onebusaway.resources` only when + needed *and* so that users can just import `onebusaway` and reference `onebusaway.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("onebusaway.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 4778a91..3cefe3f 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -21,3 +21,14 @@ def test_recursive_proxy() -> None: assert dir(proxy) == [] assert type(proxy).__name__ == "RecursiveLazyProxy" assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" + + +def test_isinstance_does_not_error() -> None: + class AlwaysErrorProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + raise RuntimeError("Mocking missing dependency") + + proxy = AlwaysErrorProxy() + assert not isinstance(proxy, dict) + assert isinstance(proxy, LazyProxy) From f48024a24c77ee13a4d7dd46cbe047ab36d68110 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 03:50:25 +0000 Subject: [PATCH 246/397] release: 1.9.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c3c9552..2cd8f9b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.0" + ".": "1.9.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a52108..a4290bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.9.1 (2025-05-16) + +Full Changelog: [v1.9.0...v1.9.1](https://github.com/OneBusAway/python-sdk/compare/v1.9.0...v1.9.1) + +### Chores + +* **internal:** codegen related update ([d996edf](https://github.com/OneBusAway/python-sdk/commit/d996edfce7df8c642feda6c88a46e3e9638e2364)) + ## 1.9.0 (2025-05-15) Full Changelog: [v1.8.6...v1.9.0](https://github.com/OneBusAway/python-sdk/compare/v1.8.6...v1.9.0) diff --git a/pyproject.toml b/pyproject.toml index 08bda30..27cb09c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.9.0" +version = "1.9.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6a496db..90b088f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.9.0" # x-release-please-version +__version__ = "1.9.1" # x-release-please-version From e1770ea404333e965948a7e27bec57215985c82d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 13:46:15 +0000 Subject: [PATCH 247/397] feat(api): api update --- .stats.yml | 6 +++--- .../types/schedule_for_route_retrieve_response.py | 4 ++-- src/onebusaway/types/search_for_stop_list_response.py | 4 ++-- src/onebusaway/types/shared/references.py | 4 ++-- src/onebusaway/types/stop_retrieve_response.py | 4 ++-- src/onebusaway/types/stops_for_agency_list_response.py | 4 ++-- src/onebusaway/types/stops_for_location_list_response.py | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2de8424..66b93fb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml -openapi_spec_hash: 84d082f35446d29c7db3cfcd259e9859 -config_hash: c7e112ec9853ad18fe92551ae0d97656 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml +openapi_spec_hash: 417ea17b08e186b15b2986372592185e +config_hash: 49345353764ace98f2d9e0bf590fd47c diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 8266786..c970b6c 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -24,6 +24,8 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -38,8 +40,6 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 502455c..28574d5 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -16,6 +16,8 @@ class SearchForStopListResponseDataList(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -30,8 +32,6 @@ class SearchForStopListResponseDataList(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 8c6deab..2c50704 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -199,6 +199,8 @@ class Stop(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -213,8 +215,6 @@ class Stop(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 6a69553..0596ce7 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -16,6 +16,8 @@ class StopRetrieveResponseDataEntry(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -30,8 +32,6 @@ class StopRetrieveResponseDataEntry(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index 422c5ee..efab70c 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -16,6 +16,8 @@ class StopsForAgencyListResponseList(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -30,8 +32,6 @@ class StopsForAgencyListResponseList(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index e075eb1..75d9ba9 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -16,6 +16,8 @@ class StopsForLocationListResponseDataList(BaseModel): lat: float + location_type: int = FieldInfo(alias="locationType") + lon: float name: str @@ -30,8 +32,6 @@ class StopsForLocationListResponseDataList(BaseModel): direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) From 6d6b4411df0eef84daf0bf6885394642bd2289da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 13:46:33 +0000 Subject: [PATCH 248/397] release: 1.10.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2cd8f9b..eb4e0db 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.1" + ".": "1.10.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a4290bb..8dbf08c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.10.0 (2025-05-17) + +Full Changelog: [v1.9.1...v1.10.0](https://github.com/OneBusAway/python-sdk/compare/v1.9.1...v1.10.0) + +### Features + +* **api:** api update ([e1770ea](https://github.com/OneBusAway/python-sdk/commit/e1770ea404333e965948a7e27bec57215985c82d)) + ## 1.9.1 (2025-05-16) Full Changelog: [v1.9.0...v1.9.1](https://github.com/OneBusAway/python-sdk/compare/v1.9.0...v1.9.1) diff --git a/pyproject.toml b/pyproject.toml index 27cb09c..8c737d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.9.1" +version = "1.10.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 90b088f..9ff3bc3 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.9.1" # x-release-please-version +__version__ = "1.10.0" # x-release-please-version From 78c000a7d1ea1bd0d209eab2c35d48f102cc1b8f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 13:53:26 +0000 Subject: [PATCH 249/397] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 66b93fb..1e96de8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml openapi_spec_hash: 417ea17b08e186b15b2986372592185e -config_hash: 49345353764ace98f2d9e0bf590fd47c +config_hash: 4d49adad69ce123e894ca9186440f091 From 97cb21c8923f2659745cb87ed241330fc3150d57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 13:55:04 +0000 Subject: [PATCH 250/397] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 1e96de8..ad2b092 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml openapi_spec_hash: 417ea17b08e186b15b2986372592185e -config_hash: 4d49adad69ce123e894ca9186440f091 +config_hash: 66a75fee4c675cafae7a65b205136686 From 01404f0c86fde980e928da334f5fa4ac21d1f513 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 14:24:04 +0000 Subject: [PATCH 251/397] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index ad2b092..aedc167 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml openapi_spec_hash: 417ea17b08e186b15b2986372592185e -config_hash: 66a75fee4c675cafae7a65b205136686 +config_hash: 329054917178caa31271402afcf423da From 9981b15b92023faad9812c2ad55f977673424c1b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 15:19:13 +0000 Subject: [PATCH 252/397] feat(api): api update --- .stats.yml | 2 +- src/onebusaway/_client.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index aedc167..ad9cf70 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml openapi_spec_hash: 417ea17b08e186b15b2986372592185e -config_hash: 329054917178caa31271402afcf423da +config_hash: 3871f5d21bb38ddd334ec04721dea64d diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 3180875..9e04cd8 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -267,6 +267,9 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy + def _get_api_key_query_param(self) -> str | None: + return self.api_key + @override def _make_status_error( self, @@ -497,6 +500,9 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy + def _get_api_key_query_param(self) -> str | None: + return self.api_key + @override def _make_status_error( self, From 9b939389eece6273d8863f2c3c57cca2dbd9008f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 15:19:32 +0000 Subject: [PATCH 253/397] release: 1.11.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0db..caf1487 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.11.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dbf08c..8296b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.11.0 (2025-05-20) + +Full Changelog: [v1.10.0...v1.11.0](https://github.com/OneBusAway/python-sdk/compare/v1.10.0...v1.11.0) + +### Features + +* **api:** api update ([9981b15](https://github.com/OneBusAway/python-sdk/commit/9981b15b92023faad9812c2ad55f977673424c1b)) + ## 1.10.0 (2025-05-17) Full Changelog: [v1.9.1...v1.10.0](https://github.com/OneBusAway/python-sdk/compare/v1.9.1...v1.10.0) diff --git a/pyproject.toml b/pyproject.toml index 8c737d1..da8678e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.10.0" +version = "1.11.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 9ff3bc3..f0d0000 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.10.0" # x-release-please-version +__version__ = "1.11.0" # x-release-please-version From 052af65693c380484e4e920b4a831c52b4345daa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 02:36:32 +0000 Subject: [PATCH 254/397] chore(docs): grammar improvements --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 8be07dc..8b844a0 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,11 +16,11 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Onebusaway SDK please follow the respective company's security reporting guidelines. +or products provided by Onebusaway SDK, please follow the respective company's security reporting guidelines. ### Onebusaway SDK Terms and Policies -Please contact info@onebusaway.org for any questions or concerns regarding security of our services. +Please contact info@onebusaway.org for any questions or concerns regarding the security of our services. --- From 4b5babdd373b9e93b5fe7736bc68283c2abd9755 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 02:40:17 +0000 Subject: [PATCH 255/397] release: 1.11.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index caf1487..271a68c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.11.0" + ".": "1.11.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8296b99..10a98fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.11.1 (2025-05-22) + +Full Changelog: [v1.11.0...v1.11.1](https://github.com/OneBusAway/python-sdk/compare/v1.11.0...v1.11.1) + +### Chores + +* **docs:** grammar improvements ([052af65](https://github.com/OneBusAway/python-sdk/commit/052af65693c380484e4e920b4a831c52b4345daa)) + ## 1.11.0 (2025-05-20) Full Changelog: [v1.10.0...v1.11.0](https://github.com/OneBusAway/python-sdk/compare/v1.10.0...v1.11.0) diff --git a/pyproject.toml b/pyproject.toml index da8678e..33a6d3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.11.0" +version = "1.11.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f0d0000..311f367 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.11.0" # x-release-please-version +__version__ = "1.11.1" # x-release-please-version From 064f5b86a6b67b49431886f2892cdfb6cd221e8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 02:30:02 +0000 Subject: [PATCH 256/397] chore(docs): remove reference to rye shell --- CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e2474f..a6b6615 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,7 @@ $ rye sync --all-features You can then run scripts using `rye run python script.py` or by activating the virtual environment: ```sh -$ rye shell -# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work +# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work $ source .venv/bin/activate # now you can omit the `rye run` prefix From 569c63a79d7d69d4e7f54466860e462114385db9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 03:45:36 +0000 Subject: [PATCH 257/397] feat(client): add follow_redirects request option --- src/onebusaway/_base_client.py | 6 ++++ src/onebusaway/_models.py | 2 ++ src/onebusaway/_types.py | 2 ++ tests/test_client.py | 54 ++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index e4955bb..d5bbf82 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -960,6 +960,9 @@ def request( if self.custom_auth is not None: kwargs["auth"] = self.custom_auth + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + log.debug("Sending HTTP Request: %s %s", request.method, request.url) response = None @@ -1460,6 +1463,9 @@ async def request( if self.custom_auth is not None: kwargs["auth"] = self.custom_auth + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + log.debug("Sending HTTP Request: %s %s", request.method, request.url) response = None diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 798956f..4f21498 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -737,6 +737,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): idempotency_key: str json_data: Body extra_json: AnyMapping + follow_redirects: bool @final @@ -750,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel): files: Union[HttpxRequestFiles, None] = None idempotency_key: Union[str, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + follow_redirects: Union[bool, None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index a457723..cbe6c70 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -100,6 +100,7 @@ class RequestOptions(TypedDict, total=False): params: Query extra_json: AnyMapping idempotency_key: str + follow_redirects: bool # Sentinel class used until PEP 0661 is accepted @@ -215,3 +216,4 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth + follow_redirects: bool diff --git a/tests/test_client.py b/tests/test_client.py index 7b650cc..6081a73 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -818,6 +818,33 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" + class TestAsyncOnebusawaySDK: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -1634,3 +1661,30 @@ async def test_main() -> None: raise AssertionError("calling get_platform using asyncify resulted in a hung process") time.sleep(0.1) + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + await self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" From 1533b409cbb1dc94e017f88e23c8912ff2d75912 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 03:50:27 +0000 Subject: [PATCH 258/397] release: 1.12.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 271a68c..de0960a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.11.1" + ".": "1.12.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 10a98fd..a383bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.12.0 (2025-06-03) + +Full Changelog: [v1.11.1...v1.12.0](https://github.com/OneBusAway/python-sdk/compare/v1.11.1...v1.12.0) + +### Features + +* **client:** add follow_redirects request option ([569c63a](https://github.com/OneBusAway/python-sdk/commit/569c63a79d7d69d4e7f54466860e462114385db9)) + + +### Chores + +* **docs:** remove reference to rye shell ([064f5b8](https://github.com/OneBusAway/python-sdk/commit/064f5b86a6b67b49431886f2892cdfb6cd221e8a)) + ## 1.11.1 (2025-05-22) Full Changelog: [v1.11.0...v1.11.1](https://github.com/OneBusAway/python-sdk/compare/v1.11.0...v1.11.1) diff --git a/pyproject.toml b/pyproject.toml index 33a6d3f..be9dd71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.11.1" +version = "1.12.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 311f367..88e029a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.11.1" # x-release-please-version +__version__ = "1.12.0" # x-release-please-version From 1329bbe39e76943fe51efea63dc5ee7f85154135 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 02:16:06 +0000 Subject: [PATCH 259/397] chore(tests): run tests in parallel --- pyproject.toml | 3 ++- requirements-dev.lock | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index be9dd71..136cda3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ dev-dependencies = [ "importlib-metadata>=6.7.0", "rich>=13.7.1", "nest_asyncio==1.6.0", + "pytest-xdist>=3.6.1", ] [tool.rye.scripts] @@ -125,7 +126,7 @@ replacement = '[\1](https://github.com/OneBusAway/python-sdk/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] -addopts = "--tb=short" +addopts = "--tb=short -n auto" xfail_strict = true asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "session" diff --git a/requirements-dev.lock b/requirements-dev.lock index e778717..e49ccf8 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -30,6 +30,8 @@ distro==1.8.0 exceptiongroup==1.2.2 # via anyio # via pytest +execnet==2.1.1 + # via pytest-xdist filelock==3.12.4 # via virtualenv h11==0.14.0 @@ -72,7 +74,9 @@ pygments==2.18.0 pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio + # via pytest-xdist pytest-asyncio==0.24.0 +pytest-xdist==3.7.0 python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 From 4bc049ce0a36680434f5570fd38f3ca673250bba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 02:40:40 +0000 Subject: [PATCH 260/397] fix(client): correctly parse binary response | stream --- src/onebusaway/_base_client.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index d5bbf82..289eb37 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1071,7 +1071,14 @@ def _process_response( ) -> ResponseT: origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, APIResponse): raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}") @@ -1574,7 +1581,14 @@ async def _process_response( ) -> ResponseT: origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, AsyncAPIResponse): raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}") From 915e21427ff22336ae4eb1426d58335e2ad066be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 02:41:32 +0000 Subject: [PATCH 261/397] release: 1.12.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de0960a..ffb929a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.0" + ".": "1.12.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a383bd3..de4fd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.12.1 (2025-06-13) + +Full Changelog: [v1.12.0...v1.12.1](https://github.com/OneBusAway/python-sdk/compare/v1.12.0...v1.12.1) + +### Bug Fixes + +* **client:** correctly parse binary response | stream ([4bc049c](https://github.com/OneBusAway/python-sdk/commit/4bc049ce0a36680434f5570fd38f3ca673250bba)) + + +### Chores + +* **tests:** run tests in parallel ([1329bbe](https://github.com/OneBusAway/python-sdk/commit/1329bbe39e76943fe51efea63dc5ee7f85154135)) + ## 1.12.0 (2025-06-03) Full Changelog: [v1.11.1...v1.12.0](https://github.com/OneBusAway/python-sdk/compare/v1.11.1...v1.12.0) diff --git a/pyproject.toml b/pyproject.toml index 136cda3..b688bce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.12.0" +version = "1.12.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 88e029a..0dddedd 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.12.0" # x-release-please-version +__version__ = "1.12.1" # x-release-please-version From 55c4719837747d638cfbb9e79f683189045338ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 02:47:31 +0000 Subject: [PATCH 262/397] chore(tests): add tests for httpx client instantiation & proxies --- tests/test_client.py | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 6081a73..3743a4d 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -31,6 +31,8 @@ DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + DefaultHttpxClient, + DefaultAsyncHttpxClient, make_request_options, ) @@ -818,6 +820,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + + client = DefaultHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + @pytest.mark.respx(base_url=base_url) def test_follow_redirects(self, respx_mock: MockRouter) -> None: # Test that the default follow_redirects=True allows following redirects @@ -1662,6 +1686,28 @@ async def test_main() -> None: time.sleep(0.1) + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + + client = DefaultAsyncHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + async def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultAsyncHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + @pytest.mark.respx(base_url=base_url) async def test_follow_redirects(self, respx_mock: MockRouter) -> None: # Test that the default follow_redirects=True allows following redirects From a2b6c3e1d78656155c5eb2f0a1cff69de045909b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 04:17:01 +0000 Subject: [PATCH 263/397] chore(internal): update conftest.py --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 116f6d4..fad4436 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from __future__ import annotations import os From 2b9118f1154e0f8e90c71a1fb37577c63a57c63f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 06:48:22 +0000 Subject: [PATCH 264/397] chore(ci): enable for pull requests --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c521a9f..1fc1ed3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: - 'integrated/**' - 'stl-preview-head/**' - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: From dc504994e1f2c2c76e0a46941b97b35a90b0e5c5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 02:19:44 +0000 Subject: [PATCH 265/397] chore(readme): update badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bc5b4e..ecb16aa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OneBusAway SDK Python API library -[![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg)](https://pypi.org/project/onebusaway/) +[![PyPI version]()](https://pypi.org/project/onebusaway/) The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.8+ From 355779aceef53b58275a4dab5020d414044adbb0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 05:56:16 +0000 Subject: [PATCH 266/397] fix(tests): fix: tests which call HTTP endpoints directly with the example parameters --- tests/test_client.py | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 3743a4d..357cf79 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -25,7 +25,6 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError from onebusaway._types import Omit from onebusaway._models import BaseModel, FinalRequestOptions -from onebusaway._constants import RAW_RESPONSE_HEADER from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from onebusaway._base_client import ( DEFAULT_TIMEOUT, @@ -717,30 +716,21 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + client.current_time.with_streaming_response.retrieve().__enter__() assert _get_open_connections(self.client) == 0 @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - + client.current_time.with_streaming_response.retrieve().__enter__() assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -1533,30 +1523,25 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_timeout_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await async_client.current_time.with_streaming_response.retrieve().__aenter__() assert _get_open_connections(self.client) == 0 @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_status_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - + await async_client.current_time.with_streaming_response.retrieve().__aenter__() assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) From 5e8cb3aa66d4a60f7e96d71cf5bbf2fedeb172ef Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 02:57:29 +0000 Subject: [PATCH 267/397] docs(client): fix httpx.Timeout documentation reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ecb16aa..b30ea29 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ client.with_options(max_retries=5).current_time.retrieve() ### Timeouts By default requests time out after 1 minute. You can configure this with a `timeout` option, -which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: +which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python from onebusaway import OnebusawaySDK From a5c734731dfb2de57d1c53e59dd2351f59e4d416 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 02:58:02 +0000 Subject: [PATCH 268/397] release: 1.12.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ffb929a..a80c237 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.1" + ".": "1.12.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index de4fd20..2072b87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.12.2 (2025-06-19) + +Full Changelog: [v1.12.1...v1.12.2](https://github.com/OneBusAway/python-sdk/compare/v1.12.1...v1.12.2) + +### Bug Fixes + +* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([355779a](https://github.com/OneBusAway/python-sdk/commit/355779aceef53b58275a4dab5020d414044adbb0)) + + +### Chores + +* **ci:** enable for pull requests ([2b9118f](https://github.com/OneBusAway/python-sdk/commit/2b9118f1154e0f8e90c71a1fb37577c63a57c63f)) +* **internal:** update conftest.py ([a2b6c3e](https://github.com/OneBusAway/python-sdk/commit/a2b6c3e1d78656155c5eb2f0a1cff69de045909b)) +* **readme:** update badges ([dc50499](https://github.com/OneBusAway/python-sdk/commit/dc504994e1f2c2c76e0a46941b97b35a90b0e5c5)) +* **tests:** add tests for httpx client instantiation & proxies ([55c4719](https://github.com/OneBusAway/python-sdk/commit/55c4719837747d638cfbb9e79f683189045338ab)) + + +### Documentation + +* **client:** fix httpx.Timeout documentation reference ([5e8cb3a](https://github.com/OneBusAway/python-sdk/commit/5e8cb3aa66d4a60f7e96d71cf5bbf2fedeb172ef)) + ## 1.12.1 (2025-06-13) Full Changelog: [v1.12.0...v1.12.1](https://github.com/OneBusAway/python-sdk/compare/v1.12.0...v1.12.1) diff --git a/pyproject.toml b/pyproject.toml index b688bce..fd7bf0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.12.1" +version = "1.12.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0dddedd..c1f99d9 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.12.1" # x-release-please-version +__version__ = "1.12.2" # x-release-please-version From 30eada97ab7083d960307901bb55ef931ff6b202 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Jun 2025 04:17:25 +0000 Subject: [PATCH 269/397] feat(client): add support for aiohttp --- README.md | 31 +++++++++++++ pyproject.toml | 2 + requirements-dev.lock | 27 ++++++++++++ requirements.lock | 27 ++++++++++++ src/onebusaway/__init__.py | 3 +- src/onebusaway/_base_client.py | 22 ++++++++++ .../test_agencies_with_coverage.py | 4 +- tests/api_resources/test_agency.py | 4 +- .../test_arrival_and_departure.py | 4 +- tests/api_resources/test_block.py | 4 +- tests/api_resources/test_config.py | 4 +- tests/api_resources/test_current_time.py | 4 +- .../test_report_problem_with_stop.py | 4 +- .../test_report_problem_with_trip.py | 4 +- tests/api_resources/test_route.py | 4 +- .../test_route_ids_for_agency.py | 4 +- tests/api_resources/test_routes_for_agency.py | 4 +- .../api_resources/test_routes_for_location.py | 4 +- .../api_resources/test_schedule_for_route.py | 4 +- tests/api_resources/test_schedule_for_stop.py | 4 +- tests/api_resources/test_search_for_route.py | 4 +- tests/api_resources/test_search_for_stop.py | 4 +- tests/api_resources/test_shape.py | 4 +- tests/api_resources/test_stop.py | 4 +- .../api_resources/test_stop_ids_for_agency.py | 4 +- tests/api_resources/test_stops_for_agency.py | 4 +- .../api_resources/test_stops_for_location.py | 4 +- tests/api_resources/test_stops_for_route.py | 4 +- tests/api_resources/test_trip.py | 4 +- tests/api_resources/test_trip_details.py | 4 +- tests/api_resources/test_trip_for_vehicle.py | 4 +- .../api_resources/test_trips_for_location.py | 4 +- tests/api_resources/test_trips_for_route.py | 4 +- .../api_resources/test_vehicles_for_agency.py | 4 +- tests/conftest.py | 43 ++++++++++++++++--- 35 files changed, 232 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index b30ea29..8502002 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,37 @@ asyncio.run(main()) Functionality between the synchronous and asynchronous clients is otherwise identical. +### With aiohttp + +By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend. + +You can enable this by installing `aiohttp`: + +```sh +# install from PyPI +pip install onebusaway[aiohttp] +``` + +Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: + +```python +import os +import asyncio +from onebusaway import DefaultAioHttpClient +from onebusaway import AsyncOnebusawaySDK + + +async def main() -> None: + async with AsyncOnebusawaySDK( + api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted + http_client=DefaultAioHttpClient(), + ) as client: + current_time = await client.current_time.retrieve() + + +asyncio.run(main()) +``` + ## Using types Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: diff --git a/pyproject.toml b/pyproject.toml index fd7bf0a..510bc34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,8 @@ classifiers = [ Homepage = "https://github.com/OneBusAway/python-sdk" Repository = "https://github.com/OneBusAway/python-sdk" +[project.optional-dependencies] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] [tool.rye] managed = true diff --git a/requirements-dev.lock b/requirements-dev.lock index e49ccf8..ced2807 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -10,6 +10,13 @@ # universal: false -e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via httpx-aiohttp + # via onebusaway +aiosignal==1.3.2 + # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 @@ -17,6 +24,10 @@ anyio==4.4.0 # via onebusaway argcomplete==3.1.2 # via nox +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp certifi==2023.7.22 # via httpcore # via httpx @@ -34,16 +45,23 @@ execnet==2.1.1 # via pytest-xdist filelock==3.12.4 # via virtualenv +frozenlist==1.6.2 + # via aiohttp + # via aiosignal h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx httpx==0.28.1 + # via httpx-aiohttp # via onebusaway # via respx +httpx-aiohttp==0.1.6 + # via onebusaway idna==3.4 # via anyio # via httpx + # via yarl importlib-metadata==7.0.0 iniconfig==2.0.0 # via pytest @@ -51,6 +69,9 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py +multidict==6.4.4 + # via aiohttp + # via yarl mypy==1.14.1 mypy-extensions==1.0.0 # via mypy @@ -65,6 +86,9 @@ platformdirs==3.11.0 # via virtualenv pluggy==1.5.0 # via pytest +propcache==0.3.1 + # via aiohttp + # via yarl pydantic==2.10.3 # via onebusaway pydantic-core==2.27.1 @@ -97,6 +121,7 @@ tomli==2.0.2 # via pytest typing-extensions==4.12.2 # via anyio + # via multidict # via mypy # via onebusaway # via pydantic @@ -104,5 +129,7 @@ typing-extensions==4.12.2 # via pyright virtualenv==20.24.5 # via nox +yarl==1.20.0 + # via aiohttp zipp==3.17.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index cf5c8e0..f41f1d4 100644 --- a/requirements.lock +++ b/requirements.lock @@ -10,11 +10,22 @@ # universal: false -e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via httpx-aiohttp + # via onebusaway +aiosignal==1.3.2 + # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx # via onebusaway +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp certifi==2023.7.22 # via httpcore # via httpx @@ -22,15 +33,28 @@ distro==1.8.0 # via onebusaway exceptiongroup==1.2.2 # via anyio +frozenlist==1.6.2 + # via aiohttp + # via aiosignal h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx httpx==0.28.1 + # via httpx-aiohttp + # via onebusaway +httpx-aiohttp==0.1.6 # via onebusaway idna==3.4 # via anyio # via httpx + # via yarl +multidict==6.4.4 + # via aiohttp + # via yarl +propcache==0.3.1 + # via aiohttp + # via yarl pydantic==2.10.3 # via onebusaway pydantic-core==2.27.1 @@ -40,6 +64,9 @@ sniffio==1.3.0 # via onebusaway typing-extensions==4.12.2 # via anyio + # via multidict # via onebusaway # via pydantic # via pydantic-core +yarl==1.20.0 + # via aiohttp diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index ea3444e..36af60f 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -36,7 +36,7 @@ UnprocessableEntityError, APIResponseValidationError, ) -from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient +from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging __all__ = [ @@ -78,6 +78,7 @@ "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient", + "DefaultAioHttpClient", ] if not _t.TYPE_CHECKING: diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 289eb37..0791689 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1289,6 +1289,24 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) +try: + import httpx_aiohttp +except ImportError: + + class _DefaultAioHttpClient(httpx.AsyncClient): + def __init__(self, **_kwargs: Any) -> None: + raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra") +else: + + class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + + super().__init__(**kwargs) + + if TYPE_CHECKING: DefaultAsyncHttpxClient = httpx.AsyncClient """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK @@ -1297,8 +1315,12 @@ def __init__(self, **kwargs: Any) -> None: This is useful because overriding the `http_client` with your own instance of `httpx.AsyncClient` will result in httpx's defaults being used, not ours. """ + + DefaultAioHttpClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`.""" else: DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + DefaultAioHttpClient = _DefaultAioHttpClient class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py index fad1087..b98f23a 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -44,7 +44,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index 05b83a8..d296efc 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index 0ba8109..88c379c 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -129,7 +129,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncArrivalAndDeparture: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py index a07a29b..86ba5c1 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncBlock: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py index 62bdd91..9b19317 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -44,7 +44,9 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncConfig: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py index 1a05528..39a3b20 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -44,7 +44,9 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncCurrentTime: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py index 0b15883..ce177c0 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -69,7 +69,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncReportProblemWithStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index 0bc9cf2..caa0730 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -74,7 +74,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncReportProblemWithTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index 8b773cf..8f52e08 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py index 867c19a..df9b4b9 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -57,7 +57,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncRouteIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 1fe2d56..9b2182e 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -57,7 +57,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncRoutesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 55fbc31..fda2be8 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -65,7 +65,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncRoutesForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index 6973a7e..bd6f15f 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -66,7 +66,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncScheduleForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py index 0154e44..2035e05 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -66,7 +66,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncScheduleForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index 76114f6..af87522 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -58,7 +58,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncSearchForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index bed17ea..d6357a6 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -58,7 +58,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncSearchForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py index 369da7d..ec2c031 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncShape: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py index 9286176..bb895b3 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py index 923a743..d7d48fe 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -57,7 +57,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncStopIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py index 7c6538e..c54df14 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -57,7 +57,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncStopsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index fcb2f07..091e788 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -65,7 +65,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncStopsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py index e062f7d..da8c3dd 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -66,7 +66,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncStopsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index ef2bd7f..3f2d180 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -57,7 +57,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py index 82d00d9..6041ff6 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -69,7 +69,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncTripDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py index be96fa6..44981c2 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -68,7 +68,9 @@ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: class TestAsyncTripForVehicle: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 050d552..236a09c 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -72,7 +72,9 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: class TestAsyncTripsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py index 0ef4092..c708aab 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -67,7 +67,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncTripsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py index 5f201f2..88e709c 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -65,7 +65,9 @@ def test_path_params_list(self, client: OnebusawaySDK) -> None: class TestAsyncVehiclesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: diff --git a/tests/conftest.py b/tests/conftest.py index fad4436..dd1366e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,10 +6,12 @@ import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator +import httpx import pytest from pytest_asyncio import is_async_test -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, DefaultAioHttpClient +from onebusaway._utils import is_dict if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] @@ -27,6 +29,19 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: for async_test in pytest_asyncio_tests: async_test.add_marker(session_scope_marker, append=False) + # We skip tests that use both the aiohttp client and respx_mock as respx_mock + # doesn't support custom transports. + for item in items: + if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames: + continue + + if not hasattr(item, "callspec"): + continue + + async_client_param = item.callspec.params.get("async_client") + if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp": + item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock")) + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -45,9 +60,25 @@ def client(request: FixtureRequest) -> Iterator[OnebusawaySDK]: @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOnebusawaySDK]: - strict = getattr(request, "param", True) - if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - - async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + param = getattr(request, "param", True) + + # defaults + strict = True + http_client: None | httpx.AsyncClient = None + + if isinstance(param, bool): + strict = param + elif is_dict(param): + strict = param.get("strict", True) + assert isinstance(strict, bool) + + http_client_type = param.get("http_client", "httpx") + if http_client_type == "aiohttp": + http_client = DefaultAioHttpClient() + else: + raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") + + async with AsyncOnebusawaySDK( + base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client + ) as client: yield client From 6a88517328513ff342df314e1d1da26795f3bb72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 04:25:52 +0000 Subject: [PATCH 270/397] chore(tests): skip some failing tests on the latest python versions --- tests/test_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 357cf79..ae9c4c2 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -192,6 +192,7 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") def test_copy_build_request(self) -> None: options = FinalRequestOptions(method="get", url="/foo") @@ -995,6 +996,7 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") def test_copy_build_request(self) -> None: options = FinalRequestOptions(method="get", url="/foo") From 32bbbb36efc1e3ebe55502aba1d140b0670e671c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 02:41:03 +0000 Subject: [PATCH 271/397] =?UTF-8?q?fix(ci):=20release-doctor=20=E2=80=94?= =?UTF-8?q?=20report=20correct=20token=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/check-release-environment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check-release-environment b/bin/check-release-environment index 7e1bf0e..b845b0f 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenErrors=${#errors[@]} From 6813fe1cff071ab693e8c686bae48e110dd6a222 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 02:45:10 +0000 Subject: [PATCH 272/397] release: 1.13.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a80c237..f94eeca 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.2" + ".": "1.13.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2072b87..6362bdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 1.13.0 (2025-06-27) + +Full Changelog: [v1.12.2...v1.13.0](https://github.com/OneBusAway/python-sdk/compare/v1.12.2...v1.13.0) + +### Features + +* **client:** add support for aiohttp ([30eada9](https://github.com/OneBusAway/python-sdk/commit/30eada97ab7083d960307901bb55ef931ff6b202)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([32bbbb3](https://github.com/OneBusAway/python-sdk/commit/32bbbb36efc1e3ebe55502aba1d140b0670e671c)) + + +### Chores + +* **tests:** skip some failing tests on the latest python versions ([6a88517](https://github.com/OneBusAway/python-sdk/commit/6a88517328513ff342df314e1d1da26795f3bb72)) + ## 1.12.2 (2025-06-19) Full Changelog: [v1.12.1...v1.12.2](https://github.com/OneBusAway/python-sdk/compare/v1.12.1...v1.12.2) diff --git a/pyproject.toml b/pyproject.toml index 510bc34..e59c212 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.12.2" +version = "1.13.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c1f99d9..6ef7cb3 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.12.2" # x-release-please-version +__version__ = "1.13.0" # x-release-please-version From e15aec647d9bdbcbd061158740afa8df57f0d41c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:39:34 +0000 Subject: [PATCH 273/397] chore(ci): only run for pushes and fork pull requests --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fc1ed3..0e26491 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -42,6 +43,7 @@ jobs: contents: read id-token: write runs-on: depot-ubuntu-24.04 + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -62,6 +64,7 @@ jobs: timeout-minutes: 10 name: test runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 From 1b938b23923b4ee59453b26a896747bd7f4d0386 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 02:36:11 +0000 Subject: [PATCH 274/397] fix(ci): correct conditional --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e26491..4676f3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,14 +36,13 @@ jobs: run: ./scripts/lint upload: - if: github.repository == 'stainless-sdks/open-transit-python' + if: github.repository == 'stainless-sdks/open-transit-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) timeout-minutes: 10 name: upload permissions: contents: read id-token: write runs-on: depot-ubuntu-24.04 - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 From add541c1c196ef11b5ae310d0944b39f476915b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 05:11:26 +0000 Subject: [PATCH 275/397] chore(ci): change upload type --- .github/workflows/ci.yml | 18 ++++++++++++++++-- scripts/utils/upload-artifact.sh | 12 +++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4676f3c..50652f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,10 +35,10 @@ jobs: - name: Run lints run: ./scripts/lint - upload: + build: if: github.repository == 'stainless-sdks/open-transit-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) timeout-minutes: 10 - name: upload + name: build permissions: contents: read id-token: write @@ -46,6 +46,20 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features + + - name: Run build + run: rye build + - name: Get GitHub OIDC Token id: github-oidc uses: actions/github-script@v6 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 20d2cbf..33686cc 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash set -exuo pipefail -RESPONSE=$(curl -X POST "$URL" \ +FILENAME=$(basename dist/*.whl) + +RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ -H "Authorization: Bearer $AUTH" \ -H "Content-Type: application/json") @@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ - -H "Content-Type: application/gzip" \ - --data-binary @- "$SIGNED_URL" 2>&1) +UPLOAD_RESPONSE=$(curl -v -X PUT \ + -H "Content-Type: binary/octet-stream" \ + --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1) if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/open-transit-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/open-transit-python/$SHA/$FILENAME'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 From d0e936e10c6c8b23e0111ac6e85b2af8f9443624 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 05:12:19 +0000 Subject: [PATCH 276/397] release: 1.13.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f94eeca..734ad79 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.0" + ".": "1.13.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6362bdd..db74998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 1.13.1 (2025-07-02) + +Full Changelog: [v1.13.0...v1.13.1](https://github.com/OneBusAway/python-sdk/compare/v1.13.0...v1.13.1) + +### Bug Fixes + +* **ci:** correct conditional ([1b938b2](https://github.com/OneBusAway/python-sdk/commit/1b938b23923b4ee59453b26a896747bd7f4d0386)) + + +### Chores + +* **ci:** change upload type ([add541c](https://github.com/OneBusAway/python-sdk/commit/add541c1c196ef11b5ae310d0944b39f476915b0)) +* **ci:** only run for pushes and fork pull requests ([e15aec6](https://github.com/OneBusAway/python-sdk/commit/e15aec647d9bdbcbd061158740afa8df57f0d41c)) + ## 1.13.0 (2025-06-27) Full Changelog: [v1.12.2...v1.13.0](https://github.com/OneBusAway/python-sdk/compare/v1.12.2...v1.13.0) diff --git a/pyproject.toml b/pyproject.toml index e59c212..d91f206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.0" +version = "1.13.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6ef7cb3..55b8462 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.0" # x-release-please-version +__version__ = "1.13.1" # x-release-please-version From b017c04d3b411ec13e528851f32c850839c3274d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 5 Jul 2025 22:12:35 +0000 Subject: [PATCH 277/397] chore(internal): version bump --- requirements-dev.lock | 2 +- requirements.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index ced2807..45d28b1 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -56,7 +56,7 @@ httpx==0.28.1 # via httpx-aiohttp # via onebusaway # via respx -httpx-aiohttp==0.1.6 +httpx-aiohttp==0.1.8 # via onebusaway idna==3.4 # via anyio diff --git a/requirements.lock b/requirements.lock index f41f1d4..3255423 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.2 httpx==0.28.1 # via httpx-aiohttp # via onebusaway -httpx-aiohttp==0.1.6 +httpx-aiohttp==0.1.8 # via onebusaway idna==3.4 # via anyio From b4d8c5c9d31c8051b448497f3fb828393b8bbc4a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 5 Jul 2025 22:12:51 +0000 Subject: [PATCH 278/397] release: 1.13.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 734ad79..690002d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.1" + ".": "1.13.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index db74998..b8d3438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.13.2 (2025-07-05) + +Full Changelog: [v1.13.1...v1.13.2](https://github.com/OneBusAway/python-sdk/compare/v1.13.1...v1.13.2) + +### Chores + +* **internal:** version bump ([b017c04](https://github.com/OneBusAway/python-sdk/commit/b017c04d3b411ec13e528851f32c850839c3274d)) + ## 1.13.1 (2025-07-02) Full Changelog: [v1.13.0...v1.13.1](https://github.com/OneBusAway/python-sdk/compare/v1.13.0...v1.13.1) diff --git a/pyproject.toml b/pyproject.toml index d91f206..72ce4f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.1" +version = "1.13.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 55b8462..51fe0a2 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.1" # x-release-please-version +__version__ = "1.13.2" # x-release-please-version From 495b65dad98321a877258bdd87872357c245f9cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 02:37:14 +0000 Subject: [PATCH 279/397] chore(internal): bump pinned h11 dep --- requirements-dev.lock | 4 ++-- requirements.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 45d28b1..f680d83 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,9 +48,9 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal -h11==0.14.0 +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx httpx==0.28.1 # via httpx-aiohttp diff --git a/requirements.lock b/requirements.lock index 3255423..251a981 100644 --- a/requirements.lock +++ b/requirements.lock @@ -36,9 +36,9 @@ exceptiongroup==1.2.2 frozenlist==1.6.2 # via aiohttp # via aiosignal -h11==0.14.0 +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx httpx==0.28.1 # via httpx-aiohttp From 404807c5890115889c90bc1236f9ca0b57a426c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 02:56:51 +0000 Subject: [PATCH 280/397] chore(package): mark python 3.13 as supported --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 72ce4f7..799da50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", From 9125d1d97ea9029871b775eff2947ed191ea407f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 02:57:23 +0000 Subject: [PATCH 281/397] release: 1.13.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 690002d..c4bf1b6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.2" + ".": "1.13.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d3438..4d5bb6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.13.3 (2025-07-09) + +Full Changelog: [v1.13.2...v1.13.3](https://github.com/OneBusAway/python-sdk/compare/v1.13.2...v1.13.3) + +### Chores + +* **internal:** bump pinned h11 dep ([495b65d](https://github.com/OneBusAway/python-sdk/commit/495b65dad98321a877258bdd87872357c245f9cf)) +* **package:** mark python 3.13 as supported ([404807c](https://github.com/OneBusAway/python-sdk/commit/404807c5890115889c90bc1236f9ca0b57a426c8)) + ## 1.13.2 (2025-07-05) Full Changelog: [v1.13.1...v1.13.2](https://github.com/OneBusAway/python-sdk/compare/v1.13.1...v1.13.2) diff --git a/pyproject.toml b/pyproject.toml index 799da50..9c3bfbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.2" +version = "1.13.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 51fe0a2..e8baf0c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.2" # x-release-please-version +__version__ = "1.13.3" # x-release-please-version From d1bb078b61f81f9f5192505e08cea3dc7df136f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 02:52:01 +0000 Subject: [PATCH 282/397] fix(parsing): correctly handle nested discriminated unions --- src/onebusaway/_models.py | 13 ++++++----- tests/test_models.py | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 4f21498..528d568 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -2,9 +2,10 @@ import os import inspect -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast +from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( + List, Unpack, Literal, ClassVar, @@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") - return construct_type(value=value, type_=type_) + return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) def is_basemodel(type_: type) -> bool: @@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: return cast(_T, construct_type(value=value, type_=type_)) -def construct_type(*, value: object, type_: object) -> object: +def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object: """Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned as-is. @@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object: type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(type_): - meta: tuple[Any, ...] = get_args(type_)[1:] + if metadata is not None: + meta: tuple[Any, ...] = tuple(metadata) + elif is_annotated_type(type_): + meta = get_args(type_)[1:] type_ = extract_type_arg(type_, 0) else: meta = tuple() diff --git a/tests/test_models.py b/tests/test_models.py index 38568b6..37d2acf 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -889,3 +889,48 @@ class ModelB(BaseModel): ) assert isinstance(m, ModelB) + + +def test_nested_discriminated_union() -> None: + class InnerType1(BaseModel): + type: Literal["type_1"] + + class InnerModel(BaseModel): + inner_value: str + + class InnerType2(BaseModel): + type: Literal["type_2"] + some_inner_model: InnerModel + + class Type1(BaseModel): + base_type: Literal["base_type_1"] + value: Annotated[ + Union[ + InnerType1, + InnerType2, + ], + PropertyInfo(discriminator="type"), + ] + + class Type2(BaseModel): + base_type: Literal["base_type_2"] + + T = Annotated[ + Union[ + Type1, + Type2, + ], + PropertyInfo(discriminator="base_type"), + ] + + model = construct_type( + type_=T, + value={ + "base_type": "base_type_1", + "value": { + "type": "type_2", + }, + }, + ) + assert isinstance(model, Type1) + assert isinstance(model.value, InnerType2) From be868e5e64c9c022c1955a9da319c62d564a7dbc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 02:52:34 +0000 Subject: [PATCH 283/397] release: 1.13.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c4bf1b6..0d3c59d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.3" + ".": "1.13.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5bb6f..854a955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.13.4 (2025-07-10) + +Full Changelog: [v1.13.3...v1.13.4](https://github.com/OneBusAway/python-sdk/compare/v1.13.3...v1.13.4) + +### Bug Fixes + +* **parsing:** correctly handle nested discriminated unions ([d1bb078](https://github.com/OneBusAway/python-sdk/commit/d1bb078b61f81f9f5192505e08cea3dc7df136f4)) + ## 1.13.3 (2025-07-09) Full Changelog: [v1.13.2...v1.13.3](https://github.com/OneBusAway/python-sdk/compare/v1.13.2...v1.13.3) diff --git a/pyproject.toml b/pyproject.toml index 9c3bfbd..67e58e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.3" +version = "1.13.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index e8baf0c..e423715 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.3" # x-release-please-version +__version__ = "1.13.4" # x-release-please-version From e29e75dcc69ffc9b0c434cf556cfa9b5b374d7a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 03:11:23 +0000 Subject: [PATCH 284/397] chore(readme): fix version rendering on pypi --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8502002..956e80d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # OneBusAway SDK Python API library -[![PyPI version]()](https://pypi.org/project/onebusaway/) + +[![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg?label=pypi%20(stable))](https://pypi.org/project/onebusaway/) The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.8+ From 935e2d25ec8736de5b30d7653c2e85fd5620a45d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 02:17:21 +0000 Subject: [PATCH 285/397] fix(client): don't send Content-Type header on GET requests --- pyproject.toml | 2 +- src/onebusaway/_base_client.py | 11 +++++++++-- tests/test_client.py | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67e58e4..df95823 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/OneBusAway/python-sdk" Repository = "https://github.com/OneBusAway/python-sdk" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] [tool.rye] managed = true diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 0791689..7146997 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -529,6 +529,15 @@ def _build_request( # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + is_body_allowed = options.method.lower() != "get" + + if is_body_allowed: + kwargs["json"] = json_data if is_given(json_data) else None + kwargs["files"] = files + else: + headers.pop("Content-Type", None) + kwargs.pop("data", None) + # TODO: report this error to httpx return self._client.build_request( # pyright: ignore[reportUnknownMemberType] headers=headers, @@ -540,8 +549,6 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data if is_given(json_data) else None, - files=files, **kwargs, ) diff --git a/tests/test_client.py b/tests/test_client.py index ae9c4c2..3e5bd95 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -455,7 +455,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, @@ -1258,7 +1258,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, From add797a6dde9f26c978d1cfb19662fa4e09b1a01 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 02:17:59 +0000 Subject: [PATCH 286/397] release: 1.13.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0d3c59d..797bb33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.4" + ".": "1.13.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 854a955..6f8b0fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.13.5 (2025-07-12) + +Full Changelog: [v1.13.4...v1.13.5](https://github.com/OneBusAway/python-sdk/compare/v1.13.4...v1.13.5) + +### Bug Fixes + +* **client:** don't send Content-Type header on GET requests ([935e2d2](https://github.com/OneBusAway/python-sdk/commit/935e2d25ec8736de5b30d7653c2e85fd5620a45d)) + + +### Chores + +* **readme:** fix version rendering on pypi ([e29e75d](https://github.com/OneBusAway/python-sdk/commit/e29e75dcc69ffc9b0c434cf556cfa9b5b374d7a4)) + ## 1.13.4 (2025-07-10) Full Changelog: [v1.13.3...v1.13.4](https://github.com/OneBusAway/python-sdk/compare/v1.13.3...v1.13.4) diff --git a/pyproject.toml b/pyproject.toml index df95823..c01bc4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.4" +version = "1.13.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index e423715..ac4af0a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.4" # x-release-please-version +__version__ = "1.13.5" # x-release-please-version From ecac1f6610cdae3cde3a0f982c4bc11192a5a809 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 02:17:10 +0000 Subject: [PATCH 287/397] feat: clean up environment call outs --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 956e80d..66f764f 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,6 @@ pip install onebusaway[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python -import os import asyncio from onebusaway import DefaultAioHttpClient from onebusaway import AsyncOnebusawaySDK @@ -87,7 +86,7 @@ from onebusaway import AsyncOnebusawaySDK async def main() -> None: async with AsyncOnebusawaySDK( - api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted + api_key="My API Key", http_client=DefaultAioHttpClient(), ) as client: current_time = await client.current_time.retrieve() From 70de5c82446220b38fcfcfcc318c71de917add63 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 02:18:25 +0000 Subject: [PATCH 288/397] release: 1.14.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 797bb33..e72f113 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.5" + ".": "1.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f8b0fe..ff2cf72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.14.0 (2025-07-15) + +Full Changelog: [v1.13.5...v1.14.0](https://github.com/OneBusAway/python-sdk/compare/v1.13.5...v1.14.0) + +### Features + +* clean up environment call outs ([ecac1f6](https://github.com/OneBusAway/python-sdk/commit/ecac1f6610cdae3cde3a0f982c4bc11192a5a809)) + ## 1.13.5 (2025-07-12) Full Changelog: [v1.13.4...v1.13.5](https://github.com/OneBusAway/python-sdk/compare/v1.13.4...v1.13.5) diff --git a/pyproject.toml b/pyproject.toml index c01bc4f..162c185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.13.5" +version = "1.14.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ac4af0a..aa78ce6 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.13.5" # x-release-please-version +__version__ = "1.14.0" # x-release-please-version From eef0db25134ae51703d4560860a984ddc603e114 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 02:22:08 +0000 Subject: [PATCH 289/397] fix(parsing): ignore empty metadata --- src/onebusaway/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 528d568..ffcbf67 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -439,7 +439,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if metadata is not None: + if metadata is not None and len(metadata) > 0: meta: tuple[Any, ...] = tuple(metadata) elif is_annotated_type(type_): meta = get_args(type_)[1:] From e477fc84dbc063d64fc6983e243f0a41a6dfd07c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 02:24:45 +0000 Subject: [PATCH 290/397] fix(parsing): parse extra field types --- src/onebusaway/_models.py | 25 +++++++++++++++++++++++-- tests/test_models.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index ffcbf67..b8387ce 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -208,14 +208,18 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] else: fields_values[name] = field_get_default(field) + extra_field_type = _get_extra_fields_type(__cls) + _extra = {} for key, value in values.items(): if key not in model_fields: + parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value + if PYDANTIC_V2: - _extra[key] = value + _extra[key] = parsed else: _fields_set.add(key) - fields_values[key] = value + fields_values[key] = parsed object.__setattr__(m, "__dict__", fields_values) @@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) +def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: + if not PYDANTIC_V2: + # TODO + return None + + schema = cls.__pydantic_core_schema__ + if schema["type"] == "model": + fields = schema["schema"] + if fields["type"] == "model-fields": + extras = fields.get("extras_schema") + if extras and "cls" in extras: + # mypy can't narrow the type + return extras["cls"] # type: ignore[no-any-return] + + return None + + def is_basemodel(type_: type) -> bool: """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" if is_union(type_): diff --git a/tests/test_models.py b/tests/test_models.py index 37d2acf..6c410fe 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,5 +1,5 @@ import json -from typing import Any, Dict, List, Union, Optional, cast +from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone from typing_extensions import Literal, Annotated, TypeAliasType @@ -934,3 +934,30 @@ class Type2(BaseModel): ) assert isinstance(model, Type1) assert isinstance(model.value, InnerType2) + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +def test_extra_properties() -> None: + class Item(BaseModel): + prop: int + + class Model(BaseModel): + __pydantic_extra__: Dict[str, Item] = Field(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + other: str + + if TYPE_CHECKING: + + def __getattr__(self, attr: str) -> Item: ... + + model = construct_type( + type_=Model, + value={ + "a": {"prop": 1}, + "other": "foo", + }, + ) + assert isinstance(model, Model) + assert model.a.prop == 1 + assert isinstance(model.a, Item) + assert model.other == "foo" From cff7a5f8d254ac8140093413b4602103d7185bf3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 02:25:21 +0000 Subject: [PATCH 291/397] release: 1.14.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e72f113..a780111 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.14.0" + ".": "1.14.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2cf72..cd7d3e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.14.1 (2025-07-23) + +Full Changelog: [v1.14.0...v1.14.1](https://github.com/OneBusAway/python-sdk/compare/v1.14.0...v1.14.1) + +### Bug Fixes + +* **parsing:** ignore empty metadata ([eef0db2](https://github.com/OneBusAway/python-sdk/commit/eef0db25134ae51703d4560860a984ddc603e114)) +* **parsing:** parse extra field types ([e477fc8](https://github.com/OneBusAway/python-sdk/commit/e477fc84dbc063d64fc6983e243f0a41a6dfd07c)) + ## 1.14.0 (2025-07-15) Full Changelog: [v1.13.5...v1.14.0](https://github.com/OneBusAway/python-sdk/compare/v1.13.5...v1.14.0) diff --git a/pyproject.toml b/pyproject.toml index 162c185..91c1e98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.14.0" +version = "1.14.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index aa78ce6..c7de9bf 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.14.0" # x-release-please-version +__version__ = "1.14.1" # x-release-please-version From 995b6d4a9aea939ac187f802cf330a0db134997d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 05:25:11 +0000 Subject: [PATCH 292/397] chore(project): add settings file for vscode --- .gitignore | 1 - .vscode/settings.json | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 8779740..95ceb18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .prism.log -.vscode _dev __pycache__ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5b01030 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.importFormat": "relative", +} From d575add1e09c34c31d1bfeb2ef47dad6b646a6c6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 05:25:29 +0000 Subject: [PATCH 293/397] release: 1.14.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a780111..19cc6ed 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.14.1" + ".": "1.14.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cd7d3e6..0da3058 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.14.2 (2025-07-25) + +Full Changelog: [v1.14.1...v1.14.2](https://github.com/OneBusAway/python-sdk/compare/v1.14.1...v1.14.2) + +### Chores + +* **project:** add settings file for vscode ([995b6d4](https://github.com/OneBusAway/python-sdk/commit/995b6d4a9aea939ac187f802cf330a0db134997d)) + ## 1.14.1 (2025-07-23) Full Changelog: [v1.14.0...v1.14.1](https://github.com/OneBusAway/python-sdk/compare/v1.14.0...v1.14.1) diff --git a/pyproject.toml b/pyproject.toml index 91c1e98..b8950c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.14.1" +version = "1.14.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c7de9bf..dc93922 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.14.1" # x-release-please-version +__version__ = "1.14.2" # x-release-please-version From 27cab1813ce2774ca1a88856190898d28b303c00 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 07:34:29 +0000 Subject: [PATCH 294/397] feat(client): support file upload requests --- src/onebusaway/_base_client.py | 5 ++++- src/onebusaway/_files.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 7146997..52421d4 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -532,7 +532,10 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - kwargs["json"] = json_data if is_given(json_data) else None + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py index 715cc20..cc14c14 100644 --- a/src/onebusaway/_files.py +++ b/src/onebusaway/_files.py @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() From 2be0d97c630b9a321c5532c9b3a7fa80a4a68265 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 07:34:49 +0000 Subject: [PATCH 295/397] release: 1.15.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19cc6ed..7ccfe12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.14.2" + ".": "1.15.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da3058..5a9fd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.15.0 (2025-07-31) + +Full Changelog: [v1.14.2...v1.15.0](https://github.com/OneBusAway/python-sdk/compare/v1.14.2...v1.15.0) + +### Features + +* **client:** support file upload requests ([27cab18](https://github.com/OneBusAway/python-sdk/commit/27cab1813ce2774ca1a88856190898d28b303c00)) + ## 1.14.2 (2025-07-25) Full Changelog: [v1.14.1...v1.14.2](https://github.com/OneBusAway/python-sdk/compare/v1.14.1...v1.14.2) diff --git a/pyproject.toml b/pyproject.toml index b8950c4..6a0aff2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.14.2" +version = "1.15.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index dc93922..5107102 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.14.2" # x-release-please-version +__version__ = "1.15.0" # x-release-please-version From 5d8b092137e533550f599dc96b42202c9057d35c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 09:21:04 +0000 Subject: [PATCH 296/397] chore(internal): fix ruff target version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6a0aff2..c7410de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ reportPrivateUsage = false [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" [tool.ruff.format] docstring-code-format = true From ccb0979ac49cd5ffe57b1e7dda927cebd7f9ceba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 09:21:24 +0000 Subject: [PATCH 297/397] release: 1.15.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7ccfe12..daf6a33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.0" + ".": "1.15.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a9fd20..d90159a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.15.1 (2025-08-06) + +Full Changelog: [v1.15.0...v1.15.1](https://github.com/OneBusAway/python-sdk/compare/v1.15.0...v1.15.1) + +### Chores + +* **internal:** fix ruff target version ([5d8b092](https://github.com/OneBusAway/python-sdk/commit/5d8b092137e533550f599dc96b42202c9057d35c)) + ## 1.15.0 (2025-07-31) Full Changelog: [v1.14.2...v1.15.0](https://github.com/OneBusAway/python-sdk/compare/v1.14.2...v1.15.0) diff --git a/pyproject.toml b/pyproject.toml index c7410de..f8573c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.0" +version = "1.15.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 5107102..08dc048 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.0" # x-release-please-version +__version__ = "1.15.1" # x-release-please-version From af3e4cf8c736a9dd2da2b348a55c75721e2537be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 05:24:31 +0000 Subject: [PATCH 298/397] chore: update @stainless-api/prism-cli to v5.15.0 --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index d2814ae..0b28f6e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi From b0cd25ccb53b773dd3df52aaf01f4d4c7cd48c60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 05:30:06 +0000 Subject: [PATCH 299/397] chore(internal): update comment in script --- scripts/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test b/scripts/test index 2b87845..dbeda2d 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 From 7226614d799ac292e3eff6dd8836e246bd14e514 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 03:21:59 +0000 Subject: [PATCH 300/397] release: 1.15.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index daf6a33..d7d98ef 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.1" + ".": "1.15.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d90159a..47d4daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.15.2 (2025-08-10) + +Full Changelog: [v1.15.1...v1.15.2](https://github.com/OneBusAway/python-sdk/compare/v1.15.1...v1.15.2) + +### Chores + +* **internal:** update comment in script ([b0cd25c](https://github.com/OneBusAway/python-sdk/commit/b0cd25ccb53b773dd3df52aaf01f4d4c7cd48c60)) +* update @stainless-api/prism-cli to v5.15.0 ([af3e4cf](https://github.com/OneBusAway/python-sdk/commit/af3e4cf8c736a9dd2da2b348a55c75721e2537be)) + ## 1.15.1 (2025-08-06) Full Changelog: [v1.15.0...v1.15.1](https://github.com/OneBusAway/python-sdk/compare/v1.15.0...v1.15.1) diff --git a/pyproject.toml b/pyproject.toml index f8573c9..2c51caa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.1" +version = "1.15.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 08dc048..ae22d19 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.1" # x-release-please-version +__version__ = "1.15.2" # x-release-please-version From f1e8695c9f221b19dbeb9f0fa0fb9fd1aa9b9959 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 07:35:29 +0000 Subject: [PATCH 301/397] chore: update github action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50652f7..faf33b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/open-transit-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: @@ -61,12 +61,14 @@ jobs: run: rye build - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/open-transit-python' id: github-oidc uses: actions/github-script@v6 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball + if: github.repository == 'stainless-sdks/open-transit-python' env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From 0225ca83be2a3f4c8466ab9416340c1bb8919daa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 06:02:00 +0000 Subject: [PATCH 302/397] chore(internal): change ci workflow machines --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faf33b1..3a957cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: permissions: contents: read id-token: write - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From e3146cbbf2a72256b96ba79b25ceece5926214b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 06:02:22 +0000 Subject: [PATCH 303/397] release: 1.15.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d7d98ef..9e39cab 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.2" + ".": "1.15.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d4daa..42f4eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.15.3 (2025-08-26) + +Full Changelog: [v1.15.2...v1.15.3](https://github.com/OneBusAway/python-sdk/compare/v1.15.2...v1.15.3) + +### Chores + +* **internal:** change ci workflow machines ([0225ca8](https://github.com/OneBusAway/python-sdk/commit/0225ca83be2a3f4c8466ab9416340c1bb8919daa)) +* update github action ([f1e8695](https://github.com/OneBusAway/python-sdk/commit/f1e8695c9f221b19dbeb9f0fa0fb9fd1aa9b9959)) + ## 1.15.2 (2025-08-10) Full Changelog: [v1.15.1...v1.15.2](https://github.com/OneBusAway/python-sdk/compare/v1.15.1...v1.15.2) diff --git a/pyproject.toml b/pyproject.toml index 2c51caa..8c71cd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.2" +version = "1.15.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ae22d19..47f599e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.2" # x-release-please-version +__version__ = "1.15.3" # x-release-please-version From 4100abbcad60289bd7e9e8b4215e2e319f82fc55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 08:46:14 +0000 Subject: [PATCH 304/397] fix: avoid newer type syntax --- src/onebusaway/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index b8387ce..92f7c10 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -304,7 +304,7 @@ def model_dump( exclude_none=exclude_none, ) - return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped @override def model_dump_json( From c71f41b6ae8c1f774d1a70407815f5fb0f34e810 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 08:51:23 +0000 Subject: [PATCH 305/397] chore(internal): update pyright exclude list --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 8c71cd0..7ae9ead 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,6 +148,7 @@ exclude = [ "_dev", ".venv", ".nox", + ".git", ] reportImplicitOverride = true From 388f030c662a5fee5136de73f06a76768ac44653 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 08:51:43 +0000 Subject: [PATCH 306/397] release: 1.15.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9e39cab..5304dec 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.3" + ".": "1.15.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 42f4eb2..31a2f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.15.4 (2025-08-27) + +Full Changelog: [v1.15.3...v1.15.4](https://github.com/OneBusAway/python-sdk/compare/v1.15.3...v1.15.4) + +### Bug Fixes + +* avoid newer type syntax ([4100abb](https://github.com/OneBusAway/python-sdk/commit/4100abbcad60289bd7e9e8b4215e2e319f82fc55)) + + +### Chores + +* **internal:** update pyright exclude list ([c71f41b](https://github.com/OneBusAway/python-sdk/commit/c71f41b6ae8c1f774d1a70407815f5fb0f34e810)) + ## 1.15.3 (2025-08-26) Full Changelog: [v1.15.2...v1.15.3](https://github.com/OneBusAway/python-sdk/compare/v1.15.2...v1.15.3) diff --git a/pyproject.toml b/pyproject.toml index 7ae9ead..3928557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.3" +version = "1.15.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 47f599e..03d038f 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.3" # x-release-please-version +__version__ = "1.15.4" # x-release-please-version From 767a34a8634d836ec05bc577e640df14416dd9c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 04:33:40 +0000 Subject: [PATCH 307/397] chore(internal): add Sequence related utils --- src/onebusaway/_types.py | 36 ++++++++++++++++++++++++++++++- src/onebusaway/_utils/__init__.py | 1 + src/onebusaway/_utils/_typing.py | 5 +++++ tests/utils.py | 10 ++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index cbe6c70..057d697 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -13,10 +13,21 @@ Mapping, TypeVar, Callable, + Iterator, Optional, Sequence, ) -from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, +) import httpx import pydantic @@ -217,3 +228,26 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... + def __contains__(self, value: object, /) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T_co]: ... + def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... + def count(self, value: Any, /) -> int: ... + def __reversed__(self) -> Iterator[_T_co]: ... +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py index d4fda26..ca547ce 100644 --- a/src/onebusaway/_utils/__init__.py +++ b/src/onebusaway/_utils/__init__.py @@ -38,6 +38,7 @@ extract_type_arg as extract_type_arg, is_iterable_type as is_iterable_type, is_required_type as is_required_type, + is_sequence_type as is_sequence_type, is_annotated_type as is_annotated_type, is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 1bac954..845cd6b 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool: return (get_origin(typ) or typ) == list +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + def is_iterable_type(typ: type) -> bool: """If the given type is `typing.Iterable[T]`""" origin = get_origin(typ) or typ diff --git a/tests/utils.py b/tests/utils.py index 37ee5d0..a6008de 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,7 +4,7 @@ import inspect import traceback import contextlib -from typing import Any, TypeVar, Iterator, cast +from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type @@ -15,6 +15,7 @@ is_list_type, is_union_type, extract_type_arg, + is_sequence_type, is_annotated_type, is_type_alias_type, ) @@ -71,6 +72,13 @@ def assert_matches_type( if is_list_type(type_): return _assert_list_type(type_, value) + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + if origin == str: assert isinstance(value, str) elif origin == int: From 0d9448a255691c72264c3c5e55d4ceaa46496c80 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 04:33:58 +0000 Subject: [PATCH 308/397] release: 1.15.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5304dec..b2717bb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.4" + ".": "1.15.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a2f3e..458ec16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.15.5 (2025-08-30) + +Full Changelog: [v1.15.4...v1.15.5](https://github.com/OneBusAway/python-sdk/compare/v1.15.4...v1.15.5) + +### Chores + +* **internal:** add Sequence related utils ([767a34a](https://github.com/OneBusAway/python-sdk/commit/767a34a8634d836ec05bc577e640df14416dd9c2)) + ## 1.15.4 (2025-08-27) Full Changelog: [v1.15.3...v1.15.4](https://github.com/OneBusAway/python-sdk/compare/v1.15.3...v1.15.4) diff --git a/pyproject.toml b/pyproject.toml index 3928557..ede2518 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.4" +version = "1.15.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 03d038f..54fc002 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.4" # x-release-please-version +__version__ = "1.15.5" # x-release-please-version From 810c88dfa53496c5d0c0b913cf1944da6de86185 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 03:55:54 +0000 Subject: [PATCH 309/397] feat(types): replace List[str] with SequenceNotStr in params --- src/onebusaway/_utils/_transform.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index b0cc20a..f0bcefd 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -16,6 +16,7 @@ lru_cache, is_mapping, is_iterable, + is_sequence, ) from .._files import is_base64_file_input from ._typing import ( @@ -24,6 +25,7 @@ extract_type_arg, is_iterable_type, is_required_type, + is_sequence_type, is_annotated_type, strip_annotated_type, ) @@ -184,6 +186,8 @@ def _transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. @@ -346,6 +350,8 @@ async def _async_transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. From 211acfe234c7d9aa363191cbcaabe7ade246147e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 03:56:11 +0000 Subject: [PATCH 310/397] release: 1.16.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b2717bb..bc845f3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.5" + ".": "1.16.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 458ec16..137747e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.16.0 (2025-09-03) + +Full Changelog: [v1.15.5...v1.16.0](https://github.com/OneBusAway/python-sdk/compare/v1.15.5...v1.16.0) + +### Features + +* **types:** replace List[str] with SequenceNotStr in params ([810c88d](https://github.com/OneBusAway/python-sdk/commit/810c88dfa53496c5d0c0b913cf1944da6de86185)) + ## 1.15.5 (2025-08-30) Full Changelog: [v1.15.4...v1.15.5](https://github.com/OneBusAway/python-sdk/compare/v1.15.4...v1.15.5) diff --git a/pyproject.toml b/pyproject.toml index ede2518..d70d923 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.5" +version = "1.16.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 54fc002..af59124 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.15.5" # x-release-please-version +__version__ = "1.16.0" # x-release-please-version From 1b63906456bd2aecd39460d9b12bf45a063b7392 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 04:11:15 +0000 Subject: [PATCH 311/397] feat: improve future compat with pydantic v3 --- src/onebusaway/_base_client.py | 6 +- src/onebusaway/_compat.py | 96 ++++++++-------- src/onebusaway/_models.py | 80 ++++++------- src/onebusaway/_utils/__init__.py | 10 +- src/onebusaway/_utils/_compat.py | 45 ++++++++ src/onebusaway/_utils/_datetime_parse.py | 136 +++++++++++++++++++++++ src/onebusaway/_utils/_transform.py | 6 +- src/onebusaway/_utils/_typing.py | 2 +- src/onebusaway/_utils/_utils.py | 1 - tests/test_models.py | 48 ++++---- tests/test_transform.py | 16 +-- tests/test_utils/test_datetime_parse.py | 110 ++++++++++++++++++ tests/utils.py | 8 +- 13 files changed, 432 insertions(+), 132 deletions(-) create mode 100644 src/onebusaway/_utils/_compat.py create mode 100644 src/onebusaway/_utils/_datetime_parse.py create mode 100644 tests/test_utils/test_datetime_parse.py diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 52421d4..e9c5fb6 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -59,7 +59,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._compat import PYDANTIC_V1, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -232,7 +232,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -320,7 +320,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 92d9ee6..bdef67f 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -12,14 +12,13 @@ _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) -# --------------- Pydantic v2 compatibility --------------- +# --------------- Pydantic v2, v3 compatibility --------------- # Pyright incorrectly reports some of our functions as overriding a method when they don't # pyright: reportIncompatibleMethodOverride=false -PYDANTIC_V2 = pydantic.VERSION.startswith("2.") +PYDANTIC_V1 = pydantic.VERSION.startswith("1.") -# v1 re-exports if TYPE_CHECKING: def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 @@ -44,90 +43,92 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 ... else: - if PYDANTIC_V2: - from pydantic.v1.typing import ( + # v1 re-exports + if PYDANTIC_V1: + from pydantic.typing import ( get_args as get_args, is_union as is_union, get_origin as get_origin, is_typeddict as is_typeddict, is_literal_type as is_literal_type, ) - from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import ( + from ._utils import ( get_args as get_args, is_union as is_union, get_origin as get_origin, + parse_date as parse_date, is_typeddict as is_typeddict, + parse_datetime as parse_datetime, is_literal_type as is_literal_type, ) - from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config if TYPE_CHECKING: from pydantic import ConfigDict as ConfigDict else: - if PYDANTIC_V2: - from pydantic import ConfigDict - else: + if PYDANTIC_V1: # TODO: provide an error message here? ConfigDict = None + else: + from pydantic import ConfigDict as ConfigDict # renamed methods / properties def parse_obj(model: type[_ModelT], value: object) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(value) - else: + if PYDANTIC_V1: return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + else: + return model.model_validate(value) def field_is_required(field: FieldInfo) -> bool: - if PYDANTIC_V2: - return field.is_required() - return field.required # type: ignore + if PYDANTIC_V1: + return field.required # type: ignore + return field.is_required() def field_get_default(field: FieldInfo) -> Any: value = field.get_default() - if PYDANTIC_V2: - from pydantic_core import PydanticUndefined - - if value == PydanticUndefined: - return None + if PYDANTIC_V1: return value + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None return value def field_outer_type(field: FieldInfo) -> Any: - if PYDANTIC_V2: - return field.annotation - return field.outer_type_ # type: ignore + if PYDANTIC_V1: + return field.outer_type_ # type: ignore + return field.annotation def get_model_config(model: type[pydantic.BaseModel]) -> Any: - if PYDANTIC_V2: - return model.model_config - return model.__config__ # type: ignore + if PYDANTIC_V1: + return model.__config__ # type: ignore + return model.model_config def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: - if PYDANTIC_V2: - return model.model_fields - return model.__fields__ # type: ignore + if PYDANTIC_V1: + return model.__fields__ # type: ignore + return model.model_fields def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: - if PYDANTIC_V2: - return model.model_copy(deep=deep) - return model.copy(deep=deep) # type: ignore + if PYDANTIC_V1: + return model.copy(deep=deep) # type: ignore + return model.model_copy(deep=deep) def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: - if PYDANTIC_V2: - return model.model_dump_json(indent=indent) - return model.json(indent=indent) # type: ignore + if PYDANTIC_V1: + return model.json(indent=indent) # type: ignore + return model.model_dump_json(indent=indent) def model_dump( @@ -139,14 +140,14 @@ def model_dump( warnings: bool = True, mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2 or hasattr(model, "model_dump"): + if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 - warnings=warnings if PYDANTIC_V2 else True, + warnings=True if PYDANTIC_V1 else warnings, ) return cast( "dict[str, Any]", @@ -159,9 +160,9 @@ def model_dump( def model_parse(model: type[_ModelT], data: Any) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(data) - return model.parse_obj(data) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + return model.model_validate(data) # generic models @@ -170,17 +171,16 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: class GenericModel(pydantic.BaseModel): ... else: - if PYDANTIC_V2: + if PYDANTIC_V1: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + else: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors class GenericModel(pydantic.BaseModel): ... - else: - import pydantic.generics - - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... - # cached properties if TYPE_CHECKING: diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 92f7c10..3a6017e 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -50,7 +50,7 @@ strip_annotated_type, ) from ._compat import ( - PYDANTIC_V2, + PYDANTIC_V1, ConfigDict, GenericModel as BaseGenericModel, get_args, @@ -81,11 +81,7 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict( - extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) - ) - else: + if PYDANTIC_V1: @property @override @@ -95,6 +91,10 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + else: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) def to_dict( self, @@ -215,25 +215,25 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if key not in model_fields: parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value - if PYDANTIC_V2: - _extra[key] = parsed - else: + if PYDANTIC_V1: _fields_set.add(key) fields_values[key] = parsed + else: + _extra[key] = parsed object.__setattr__(m, "__dict__", fields_values) - if PYDANTIC_V2: - # these properties are copied from Pydantic's `model_construct()` method - object.__setattr__(m, "__pydantic_private__", None) - object.__setattr__(m, "__pydantic_extra__", _extra) - object.__setattr__(m, "__pydantic_fields_set__", _fields_set) - else: + if PYDANTIC_V1: # init_private_attributes() does not exist in v2 m._init_private_attributes() # type: ignore # copied from Pydantic v1's `construct()` method object.__setattr__(m, "__fields_set__", _fields_set) + else: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) return m @@ -243,7 +243,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] # although not in practice model_construct = construct - if not PYDANTIC_V2: + if PYDANTIC_V1: # we define aliases for some of the new pydantic v2 methods so # that we can just document these methods without having to specify # a specific pydantic version as some users may not know which @@ -363,10 +363,10 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if value is None: return field_get_default(field) - if PYDANTIC_V2: - type_ = field.annotation - else: + if PYDANTIC_V1: type_ = cast(type, field.outer_type_) # type: ignore + else: + type_ = field.annotation # type: ignore if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") @@ -375,7 +375,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: - if not PYDANTIC_V2: + if PYDANTIC_V1: # TODO return None @@ -628,30 +628,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, for variant in get_args(union): variant = strip_annotated_type(variant) if is_basemodel_type(variant): - if PYDANTIC_V2: - field = _extract_field_schema_pv2(variant, discriminator_field_name) - if not field: + if PYDANTIC_V1: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field.get("serialization_alias") - - field_schema = field["schema"] + discriminator_alias = field_info.alias - if field_schema["type"] == "literal": - for entry in cast("LiteralSchema", field_schema)["expected"]: + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant else: - field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - if not field_info: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field_info.alias + discriminator_alias = field.get("serialization_alias") - if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): - for entry in get_args(annotation): + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant @@ -714,7 +714,7 @@ class GenericModel(BaseGenericModel, BaseModel): pass -if PYDANTIC_V2: +if not PYDANTIC_V1: from pydantic import TypeAdapter as _TypeAdapter _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) @@ -782,12 +782,12 @@ class FinalRequestOptions(pydantic.BaseModel): json_data: Union[Body, None] = None extra_json: Union[AnyMapping, None] = None - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) - else: + if PYDANTIC_V1: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] arbitrary_types_allowed: bool = True + else: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) def get_max_retries(self, max_retries: int) -> int: if isinstance(self.max_retries, NotGiven): @@ -820,9 +820,9 @@ def construct( # type: ignore key: strip_not_given(value) for key, value in values.items() } - if PYDANTIC_V2: - return super().model_construct(_fields_set, **kwargs) - return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + return super().model_construct(_fields_set, **kwargs) if not TYPE_CHECKING: # type checkers incorrectly complain about this assignment diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py index ca547ce..dc64e29 100644 --- a/src/onebusaway/_utils/__init__.py +++ b/src/onebusaway/_utils/__init__.py @@ -10,7 +10,6 @@ lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, - parse_date as parse_date, is_iterable as is_iterable, is_sequence as is_sequence, coerce_float as coerce_float, @@ -23,7 +22,6 @@ coerce_boolean as coerce_boolean, coerce_integer as coerce_integer, file_from_path as file_from_path, - parse_datetime as parse_datetime, strip_not_given as strip_not_given, deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, @@ -32,6 +30,13 @@ maybe_coerce_boolean as maybe_coerce_boolean, maybe_coerce_integer as maybe_coerce_integer, ) +from ._compat import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, +) from ._typing import ( is_list_type as is_list_type, is_union_type as is_union_type, @@ -56,3 +61,4 @@ function_has_argument as function_has_argument, assert_signatures_in_sync as assert_signatures_in_sync, ) +from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime diff --git a/src/onebusaway/_utils/_compat.py b/src/onebusaway/_utils/_compat.py new file mode 100644 index 0000000..dd70323 --- /dev/null +++ b/src/onebusaway/_utils/_compat.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import sys +import typing_extensions +from typing import Any, Type, Union, Literal, Optional +from datetime import date, datetime +from typing_extensions import get_args as _get_args, get_origin as _get_origin + +from .._types import StrBytesIntFloat +from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime + +_LITERAL_TYPES = {Literal, typing_extensions.Literal} + + +def get_args(tp: type[Any]) -> tuple[Any, ...]: + return _get_args(tp) + + +def get_origin(tp: type[Any]) -> type[Any] | None: + return _get_origin(tp) + + +def is_union(tp: Optional[Type[Any]]) -> bool: + if sys.version_info < (3, 10): + return tp is Union # type: ignore[comparison-overlap] + else: + import types + + return tp is Union or tp is types.UnionType + + +def is_typeddict(tp: Type[Any]) -> bool: + return typing_extensions.is_typeddict(tp) + + +def is_literal_type(tp: Type[Any]) -> bool: + return get_origin(tp) in _LITERAL_TYPES + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + return _parse_date(value) + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + return _parse_datetime(value) diff --git a/src/onebusaway/_utils/_datetime_parse.py b/src/onebusaway/_utils/_datetime_parse.py new file mode 100644 index 0000000..7cb9d9e --- /dev/null +++ b/src/onebusaway/_utils/_datetime_parse.py @@ -0,0 +1,136 @@ +""" +This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py +without the Pydantic v1 specific errors. +""" + +from __future__ import annotations + +import re +from typing import Dict, Union, Optional +from datetime import date, datetime, timezone, timedelta + +from .._types import StrBytesIntFloat + +date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})" +time_expr = ( + r"(?P\d{1,2}):(?P\d{1,2})" + r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?" + r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$" +) + +date_re = re.compile(f"{date_expr}$") +datetime_re = re.compile(f"{date_expr}[T ]{time_expr}") + + +EPOCH = datetime(1970, 1, 1) +# if greater than this, the number is in ms, if less than or equal it's in seconds +# (in seconds this is 11th October 2603, in ms it's 20th August 1970) +MS_WATERSHED = int(2e10) +# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9 +MAX_NUMBER = int(3e20) + + +def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: + if isinstance(value, (int, float)): + return value + try: + return float(value) + except ValueError: + return None + except TypeError: + raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None + + +def _from_unix_seconds(seconds: Union[int, float]) -> datetime: + if seconds > MAX_NUMBER: + return datetime.max + elif seconds < -MAX_NUMBER: + return datetime.min + + while abs(seconds) > MS_WATERSHED: + seconds /= 1000 + dt = EPOCH + timedelta(seconds=seconds) + return dt.replace(tzinfo=timezone.utc) + + +def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]: + if value == "Z": + return timezone.utc + elif value is not None: + offset_mins = int(value[-2:]) if len(value) > 3 else 0 + offset = 60 * int(value[1:3]) + offset_mins + if value[0] == "-": + offset = -offset + return timezone(timedelta(minutes=offset)) + else: + return None + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + """ + Parse a datetime/int/float/string and return a datetime.datetime. + + This function supports time zone offsets. When the input contains one, + the output uses a timezone with a fixed offset from UTC. + + Raise ValueError if the input is well formatted but not a valid datetime. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, datetime): + return value + + number = _get_numeric(value, "datetime") + if number is not None: + return _from_unix_seconds(number) + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + + match = datetime_re.match(value) + if match is None: + raise ValueError("invalid datetime format") + + kw = match.groupdict() + if kw["microsecond"]: + kw["microsecond"] = kw["microsecond"].ljust(6, "0") + + tzinfo = _parse_timezone(kw.pop("tzinfo")) + kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None} + kw_["tzinfo"] = tzinfo + + return datetime(**kw_) # type: ignore + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + """ + Parse a date/int/float/string and return a datetime.date. + + Raise ValueError if the input is well formatted but not a valid date. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, date): + if isinstance(value, datetime): + return value.date() + else: + return value + + number = _get_numeric(value, "date") + if number is not None: + return _from_unix_seconds(number).date() + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + match = date_re.match(value) + if match is None: + raise ValueError("invalid date format") + + kw = {k: int(v) for k, v in match.groupdict().items()} + + try: + return date(**kw) + except ValueError: + raise ValueError("invalid date format") from None diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index f0bcefd..c19124f 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -19,6 +19,7 @@ is_sequence, ) from .._files import is_base64_file_input +from ._compat import get_origin, is_typeddict from ._typing import ( is_list_type, is_union_type, @@ -29,7 +30,6 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -169,6 +169,8 @@ def _transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation @@ -333,6 +335,8 @@ async def _async_transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 845cd6b..193109f 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -15,7 +15,7 @@ from ._utils import lru_cache from .._types import InheritsGeneric -from .._compat import is_union as _is_union +from ._compat import is_union as _is_union def is_annotated_type(typ: type) -> bool: diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index ea3cf3f..f081859 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -22,7 +22,6 @@ import sniffio from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) diff --git a/tests/test_models.py b/tests/test_models.py index 6c410fe..7f54642 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -8,7 +8,7 @@ from pydantic import Field from onebusaway._utils import PropertyInfo -from onebusaway._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from onebusaway._compat import PYDANTIC_V1, parse_obj, model_dump, model_json from onebusaway._models import BaseModel, construct_type @@ -294,12 +294,12 @@ class Model(BaseModel): assert cast(bool, m.foo) is True m = Model.construct(foo={"name": 3}) - if PYDANTIC_V2: - assert isinstance(m.foo, Submodel1) - assert m.foo.name == 3 # type: ignore - else: + if PYDANTIC_V1: assert isinstance(m.foo, Submodel2) assert m.foo.name == "3" + else: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore def test_list_of_unions() -> None: @@ -426,10 +426,10 @@ class Model(BaseModel): expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) - if PYDANTIC_V2: - expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' - else: + if PYDANTIC_V1: expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + else: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' model = Model.construct(created_at="2019-12-27T18:11:19.117Z") assert model.created_at == expected @@ -531,7 +531,7 @@ class Model2(BaseModel): assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} assert m4.to_dict(mode="json") == {"created_at": time_str} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -556,7 +556,7 @@ class Model(BaseModel): assert m3.model_dump() == {"foo": None} assert m3.model_dump(exclude_none=True) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) @@ -580,10 +580,10 @@ class Model(BaseModel): assert json.loads(m.to_json()) == {"FOO": "hello"} assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} - if PYDANTIC_V2: - assert m.to_json(indent=None) == '{"FOO":"hello"}' - else: + if PYDANTIC_V1: assert m.to_json(indent=None) == '{"FOO": "hello"}' + else: + assert m.to_json(indent=None) == '{"FOO":"hello"}' m2 = Model() assert json.loads(m2.to_json()) == {} @@ -595,7 +595,7 @@ class Model(BaseModel): assert json.loads(m3.to_json()) == {"FOO": None} assert json.loads(m3.to_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_json(warnings=False) @@ -622,7 +622,7 @@ class Model(BaseModel): assert json.loads(m3.model_dump_json()) == {"foo": None} assert json.loads(m3.model_dump_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump_json(round_trip=True) @@ -679,12 +679,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_unknown_variant() -> None: @@ -768,12 +768,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.foo_type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: @@ -833,7 +833,7 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) # pyright: ignore @@ -849,7 +849,7 @@ class Model(BaseModel): assert m.union == "bar" -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_field_named_cls() -> None: class Model(BaseModel): cls: str @@ -936,7 +936,7 @@ class Type2(BaseModel): assert isinstance(model.value, InnerType2) -@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2 for now") def test_extra_properties() -> None: class Item(BaseModel): prop: int diff --git a/tests/test_transform.py b/tests/test_transform.py index 6db9c52..2b8d81c 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -15,7 +15,7 @@ parse_datetime, async_transform as _async_transform, ) -from onebusaway._compat import PYDANTIC_V2 +from onebusaway._compat import PYDANTIC_V1 from onebusaway._models import BaseModel _T = TypeVar("_T") @@ -189,7 +189,7 @@ class DateModel(BaseModel): @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") - tz = "Z" if PYDANTIC_V2 else "+00:00" + tz = "+00:00" if PYDANTIC_V1 else "Z" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] @@ -297,11 +297,11 @@ async def test_pydantic_unknown_field(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_types(use_async: bool) -> None: model = MyModel.construct(foo=True) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": True} @@ -309,11 +309,11 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_object_type(use_async: bool) -> None: model = MyModel.construct(foo=MyModel.construct(hello="world")) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": {"hello": "world"}} diff --git a/tests/test_utils/test_datetime_parse.py b/tests/test_utils/test_datetime_parse.py new file mode 100644 index 0000000..a069595 --- /dev/null +++ b/tests/test_utils/test_datetime_parse.py @@ -0,0 +1,110 @@ +""" +Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py +with modifications so it works without pydantic v1 imports. +""" + +from typing import Type, Union +from datetime import date, datetime, timezone, timedelta + +import pytest + +from onebusaway._utils import parse_date, parse_datetime + + +def create_tz(minutes: int) -> timezone: + return timezone(timedelta(minutes=minutes)) + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + ("1494012444.883309", date(2017, 5, 5)), + (b"1494012444.883309", date(2017, 5, 5)), + (1_494_012_444.883_309, date(2017, 5, 5)), + ("1494012444", date(2017, 5, 5)), + (1_494_012_444, date(2017, 5, 5)), + (0, date(1970, 1, 1)), + ("2012-04-23", date(2012, 4, 23)), + (b"2012-04-23", date(2012, 4, 23)), + ("2012-4-9", date(2012, 4, 9)), + (date(2012, 4, 9), date(2012, 4, 9)), + (datetime(2012, 4, 9, 12, 15), date(2012, 4, 9)), + # Invalid inputs + ("x20120423", ValueError), + ("2012-04-56", ValueError), + (19_999_999_999, date(2603, 10, 11)), # just before watershed + (20_000_000_001, date(1970, 8, 20)), # just after watershed + (1_549_316_052, date(2019, 2, 4)), # nowish in s + (1_549_316_052_104, date(2019, 2, 4)), # nowish in ms + (1_549_316_052_104_324, date(2019, 2, 4)), # nowish in μs + (1_549_316_052_104_324_096, date(2019, 2, 4)), # nowish in ns + ("infinity", date(9999, 12, 31)), + ("inf", date(9999, 12, 31)), + (float("inf"), date(9999, 12, 31)), + ("infinity ", date(9999, 12, 31)), + (int("1" + "0" * 100), date(9999, 12, 31)), + (1e1000, date(9999, 12, 31)), + ("-infinity", date(1, 1, 1)), + ("-inf", date(1, 1, 1)), + ("nan", ValueError), + ], +) +def test_date_parsing(value: Union[str, bytes, int, float], result: Union[date, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_date(value) + else: + assert parse_date(value) == result + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + # values in seconds + ("1494012444.883309", datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + (1_494_012_444.883_309, datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + ("1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (b"1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (1_494_012_444, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + # values in ms + ("1494012444000.883309", datetime(2017, 5, 5, 19, 27, 24, 883, tzinfo=timezone.utc)), + ("-1494012444000.883309", datetime(1922, 8, 29, 4, 32, 35, 999117, tzinfo=timezone.utc)), + (1_494_012_444_000, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + ("2012-04-23T09:15:00", datetime(2012, 4, 23, 9, 15)), + ("2012-4-9 4:8:16", datetime(2012, 4, 9, 4, 8, 16)), + ("2012-04-23T09:15:00Z", datetime(2012, 4, 23, 9, 15, 0, 0, timezone.utc)), + ("2012-4-9 4:8:16-0320", datetime(2012, 4, 9, 4, 8, 16, 0, create_tz(-200))), + ("2012-04-23T10:20:30.400+02:30", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(150))), + ("2012-04-23T10:20:30.400+02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(120))), + ("2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (b"2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (datetime(2017, 5, 5), datetime(2017, 5, 5)), + (0, datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)), + # Invalid inputs + ("x20120423091500", ValueError), + ("2012-04-56T09:15:90", ValueError), + ("2012-04-23T11:05:00-25:00", ValueError), + (19_999_999_999, datetime(2603, 10, 11, 11, 33, 19, tzinfo=timezone.utc)), # just before watershed + (20_000_000_001, datetime(1970, 8, 20, 11, 33, 20, 1000, tzinfo=timezone.utc)), # just after watershed + (1_549_316_052, datetime(2019, 2, 4, 21, 34, 12, 0, tzinfo=timezone.utc)), # nowish in s + (1_549_316_052_104, datetime(2019, 2, 4, 21, 34, 12, 104_000, tzinfo=timezone.utc)), # nowish in ms + (1_549_316_052_104_324, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in μs + (1_549_316_052_104_324_096, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in ns + ("infinity", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf ", datetime(9999, 12, 31, 23, 59, 59, 999999)), + (1e50, datetime(9999, 12, 31, 23, 59, 59, 999999)), + (float("inf"), datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("-infinity", datetime(1, 1, 1, 0, 0)), + ("-inf", datetime(1, 1, 1, 0, 0)), + ("nan", ValueError), + ], +) +def test_datetime_parsing(value: Union[str, bytes, int, float], result: Union[datetime, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_datetime(value) + else: + assert parse_datetime(value) == result diff --git a/tests/utils.py b/tests/utils.py index a6008de..d7fa747 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -19,7 +19,7 @@ is_annotated_type, is_type_alias_type, ) -from onebusaway._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from onebusaway._compat import PYDANTIC_V1, field_outer_type, get_model_fields from onebusaway._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) @@ -28,12 +28,12 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: for name, field in get_model_fields(model).items(): field_value = getattr(value, name) - if PYDANTIC_V2: - allow_none = False - else: + if PYDANTIC_V1: # in v1 nullability was structured differently # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields allow_none = getattr(field, "allow_none", False) + else: + allow_none = False assert_matches_type( field_outer_type(field), From d9f28cd94589c0154484a706e7610b65671bf0cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 04:11:32 +0000 Subject: [PATCH 312/397] release: 1.17.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc845f3..6a197be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.0" + ".": "1.17.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 137747e..bbcd15a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.0 (2025-09-04) + +Full Changelog: [v1.16.0...v1.17.0](https://github.com/OneBusAway/python-sdk/compare/v1.16.0...v1.17.0) + +### Features + +* improve future compat with pydantic v3 ([1b63906](https://github.com/OneBusAway/python-sdk/commit/1b63906456bd2aecd39460d9b12bf45a063b7392)) + ## 1.16.0 (2025-09-03) Full Changelog: [v1.15.5...v1.16.0](https://github.com/OneBusAway/python-sdk/compare/v1.15.5...v1.16.0) diff --git a/pyproject.toml b/pyproject.toml index d70d923..a52a066 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.16.0" +version = "1.17.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index af59124..4a5f7fa 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.16.0" # x-release-please-version +__version__ = "1.17.0" # x-release-please-version From baa06e63b06e3082adc11f9a7930276c8777d527 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 04:37:15 +0000 Subject: [PATCH 313/397] chore(internal): move mypy configurations to `pyproject.toml` file --- mypy.ini | 50 ------------------------------------------------ pyproject.toml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 97658a5..0000000 --- a/mypy.ini +++ /dev/null @@ -1,50 +0,0 @@ -[mypy] -pretty = True -show_error_codes = True - -# Exclude _files.py because mypy isn't smart enough to apply -# the correct type narrowing and as this is an internal module -# it's fine to just use Pyright. -# -# We also exclude our `tests` as mypy doesn't always infer -# types correctly and Pyright will still catch any type errors. -exclude = ^(src/onebusaway/_files\.py|_dev/.*\.py|tests/.*)$ - -strict_equality = True -implicit_reexport = True -check_untyped_defs = True -no_implicit_optional = True - -warn_return_any = True -warn_unreachable = True -warn_unused_configs = True - -# Turn these options off as it could cause conflicts -# with the Pyright options. -warn_unused_ignores = False -warn_redundant_casts = False - -disallow_any_generics = True -disallow_untyped_defs = True -disallow_untyped_calls = True -disallow_subclassing_any = True -disallow_incomplete_defs = True -disallow_untyped_decorators = True -cache_fine_grained = True - -# By default, mypy reports an error if you assign a value to the result -# of a function call that doesn't return anything. We do this in our test -# cases: -# ``` -# result = ... -# assert result is None -# ``` -# Changing this codegen to make mypy happy would increase complexity -# and would not be worth it. -disable_error_code = func-returns-value,overload-cannot-match - -# https://github.com/python/mypy/issues/12162 -[mypy.overrides] -module = "black.files.*" -ignore_errors = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index a52a066..ef2e571 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,6 +157,58 @@ reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false +[tool.mypy] +pretty = true +show_error_codes = true + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ['src/onebusaway/_files.py', '_dev/.*.py', 'tests/.*'] + +strict_equality = true +implicit_reexport = true +check_untyped_defs = true +no_implicit_optional = true + +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = false +warn_redundant_casts = false + +disallow_any_generics = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_subclassing_any = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +cache_fine_grained = true + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = "func-returns-value,overload-cannot-match" + +# https://github.com/python/mypy/issues/12162 +[[tool.mypy.overrides]] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true + + [tool.ruff] line-length = 120 output-format = "grouped" From 0cced81054c3e77548c7b34fe4899ccbbc9efb96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 05:26:26 +0000 Subject: [PATCH 314/397] chore(tests): simplify `get_platform` test `nest_asyncio` is archived and broken on some platforms so it's not worth keeping in our test suite. --- pyproject.toml | 1 - requirements-dev.lock | 1 - tests/test_client.py | 53 +++++-------------------------------------- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ef2e571..fccf76a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,6 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0", "pytest-xdist>=3.6.1", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index f680d83..5a191d4 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -75,7 +75,6 @@ multidict==6.4.4 mypy==1.14.1 mypy-extensions==1.0.0 # via mypy -nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 diff --git a/tests/test_client.py b/tests/test_client.py index 3e5bd95..7b21288 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,14 +6,11 @@ import os import sys import json -import time import asyncio import inspect -import subprocess import tracemalloc import urllib.parse from typing import Any, Union, cast -from textwrap import dedent from unittest import mock from typing_extensions import Literal @@ -24,14 +21,17 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError from onebusaway._types import Omit +from onebusaway._utils import asyncify from onebusaway._models import BaseModel, FinalRequestOptions from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from onebusaway._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + OtherPlatform, DefaultHttpxClient, DefaultAsyncHttpxClient, + get_platform, make_request_options, ) @@ -1628,50 +1628,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" - def test_get_platform(self) -> None: - # A previous implementation of asyncify could leave threads unterminated when - # used with nest_asyncio. - # - # Since nest_asyncio.apply() is global and cannot be un-applied, this - # test is run in a separate process to avoid affecting other tests. - test_code = dedent(""" - import asyncio - import nest_asyncio - import threading - - from onebusaway._utils import asyncify - from onebusaway._base_client import get_platform - - async def test_main() -> None: - result = await asyncify(get_platform)() - print(result) - for thread in threading.enumerate(): - print(thread.name) - - nest_asyncio.apply() - asyncio.run(test_main()) - """) - with subprocess.Popen( - [sys.executable, "-c", test_code], - text=True, - ) as process: - timeout = 10 # seconds - - start_time = time.monotonic() - while True: - return_code = process.poll() - if return_code is not None: - if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - - # success - break - - if time.monotonic() - start_time > timeout: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") - - time.sleep(0.1) + async def test_get_platform(self) -> None: + platform = await asyncify(get_platform)() + assert isinstance(platform, (str, OtherPlatform)) async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly From 2dde76ac53751d4c6b48550484e37ce7eb2bfd15 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 05:26:44 +0000 Subject: [PATCH 315/397] release: 1.17.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6a197be..3741b31 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.0" + ".": "1.17.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bbcd15a..2e0e0ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.17.1 (2025-09-06) + +Full Changelog: [v1.17.0...v1.17.1](https://github.com/OneBusAway/python-sdk/compare/v1.17.0...v1.17.1) + +### Chores + +* **internal:** move mypy configurations to `pyproject.toml` file ([baa06e6](https://github.com/OneBusAway/python-sdk/commit/baa06e63b06e3082adc11f9a7930276c8777d527)) +* **tests:** simplify `get_platform` test ([0cced81](https://github.com/OneBusAway/python-sdk/commit/0cced81054c3e77548c7b34fe4899ccbbc9efb96)) + ## 1.17.0 (2025-09-04) Full Changelog: [v1.16.0...v1.17.0](https://github.com/OneBusAway/python-sdk/compare/v1.16.0...v1.17.0) diff --git a/pyproject.toml b/pyproject.toml index fccf76a..3a5e6a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.0" +version = "1.17.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4a5f7fa..c0d0a20 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.0" # x-release-please-version +__version__ = "1.17.1" # x-release-please-version From c13d52be2ec7ab0ff9da3f2120792d9ed247881e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:19:51 +0000 Subject: [PATCH 316/397] chore(internal): update pydantic dependency --- requirements-dev.lock | 7 +++++-- requirements.lock | 7 +++++-- src/onebusaway/_models.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 5a191d4..d6d0d0d 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -88,9 +88,9 @@ pluggy==1.5.0 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via onebusaway -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic pygments==2.18.0 # via rich @@ -126,6 +126,9 @@ typing-extensions==4.12.2 # via pydantic # via pydantic-core # via pyright + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic virtualenv==20.24.5 # via nox yarl==1.20.0 diff --git a/requirements.lock b/requirements.lock index 251a981..3780471 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,9 +55,9 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via onebusaway -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic sniffio==1.3.0 # via anyio @@ -68,5 +68,8 @@ typing-extensions==4.12.2 # via onebusaway # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic yarl==1.20.0 # via aiohttp diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 3a6017e..6a3cd1d 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -256,7 +256,7 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, @@ -264,6 +264,7 @@ def model_dump( warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, serialize_as_any: bool = False, + fallback: Callable[[Any], Any] | None = None, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -295,10 +296,12 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -313,13 +316,14 @@ def model_dump_json( indent: int | None = None, include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, + fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -348,11 +352,13 @@ def model_dump_json( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, From c24d539861b7594e5a88f68de5a422ab0db096e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 03:41:30 +0000 Subject: [PATCH 317/397] chore(types): change optional parameter type from NotGiven to Omit --- src/onebusaway/__init__.py | 4 +- src/onebusaway/_base_client.py | 18 ++++---- src/onebusaway/_client.py | 16 +++---- src/onebusaway/_qs.py | 14 +++--- src/onebusaway/_types.py | 29 +++++++----- src/onebusaway/_utils/_transform.py | 4 +- src/onebusaway/_utils/_utils.py | 8 ++-- .../resources/agencies_with_coverage.py | 6 +-- src/onebusaway/resources/agency.py | 6 +-- .../resources/arrival_and_departure.py | 34 +++++++------- src/onebusaway/resources/block.py | 6 +-- src/onebusaway/resources/config.py | 6 +-- src/onebusaway/resources/current_time.py | 6 +-- .../resources/report_problem_with_stop.py | 26 +++++------ .../resources/report_problem_with_trip.py | 46 +++++++++---------- src/onebusaway/resources/route.py | 6 +-- .../resources/route_ids_for_agency.py | 6 +-- src/onebusaway/resources/routes_for_agency.py | 6 +-- .../resources/routes_for_location.py | 22 ++++----- .../resources/schedule_for_route.py | 10 ++-- src/onebusaway/resources/schedule_for_stop.py | 10 ++-- src/onebusaway/resources/search_for_route.py | 10 ++-- src/onebusaway/resources/search_for_stop.py | 10 ++-- src/onebusaway/resources/shape.py | 6 +-- src/onebusaway/resources/stop.py | 6 +-- .../resources/stop_ids_for_agency.py | 6 +-- src/onebusaway/resources/stops_for_agency.py | 6 +-- .../resources/stops_for_location.py | 22 ++++----- src/onebusaway/resources/stops_for_route.py | 14 +++--- src/onebusaway/resources/trip.py | 6 +-- src/onebusaway/resources/trip_details.py | 26 +++++------ src/onebusaway/resources/trip_for_vehicle.py | 22 ++++----- .../resources/trips_for_location.py | 18 ++++---- src/onebusaway/resources/trips_for_route.py | 18 ++++---- .../resources/vehicles_for_agency.py | 10 ++-- tests/test_transform.py | 11 ++++- 36 files changed, 248 insertions(+), 232 deletions(-) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 36af60f..fb5549b 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import ( Client, @@ -48,7 +48,9 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "OnebusawaySDKError", "APIError", "APIStatusError", diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index e9c5fb6..2f2004e 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -42,7 +42,6 @@ from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -145,9 +145,9 @@ def __init__( def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -595,7 +595,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -825,7 +825,7 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1356,7 +1356,7 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1818,8 +1818,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 9e04cd8..7688a85 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Union, Mapping +from typing import Any, Mapping from typing_extensions import Self, override import httpx @@ -11,13 +11,13 @@ from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library from ._version import __version__ @@ -111,7 +111,7 @@ def __init__( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -221,9 +221,9 @@ def copy( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -344,7 +344,7 @@ def __init__( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -454,9 +454,9 @@ def copy( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py index 274320c..ada6fd3 100644 --- a/src/onebusaway/_qs.py +++ b/src/onebusaway/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 057d697..f005a2e 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -140,13 +143,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -156,8 +160,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -165,6 +169,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py index c19124f..5207549 100644 --- a/src/onebusaway/_utils/_transform.py +++ b/src/onebusaway/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index f081859..50d5926 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -21,7 +21,7 @@ import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index f543a88..08ae516 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along @@ -90,7 +90,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 9141792..6510af2 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index c58f4d5..7f935c8 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -8,7 +8,7 @@ import httpx from ..types import arrival_and_departure_list_params, arrival_and_departure_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -51,15 +51,15 @@ def retrieve( *, service_date: int, trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, + stop_sequence: int | Omit = omit, + time: int | Omit = omit, + vehicle_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -100,15 +100,15 @@ def list( self, stop_id: str, *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -176,15 +176,15 @@ async def retrieve( *, service_date: int, trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, + stop_sequence: int | Omit = omit, + time: int | Omit = omit, + vehicle_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -225,15 +225,15 @@ async def list( self, stop_id: str, *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index cbee583..5ce7bdc 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BlockRetrieveResponse: """ Get details of a specific block by ID diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 4b3de23..20193cc 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -47,7 +47,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConfigRetrieveResponse: """config""" return self._get( @@ -87,7 +87,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConfigRetrieveResponse: """config""" return await self._get( diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 1dcc9a8..8760365 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -47,7 +47,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CurrentTimeRetrieveResponse: """current-time""" return self._get( @@ -87,7 +87,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CurrentTimeRetrieveResponse: """current-time""" return await self._get( diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index 755cbe2..6127491 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -7,7 +7,7 @@ import httpx from ..types import report_problem_with_stop_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,17 +48,17 @@ def retrieve( stop_id: str, *, code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, + | Omit = omit, + user_comment: str | Omit = omit, + user_lat: float | Omit = omit, + user_location_accuracy: float | Omit = omit, + user_lon: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -131,17 +131,17 @@ async def retrieve( stop_id: str, *, code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, + | Omit = omit, + user_comment: str | Omit = omit, + user_lat: float | Omit = omit, + user_location_accuracy: float | Omit = omit, + user_lon: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ResponseWrapper: """ Submit a user-generated problem report for a stop diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index 848dc0e..6c3dc23 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -7,7 +7,7 @@ import httpx from ..types import report_problem_with_trip_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -55,22 +55,22 @@ def retrieve( "vehicle_does_not_stop_here", "other", ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + service_date: int | Omit = omit, + stop_id: str | Omit = omit, + user_comment: str | Omit = omit, + user_lat: float | Omit = omit, + user_location_accuracy: float | Omit = omit, + user_lon: float | Omit = omit, + user_on_vehicle: bool | Omit = omit, + user_vehicle_number: str | Omit = omit, + vehicle_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -165,22 +165,22 @@ async def retrieve( "vehicle_does_not_stop_here", "other", ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + service_date: int | Omit = omit, + stop_id: str | Omit = omit, + user_comment: str | Omit = omit, + user_lat: float | Omit = omit, + user_location_accuracy: float | Omit = omit, + user_lon: float | Omit = omit, + user_on_vehicle: bool | Omit = omit, + user_vehicle_number: str | Omit = omit, + vehicle_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 62ae14a..be67b63 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index e5ddfa3..c9d7ef5 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index ff7a8cd..b4b36da 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index af9e1f1..76e466d 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -5,7 +5,7 @@ import httpx from ..types import routes_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -46,16 +46,16 @@ def list( *, lat: float, lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + query: str | Omit = omit, + radius: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoutesForLocationListResponse: """ routes-for-location @@ -117,16 +117,16 @@ async def list( *, lat: float, lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + query: str | Omit = omit, + radius: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoutesForLocationListResponse: """ routes-for-location diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index c40d4b6..0c12dd4 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -8,7 +8,7 @@ import httpx from ..types import schedule_for_route_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def retrieve( self, route_id: str, *, - date: Union[str, date] | NotGiven = NOT_GIVEN, + date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -112,13 +112,13 @@ async def retrieve( self, route_id: str, *, - date: Union[str, date] | NotGiven = NOT_GIVEN, + date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index a530f94..06ebe98 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -8,7 +8,7 @@ import httpx from ..types import schedule_for_stop_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def retrieve( self, stop_id: str, *, - date: Union[str, date] | NotGiven = NOT_GIVEN, + date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -110,13 +110,13 @@ async def retrieve( self, stop_id: str, *, - date: Union[str, date] | NotGiven = NOT_GIVEN, + date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index 6f12050..4248ca5 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -5,7 +5,7 @@ import httpx from ..types import search_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def list( self, *, input: str, - max_count: int | NotGiven = NOT_GIVEN, + max_count: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -112,13 +112,13 @@ async def list( self, *, input: str, - max_count: int | NotGiven = NOT_GIVEN, + max_count: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchForRouteListResponse: """ Search for a route based on its name. diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 3458a57..a95cbdf 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -5,7 +5,7 @@ import httpx from ..types import search_for_stop_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def list( self, *, input: str, - max_count: int | NotGiven = NOT_GIVEN, + max_count: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -112,13 +112,13 @@ async def list( self, *, input: str, - max_count: int | NotGiven = NOT_GIVEN, + max_count: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchForStopListResponse: """ Search for a stop based on its name. diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 0b4c291..8001169 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 502f8ce..21a8cf1 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopRetrieveResponse: """ Get details of a specific stop @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopRetrieveResponse: """ Get details of a specific stop diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 3850d16..a14de79 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 834ab5c..74da5c1 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForAgencyListResponse: """ Get stops for a specific agency diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 52afc2d..ea17f45 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -5,7 +5,7 @@ import httpx from ..types import stops_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -46,16 +46,16 @@ def list( *, lat: float, lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + query: str | Omit = omit, + radius: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForLocationListResponse: """ stops-for-location @@ -125,16 +125,16 @@ async def list( *, lat: float, lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + query: str | Omit = omit, + radius: float | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForLocationListResponse: """ stops-for-location diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 17c867e..0d940e3 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -5,7 +5,7 @@ import httpx from ..types import stops_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def list( self, route_id: str, *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, + include_polylines: bool | Omit = omit, + time: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -115,14 +115,14 @@ async def list( self, route_id: str, *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, + include_polylines: bool | Omit = omit, + time: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StopsForRouteListResponse: """ Get stops for a specific route diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index 9b7e137..b13fb0d 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripRetrieveResponse: """ Get details of a specific trip @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripRetrieveResponse: """ Get details of a specific trip diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 267b195..3c5e8b0 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -5,7 +5,7 @@ import httpx from ..types import trip_detail_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,17 +45,17 @@ def retrieve( self, trip_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + include_trip: bool | Omit = omit, + service_date: int | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -130,17 +130,17 @@ async def retrieve( self, trip_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + include_trip: bool | Omit = omit, + service_date: int | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripDetailRetrieveResponse: """ Retrieve Trip Details diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 073358e..510ea65 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -5,7 +5,7 @@ import httpx from ..types import trip_for_vehicle_retrieve_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,16 +45,16 @@ def retrieve( self, vehicle_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + include_trip: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -126,16 +126,16 @@ async def retrieve( self, vehicle_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + include_trip: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 1d0a342..19b13db 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -5,7 +5,7 @@ import httpx from ..types import trips_for_location_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,15 +48,15 @@ def list( lat_span: float, lon: float, lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_trip: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -137,15 +137,15 @@ async def list( lat_span: float, lon: float, lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_trip: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripsForLocationListResponse: """ Retrieve trips for a given location diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index c6de3f2..5ada544 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -5,7 +5,7 @@ import httpx from ..types import trips_for_route_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,15 +45,15 @@ def list( self, route_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -120,15 +120,15 @@ async def list( self, route_id: str, *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, + include_schedule: bool | Omit = omit, + include_status: bool | Omit = omit, + time: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TripsForRouteListResponse: """ Search for active trips for a specific route. diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index e66ba88..aba7f80 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -5,7 +5,7 @@ import httpx from ..types import vehicles_for_agency_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def list( self, agency_id: str, *, - time: str | NotGiven = NOT_GIVEN, + time: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -106,13 +106,13 @@ async def list( self, agency_id: str, *, - time: str | NotGiven = NOT_GIVEN, + time: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency diff --git a/tests/test_transform.py b/tests/test_transform.py index 2b8d81c..5615f5f 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from onebusaway._types import NOT_GIVEN, Base64FileInput +from onebusaway._types import Base64FileInput, omit, not_given from onebusaway._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {} From f39f06a79a90e9b7f4bf91c451526b0c5a46e50f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 03:41:48 +0000 Subject: [PATCH 318/397] release: 1.17.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3741b31..953c033 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.1" + ".": "1.17.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e0e0ff..adbe2b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.17.2 (2025-09-19) + +Full Changelog: [v1.17.1...v1.17.2](https://github.com/OneBusAway/python-sdk/compare/v1.17.1...v1.17.2) + +### Chores + +* **internal:** update pydantic dependency ([c13d52b](https://github.com/OneBusAway/python-sdk/commit/c13d52be2ec7ab0ff9da3f2120792d9ed247881e)) +* **types:** change optional parameter type from NotGiven to Omit ([c24d539](https://github.com/OneBusAway/python-sdk/commit/c24d539861b7594e5a88f68de5a422ab0db096e3)) + ## 1.17.1 (2025-09-06) Full Changelog: [v1.17.0...v1.17.1](https://github.com/OneBusAway/python-sdk/compare/v1.17.0...v1.17.1) diff --git a/pyproject.toml b/pyproject.toml index 3a5e6a1..ff3fab8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.1" +version = "1.17.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c0d0a20..6fae214 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.1" # x-release-please-version +__version__ = "1.17.2" # x-release-please-version From 39dcea7358a13250e6ef328e8885052155a64445 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:48:48 +0000 Subject: [PATCH 319/397] chore: do not install brew dependencies in ./scripts/bootstrap by default --- scripts/bootstrap | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index e84fe62..b430fee 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From c56e0400634e6217130294c62e95f90e1dafdc48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:49:06 +0000 Subject: [PATCH 320/397] release: 1.17.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 953c033..813bc7f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.2" + ".": "1.17.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index adbe2b8..3cb5396 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.3 (2025-09-20) + +Full Changelog: [v1.17.2...v1.17.3](https://github.com/OneBusAway/python-sdk/compare/v1.17.2...v1.17.3) + +### Chores + +* do not install brew dependencies in ./scripts/bootstrap by default ([39dcea7](https://github.com/OneBusAway/python-sdk/commit/39dcea7358a13250e6ef328e8885052155a64445)) + ## 1.17.2 (2025-09-19) Full Changelog: [v1.17.1...v1.17.2](https://github.com/OneBusAway/python-sdk/compare/v1.17.1...v1.17.2) diff --git a/pyproject.toml b/pyproject.toml index ff3fab8..cee6b62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.2" +version = "1.17.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6fae214..0443ae4 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.2" # x-release-please-version +__version__ = "1.17.3" # x-release-please-version From 7a14d29ad55a4bf845d71ea5aee8ae00a4ed3cdc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 03:10:06 +0000 Subject: [PATCH 321/397] chore: improve example values --- tests/api_resources/test_routes_for_agency.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 9b2182e..793d7bc 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -20,14 +20,14 @@ class TestRoutesForAgency: @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: routes_for_agency = client.routes_for_agency.list( - "agencyID", + "40", ) assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: response = client.routes_for_agency.with_raw_response.list( - "agencyID", + "40", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_agency.with_streaming_response.list( - "agencyID", + "40", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,14 +64,14 @@ class TestAsyncRoutesForAgency: @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: routes_for_agency = await async_client.routes_for_agency.list( - "agencyID", + "40", ) assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: response = await async_client.routes_for_agency.with_raw_response.list( - "agencyID", + "40", ) assert response.is_closed is True @@ -82,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_agency.with_streaming_response.list( - "agencyID", + "40", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 5b4318e13d1d1e820b7956ca2eec5efec0fdb905 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 03:10:25 +0000 Subject: [PATCH 322/397] release: 1.17.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 813bc7f..6fa95f6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.3" + ".": "1.17.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb5396..02d1323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.4 (2025-09-23) + +Full Changelog: [v1.17.3...v1.17.4](https://github.com/OneBusAway/python-sdk/compare/v1.17.3...v1.17.4) + +### Chores + +* improve example values ([7a14d29](https://github.com/OneBusAway/python-sdk/commit/7a14d29ad55a4bf845d71ea5aee8ae00a4ed3cdc)) + ## 1.17.3 (2025-09-20) Full Changelog: [v1.17.2...v1.17.3](https://github.com/OneBusAway/python-sdk/compare/v1.17.2...v1.17.3) diff --git a/pyproject.toml b/pyproject.toml index cee6b62..f27cef3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.3" +version = "1.17.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0443ae4..2e461f2 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.3" # x-release-please-version +__version__ = "1.17.4" # x-release-please-version From 9807d04636cb4e62fcd4d825d1c43718d91618ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:41:17 +0000 Subject: [PATCH 323/397] chore(internal): detect missing future annotations with ruff --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f27cef3..48bc9a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,6 +224,8 @@ select = [ "B", # remove unused imports "F401", + # check for missing future annotations + "FA102", # bare except statements "E722", # unused arguments @@ -246,6 +248,8 @@ unfixable = [ "T203", ] +extend-safe-fixes = ["FA102"] + [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" From 4937131489dcf4894c4ae65a0f154e352c84f544 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:41:34 +0000 Subject: [PATCH 324/397] release: 1.17.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6fa95f6..2df7bbc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.4" + ".": "1.17.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d1323..41cc456 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.5 (2025-10-11) + +Full Changelog: [v1.17.4...v1.17.5](https://github.com/OneBusAway/python-sdk/compare/v1.17.4...v1.17.5) + +### Chores + +* **internal:** detect missing future annotations with ruff ([9807d04](https://github.com/OneBusAway/python-sdk/commit/9807d04636cb4e62fcd4d825d1c43718d91618ec)) + ## 1.17.4 (2025-09-23) Full Changelog: [v1.17.3...v1.17.4](https://github.com/OneBusAway/python-sdk/compare/v1.17.3...v1.17.4) diff --git a/pyproject.toml b/pyproject.toml index 48bc9a0..b6bda90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.4" +version = "1.17.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 2e461f2..c434703 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.4" # x-release-please-version +__version__ = "1.17.5" # x-release-please-version From 6ae619af34818d78c53716f91607e57045f503a6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 02:25:06 +0000 Subject: [PATCH 325/397] chore: bump `httpx-aiohttp` version to 0.1.9 --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- requirements.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b6bda90..8c54754 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/OneBusAway/python-sdk" Repository = "https://github.com/OneBusAway/python-sdk" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] [tool.rye] managed = true diff --git a/requirements-dev.lock b/requirements-dev.lock index d6d0d0d..41b54ec 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -56,7 +56,7 @@ httpx==0.28.1 # via httpx-aiohttp # via onebusaway # via respx -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via onebusaway idna==3.4 # via anyio diff --git a/requirements.lock b/requirements.lock index 3780471..11442de 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via httpx-aiohttp # via onebusaway -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via onebusaway idna==3.4 # via anyio From e090734836158f754c0aef7ec2248f1ea2c90ff1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 02:25:26 +0000 Subject: [PATCH 326/397] release: 1.17.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2df7bbc..f4bcadd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.5" + ".": "1.17.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 41cc456..1115ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.6 (2025-10-18) + +Full Changelog: [v1.17.5...v1.17.6](https://github.com/OneBusAway/python-sdk/compare/v1.17.5...v1.17.6) + +### Chores + +* bump `httpx-aiohttp` version to 0.1.9 ([6ae619a](https://github.com/OneBusAway/python-sdk/commit/6ae619af34818d78c53716f91607e57045f503a6)) + ## 1.17.5 (2025-10-11) Full Changelog: [v1.17.4...v1.17.5](https://github.com/OneBusAway/python-sdk/compare/v1.17.4...v1.17.5) diff --git a/pyproject.toml b/pyproject.toml index 8c54754..2c0274a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.5" +version = "1.17.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index c434703..994b86d 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.5" # x-release-please-version +__version__ = "1.17.6" # x-release-please-version From 70f09ebf5cc0c72556e424744ea305f97cf87cda Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 02:54:54 +0000 Subject: [PATCH 327/397] fix(client): close streams without requiring full consumption --- src/onebusaway/_streaming.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 957b8da..19eceeb 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]: for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + response.close() def __enter__(self) -> Self: return self @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]: async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - async for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + await response.aclose() async def __aenter__(self) -> Self: return self From 4ba1033fc4e83ec0640bd3ff12c65ec57f6a196d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 02:55:12 +0000 Subject: [PATCH 328/397] release: 1.17.7 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f4bcadd..fb611b1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.6" + ".": "1.17.7" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1115ee2..dee931b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.17.7 (2025-10-30) + +Full Changelog: [v1.17.6...v1.17.7](https://github.com/OneBusAway/python-sdk/compare/v1.17.6...v1.17.7) + +### Bug Fixes + +* **client:** close streams without requiring full consumption ([70f09eb](https://github.com/OneBusAway/python-sdk/commit/70f09ebf5cc0c72556e424744ea305f97cf87cda)) + ## 1.17.6 (2025-10-18) Full Changelog: [v1.17.5...v1.17.6](https://github.com/OneBusAway/python-sdk/compare/v1.17.5...v1.17.6) diff --git a/pyproject.toml b/pyproject.toml index 2c0274a..5c9db68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.6" +version = "1.17.7" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 994b86d..8f0a4ce 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.6" # x-release-please-version +__version__ = "1.17.7" # x-release-please-version From f6c9ee8b1713fee3b65a599c98653d6183d6e162 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 16:07:57 +0000 Subject: [PATCH 329/397] chore(internal/tests): avoid race condition with implicit client cleanup --- tests/test_client.py | 366 ++++++++++++++++++++++++------------------- 1 file changed, 202 insertions(+), 164 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 7b21288..feeeacf 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -60,51 +60,49 @@ def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: class TestOnebusawaySDK: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, client: OnebusawaySDK) -> None: + copied = client.copy() + assert id(copied) != id(client) - copied = self.client.copy(api_key="another My API Key") + copied = client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, client: OnebusawaySDK) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(client.timeout, httpx.Timeout) + copied = client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: client = OnebusawaySDK( @@ -139,6 +137,7 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.close() def test_copy_default_query(self) -> None: client = OnebusawaySDK( @@ -176,13 +175,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar", "key": api_key}) - def test_copy_signature(self) -> None: + client.close() + + def test_copy_signature(self, client: OnebusawaySDK) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -193,12 +194,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, client: OnebusawaySDK) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -255,14 +256,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + def test_request_timeout(self, client: OnebusawaySDK) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( - FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) - ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0))) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(100.0) @@ -275,6 +274,8 @@ def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + client.close() + def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: @@ -286,6 +287,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + client.close() + # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: client = OnebusawaySDK( @@ -296,6 +299,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + client.close() + # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = OnebusawaySDK( @@ -306,6 +311,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + client.close() + async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: @@ -317,14 +324,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = OnebusawaySDK( + test_client = OnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = OnebusawaySDK( + test_client2 = OnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -333,10 +340,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + test_client.close() + test_client2.close() + def test_default_query_option(self) -> None: client = OnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} @@ -355,8 +365,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + client.close() + + def test_request_extra_json(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -367,7 +379,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -378,7 +390,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -389,8 +401,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -400,7 +412,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -411,8 +423,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -425,7 +437,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo", "key": api_key} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -439,7 +451,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2", "key": api_key} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -482,7 +494,7 @@ def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter) -> None: + def test_basic_union_response(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: class Model1(BaseModel): name: str @@ -491,12 +503,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -507,18 +519,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, client: OnebusawaySDK + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -534,7 +548,7 @@ class Model(BaseModel): ) ) - response = self.client.get("/foo", cast_to=Model) + response = client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @@ -548,6 +562,8 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" + client.close() + def test_base_url_env(self) -> None: with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) @@ -578,6 +594,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: ) expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url + client.close() @pytest.mark.parametrize( "client", @@ -604,6 +621,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: ) expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url + client.close() @pytest.mark.parametrize( "client", @@ -630,35 +648,36 @@ def test_absolute_request_url(self, client: OnebusawaySDK) -> None: ) expected_url = f"https://myapi.com/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url + client.close() def test_copied_client_does_not_close_http(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied - assert not client.is_closed() + assert not test_client.is_closed() def test_client_context_manager(self) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - with client as c2: - assert c2 is client + test_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - self.client.get("/foo", cast_to=Model) + client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -680,11 +699,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = client.get("/foo", cast_to=Model) + response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + strict_client.close() + non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -707,9 +729,9 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, client: OnebusawaySDK + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) @@ -723,7 +745,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien with pytest.raises(APITimeoutError): client.current_time.with_streaming_response.retrieve().__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -732,7 +754,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client with pytest.raises(APIStatusError): client.current_time.with_streaming_response.retrieve().__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -834,83 +856,77 @@ def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - def test_follow_redirects(self, respx_mock: MockRouter) -> None: + def test_follow_redirects(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - self.client.post( - "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response - ) + client.post("/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response) assert exc_info.value.response.status_code == 302 assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" class TestAsyncOnebusawaySDK: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response(self, respx_mock: MockRouter) -> None: + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, async_client: AsyncOnebusawaySDK) -> None: + copied = async_client.copy() + assert id(copied) != id(async_client) - copied = self.client.copy(api_key="another My API Key") + copied = async_client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert async_client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, async_client: AsyncOnebusawaySDK) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert async_client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(async_client.timeout, httpx.Timeout) + copied = async_client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(async_client.timeout, httpx.Timeout) - def test_copy_default_headers(self) -> None: + async def test_copy_default_headers(self) -> None: client = AsyncOnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) @@ -943,8 +959,9 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + await client.close() - def test_copy_default_query(self) -> None: + async def test_copy_default_query(self) -> None: client = AsyncOnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) @@ -980,13 +997,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + await client.close() + + def test_copy_signature(self, async_client: AsyncOnebusawaySDK) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + async_client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(async_client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -997,12 +1016,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, async_client: AsyncOnebusawaySDK) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = async_client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -1058,12 +1077,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + async def test_request_timeout(self, async_client: AsyncOnebusawaySDK) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( + request = async_client._build_request( FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) ) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1078,6 +1097,8 @@ async def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + await client.close() + async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: @@ -1089,6 +1110,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + await client.close() + # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: client = AsyncOnebusawaySDK( @@ -1099,6 +1122,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + await client.close() + # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = AsyncOnebusawaySDK( @@ -1109,6 +1134,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + await client.close() + def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: @@ -1119,15 +1146,15 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) - def test_default_headers_option(self) -> None: - client = AsyncOnebusawaySDK( + async def test_default_headers_option(self) -> None: + test_client = AsyncOnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncOnebusawaySDK( + test_client2 = AsyncOnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1136,11 +1163,14 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" - def test_default_query_option(self) -> None: + await test_client.close() + await test_client2.close() + + async def test_default_query_option(self) -> None: client = AsyncOnebusawaySDK( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) @@ -1159,8 +1189,8 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + def test_request_extra_json(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1171,7 +1201,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1182,7 +1212,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1193,8 +1223,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1204,7 +1234,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1215,8 +1245,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1229,7 +1259,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo", "key": api_key} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1242,7 +1272,7 @@ def test_request_extra_query(self) -> None: params = dict(request.url.params) assert params == {"bar": "1", "foo": "2", "key": api_key} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1285,7 +1315,7 @@ def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> No ] @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: class Model1(BaseModel): name: str @@ -1294,12 +1324,14 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + async def test_union_response_different_types( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1310,18 +1342,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + async def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -1337,11 +1371,11 @@ class Model(BaseModel): ) ) - response = await self.client.get("/foo", cast_to=Model) + response = await async_client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 - def test_base_url_setter(self) -> None: + async def test_base_url_setter(self) -> None: client = AsyncOnebusawaySDK( base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True ) @@ -1351,7 +1385,9 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" - def test_base_url_env(self) -> None: + await client.close() + + async def test_base_url_env(self) -> None: with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @@ -1371,7 +1407,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: + async def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1381,6 +1417,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ) excepted_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == excepted_url + await client.close() @pytest.mark.parametrize( "client", @@ -1397,7 +1434,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1408,6 +1445,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url + await client.close() @pytest.mark.parametrize( "client", @@ -1424,7 +1462,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: + async def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1434,37 +1472,39 @@ def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: ) expected_url = f"https://myapi.com/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url + await client.close() async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied await asyncio.sleep(0.2) - assert not client.is_closed() + assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async with client as c2: - assert c2 is client + test_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + async def test_client_response_validation_error( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - await self.client.get("/foo", cast_to=Model) + await async_client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -1475,7 +1515,6 @@ async def test_client_max_retries_validation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): name: str @@ -1487,11 +1526,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = await client.get("/foo", cast_to=Model) + response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + await strict_client.close() + await non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -1514,13 +1556,12 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - @pytest.mark.asyncio - async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + async def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncOnebusawaySDK + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) - calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1533,7 +1574,7 @@ async def test_retrying_timeout_errors_doesnt_leak( with pytest.raises(APITimeoutError): await async_client.current_time.with_streaming_response.retrieve().__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1544,12 +1585,11 @@ async def test_retrying_status_errors_doesnt_leak( with pytest.raises(APIStatusError): await async_client.current_time.with_streaming_response.retrieve().__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( self, @@ -1581,7 +1621,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_omit_retry_count_header( self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1607,7 +1646,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_overwrite_retry_count_header( self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1655,26 +1693,26 @@ async def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = await async_client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - await self.client.post( + await async_client.post( "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response ) From aa8df91bb2ba826f49bacf3a2a777579931487d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 06:10:04 +0000 Subject: [PATCH 330/397] chore(internal): grammar fix (it's -> its) --- src/onebusaway/_utils/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py index 50d5926..eec7f4a 100644 --- a/src/onebusaway/_utils/_utils.py +++ b/src/onebusaway/_utils/_utils.py @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input From b633259385cddf32422b425a174a2a7dbe34021c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 16:09:51 +0000 Subject: [PATCH 331/397] chore(package): drop Python 3.8 support --- README.md | 4 ++-- pyproject.toml | 5 ++--- src/onebusaway/_utils/_sync.py | 34 +++------------------------------- 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 66f764f..dc90695 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg?label=pypi%20(stable))](https://pypi.org/project/onebusaway/) -The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.8+ +The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -355,7 +355,7 @@ print(onebusaway.__version__) ## Requirements -Python 3.8 or higher. +Python 3.9 or higher. ## Contributing diff --git a/pyproject.toml b/pyproject.toml index 5c9db68..c6d69b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,11 +15,10 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -141,7 +140,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.8" +pythonVersion = "3.9" exclude = [ "_dev", diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py index ad7ec71..f6027c1 100644 --- a/src/onebusaway/_utils/_sync.py +++ b/src/onebusaway/_utils/_sync.py @@ -1,10 +1,8 @@ from __future__ import annotations -import sys import asyncio import functools -import contextvars -from typing import Any, TypeVar, Callable, Awaitable +from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio @@ -15,34 +13,11 @@ T_ParamSpec = ParamSpec("T_ParamSpec") -if sys.version_info >= (3, 9): - _asyncio_to_thread = asyncio.to_thread -else: - # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread - # for Python 3.8 support - async def _asyncio_to_thread( - func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs - ) -> Any: - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Returns a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = asyncio.events.get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(None, func_call) - - async def to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> T_Retval: if sniffio.current_async_library() == "asyncio": - return await _asyncio_to_thread(func, *args, **kwargs) + return await asyncio.to_thread(func, *args, **kwargs) return await anyio.to_thread.run_sync( functools.partial(func, *args, **kwargs), @@ -53,10 +28,7 @@ async def to_thread( def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments. For python version 3.9 and above, it uses - asyncio.to_thread to run the function in a separate thread. For python version - 3.8, it uses locally defined copy of the asyncio.to_thread function which was - introduced in python 3.9. + positional and keyword arguments. Usage: From 2ebc5184554db31387b2f683265720d58dd9bb2f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 06:04:11 +0000 Subject: [PATCH 332/397] fix: compat with Python 3.14 --- src/onebusaway/_models.py | 11 ++++++++--- tests/test_models.py | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 6a3cd1d..fcec2cf 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -2,6 +2,7 @@ import os import inspect +import weakref from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( @@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -615,8 +619,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details diff --git a/tests/test_models.py b/tests/test_models.py index 7f54642..f73d5e1 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -9,7 +9,7 @@ from onebusaway._utils import PropertyInfo from onebusaway._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from onebusaway._models import BaseModel, construct_type +from onebusaway._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -809,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -818,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -830,7 +830,7 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator @pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") From 37abc5b808843321a5011b935590c5d3455f0c27 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 05:40:09 +0000 Subject: [PATCH 333/397] fix(compat): update signatures of `model_dump` and `model_dump_json` for Pydantic v1 --- src/onebusaway/_models.py | 41 +++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index fcec2cf..ca9500b 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -257,15 +257,16 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, - serialize_as_any: bool = False, fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -273,16 +274,24 @@ def model_dump( Args: mode: The mode in which `to_python` should run. - If mode is 'json', the dictionary will only contain JSON serializable types. - If mode is 'python', the dictionary may contain any Python objects. - include: A list of fields to include in the output. - exclude: A list of fields to exclude from the output. + If mode is 'json', the output will only contain JSON serializable types. + If mode is 'python', the output may contain non-JSON-serializable Python objects. + include: A set of fields to include in the output. + exclude: A set of fields to exclude from the output. + context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. - exclude_unset: Whether to exclude fields that are unset or None from the output. - exclude_defaults: Whether to exclude fields that are set to their default value from the output. - exclude_none: Whether to exclude fields that have a value of `None` from the output. - round_trip: Whether to enable serialization and deserialization round-trip support. - warnings: Whether to log warnings when invalid fields are encountered. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value. + exclude_none: Whether to exclude fields that have a value of `None`. + exclude_computed_fields: Whether to exclude computed fields. + While this can be useful for round-tripping, it is usually recommended to use the dedicated + `round_trip` parameter instead. + round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + fallback: A function to call when an unknown value is encountered. If not provided, + a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. @@ -299,6 +308,8 @@ def model_dump( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, @@ -315,15 +326,17 @@ def model_dump_json( self, *, indent: int | None = None, + ensure_ascii: bool = False, include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: @@ -355,6 +368,10 @@ def model_dump_json( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if ensure_ascii != False: + raise ValueError("ensure_ascii is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, From 5ba9679c37d905d2b994fb3ad033825142ee19e2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 05:10:10 +0000 Subject: [PATCH 334/397] chore: add Python 3.14 classifier and testing --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index c6d69b4..f6f299d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", From 75f1288ddc3202c2fe6850b8f968720ed88cb470 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Nov 2025 03:47:49 +0000 Subject: [PATCH 335/397] fix: ensure streams are always closed --- src/onebusaway/_streaming.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 19eceeb..288db03 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self From 167648d8fb485e522aa49611ee25523190b78c9a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Nov 2025 03:49:18 +0000 Subject: [PATCH 336/397] chore(deps): mypy 1.18.1 has a regression, pin to 1.17 --- pyproject.toml | 2 +- requirements-dev.lock | 4 +++- requirements.lock | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f6f299d..b83c0ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 41b54ec..27d3dd3 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -72,7 +72,7 @@ mdurl==0.1.2 multidict==6.4.4 # via aiohttp # via yarl -mypy==1.14.1 +mypy==1.17.0 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 @@ -81,6 +81,8 @@ nox==2023.4.22 packaging==23.2 # via nox # via pytest +pathspec==0.12.1 + # via mypy platformdirs==3.11.0 # via virtualenv pluggy==1.5.0 diff --git a/requirements.lock b/requirements.lock index 11442de..d7c68e1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,21 +55,21 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via onebusaway -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic sniffio==1.3.0 # via anyio # via onebusaway -typing-extensions==4.12.2 +typing-extensions==4.15.0 # via anyio # via multidict # via onebusaway # via pydantic # via pydantic-core # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic yarl==1.20.0 # via aiohttp From 4fd805dfa1c4efe2fd53d7aa46c75e368c97463f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 07:45:52 +0000 Subject: [PATCH 337/397] chore: update lockfile --- pyproject.toml | 14 +++--- requirements-dev.lock | 108 +++++++++++++++++++++++------------------- requirements.lock | 31 ++++++------ 3 files changed, 83 insertions(+), 70 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b83c0ec..9f61ec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,16 @@ license = "Apache-2.0" authors = [ { name = "Onebusaway SDK", email = "info@onebusaway.org" }, ] + dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] + requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", diff --git a/requirements-dev.lock b/requirements-dev.lock index 27d3dd3..69573c8 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,40 +12,45 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via httpx-aiohttp # via onebusaway -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via httpx # via onebusaway -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 + # via nox +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2025.11.12 # via httpcore # via httpx -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via onebusaway -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio # via pytest -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -filelock==3.12.4 +filelock==3.19.1 # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -58,82 +63,87 @@ httpx==0.28.1 # via respx httpx-aiohttp==0.1.9 # via onebusaway -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==7.0.0 -iniconfig==2.0.0 +importlib-metadata==8.7.0 +iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl mypy==1.17.0 -mypy-extensions==1.0.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.9.1 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest pathspec==0.12.1 # via mypy -platformdirs==3.11.0 +platformdirs==4.4.0 # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via onebusaway -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pygments==2.18.0 +pygments==2.19.2 + # via pytest # via rich pyright==1.1.399 -pytest==8.3.3 +pytest==8.4.2 # via pytest-asyncio # via pytest-xdist -pytest-asyncio==0.24.0 -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via time-machine -pytz==2023.3.post1 - # via dirty-equals respx==0.22.0 -rich==13.7.1 -ruff==0.9.4 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +rich==14.2.0 +ruff==0.14.7 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via onebusaway -time-machine==2.9.0 -tomli==2.0.2 +time-machine==2.19.0 +tomli==2.3.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via multidict # via mypy # via onebusaway # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic -virtualenv==20.24.5 +virtualenv==20.35.4 # via nox -yarl==1.20.0 +yarl==1.22.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index d7c68e1..2c479e1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,28 +12,28 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via httpx-aiohttp # via onebusaway -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via httpx # via onebusaway async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 +certifi==2025.11.12 # via httpcore # via httpx -distro==1.8.0 +distro==1.9.0 # via onebusaway -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -45,25 +45,26 @@ httpx==0.28.1 # via onebusaway httpx-aiohttp==0.1.9 # via onebusaway -idna==3.4 +idna==3.11 # via anyio # via httpx # via yarl -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl pydantic==2.12.5 # via onebusaway pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via onebusaway typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via multidict # via onebusaway # via pydantic @@ -71,5 +72,5 @@ typing-extensions==4.15.0 # via typing-inspection typing-inspection==0.4.2 # via pydantic -yarl==1.20.0 +yarl==1.22.0 # via aiohttp From a2ac5df1da8f164cbe85325385266b5340fd361b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 07:56:00 +0000 Subject: [PATCH 338/397] chore(docs): use environment variables for authentication in code snippets --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc90695..1d0febd 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ pip install onebusaway[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python +import os import asyncio from onebusaway import DefaultAioHttpClient from onebusaway import AsyncOnebusawaySDK @@ -86,7 +87,7 @@ from onebusaway import AsyncOnebusawaySDK async def main() -> None: async with AsyncOnebusawaySDK( - api_key="My API Key", + api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: current_time = await client.current_time.retrieve() From f10f3734af08ea934c7b5be9de0cd2af106afaea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 05:41:05 +0000 Subject: [PATCH 339/397] fix(types): allow pyright to infer TypedDict types within SequenceNotStr --- src/onebusaway/_types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index f005a2e..93ca645 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case From 5daefdde179696d3ade876b33b94fb79f5972155 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 05:42:38 +0000 Subject: [PATCH 340/397] chore: add missing docstrings --- src/onebusaway/types/arrival_and_departure_list_response.py | 6 ++++++ .../types/arrival_and_departure_retrieve_response.py | 6 ++++++ src/onebusaway/types/trip_detail_retrieve_response.py | 4 ++++ src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 4 ++++ src/onebusaway/types/trips_for_location_list_response.py | 4 ++++ src/onebusaway/types/trips_for_route_list_response.py | 4 ++++ src/onebusaway/types/vehicles_for_agency_list_response.py | 4 ++++ 7 files changed, 32 insertions(+) diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index cbabf18..cb8aeb3 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -20,6 +20,8 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -28,6 +30,8 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLast class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -36,6 +40,8 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): + """Trip-specific status for the arriving transit vehicle.""" + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index a0bc771..a4ed922 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -19,6 +19,8 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -27,6 +29,8 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(Ba class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -35,6 +39,8 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): + """Trip-specific status for the arriving transit vehicle.""" + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 4b76689..cb1552c 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -47,6 +47,8 @@ class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -55,6 +57,8 @@ class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 136b96c..3ee8582 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -47,6 +47,8 @@ class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -55,6 +57,8 @@ class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 68ae881..b104313 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -47,6 +47,8 @@ class TripsForLocationListResponseDataListSchedule(BaseModel): class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -55,6 +57,8 @@ class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): class TripsForLocationListResponseDataListStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index f9bc2d8..f373c34 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -47,6 +47,8 @@ class TripsForRouteListResponseDataListSchedule(BaseModel): class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -55,6 +57,8 @@ class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): class TripsForRouteListResponseDataListStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 34601dd..f40d3a9 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -26,6 +26,8 @@ class VehiclesForAgencyListResponseDataListLocation(BaseModel): class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -34,6 +36,8 @@ class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" From 17442243ef6d3ca342ac4294de2257e59fdd7da4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 05:20:48 +0000 Subject: [PATCH 341/397] chore(internal): add missing files argument to base client --- src/onebusaway/_base_client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 2f2004e..99208e6 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1247,9 +1247,12 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return self.request(cast_to, opts) def put( @@ -1767,9 +1770,12 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return await self.request(cast_to, opts) async def put( From d938f6643cf144bb8db22d8c89024785ff5fdd97 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Dec 2025 08:06:48 +0000 Subject: [PATCH 342/397] chore: speedup initial import --- src/onebusaway/_client.py | 1465 ++++++++++++++++++++++++++++--------- 1 file changed, 1100 insertions(+), 365 deletions(-) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 7688a85..5923bba 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Mapping +from typing import TYPE_CHECKING, Any, Mapping from typing_extensions import Self, override import httpx @@ -20,37 +20,8 @@ not_given, ) from ._utils import is_given, get_async_library +from ._compat import cached_property from ._version import __version__ -from .resources import ( - stop, - trip, - block, - route, - shape, - agency, - config, - current_time, - trip_details, - search_for_stop, - stops_for_route, - trips_for_route, - search_for_route, - stops_for_agency, - trip_for_vehicle, - routes_for_agency, - schedule_for_stop, - schedule_for_route, - stops_for_location, - trips_for_location, - routes_for_location, - stop_ids_for_agency, - vehicles_for_agency, - route_ids_for_agency, - arrival_and_departure, - agencies_with_coverage, - report_problem_with_stop, - report_problem_with_trip, -) from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError, OnebusawaySDKError from ._base_client import ( @@ -59,6 +30,66 @@ AsyncAPIClient, ) +if TYPE_CHECKING: + from .resources import ( + stop, + trip, + block, + route, + shape, + agency, + config, + current_time, + trip_details, + search_for_stop, + stops_for_route, + trips_for_route, + search_for_route, + stops_for_agency, + trip_for_vehicle, + routes_for_agency, + schedule_for_stop, + schedule_for_route, + stops_for_location, + trips_for_location, + routes_for_location, + stop_ids_for_agency, + vehicles_for_agency, + route_ids_for_agency, + arrival_and_departure, + agencies_with_coverage, + report_problem_with_stop, + report_problem_with_trip, + ) + from .resources.stop import StopResource, AsyncStopResource + from .resources.trip import TripResource, AsyncTripResource + from .resources.block import BlockResource, AsyncBlockResource + from .resources.route import RouteResource, AsyncRouteResource + from .resources.shape import ShapeResource, AsyncShapeResource + from .resources.agency import AgencyResource, AsyncAgencyResource + from .resources.config import ConfigResource, AsyncConfigResource + from .resources.current_time import CurrentTimeResource, AsyncCurrentTimeResource + from .resources.trip_details import TripDetailsResource, AsyncTripDetailsResource + from .resources.search_for_stop import SearchForStopResource, AsyncSearchForStopResource + from .resources.stops_for_route import StopsForRouteResource, AsyncStopsForRouteResource + from .resources.trips_for_route import TripsForRouteResource, AsyncTripsForRouteResource + from .resources.search_for_route import SearchForRouteResource, AsyncSearchForRouteResource + from .resources.stops_for_agency import StopsForAgencyResource, AsyncStopsForAgencyResource + from .resources.trip_for_vehicle import TripForVehicleResource, AsyncTripForVehicleResource + from .resources.routes_for_agency import RoutesForAgencyResource, AsyncRoutesForAgencyResource + from .resources.schedule_for_stop import ScheduleForStopResource, AsyncScheduleForStopResource + from .resources.schedule_for_route import ScheduleForRouteResource, AsyncScheduleForRouteResource + from .resources.stops_for_location import StopsForLocationResource, AsyncStopsForLocationResource + from .resources.trips_for_location import TripsForLocationResource, AsyncTripsForLocationResource + from .resources.routes_for_location import RoutesForLocationResource, AsyncRoutesForLocationResource + from .resources.stop_ids_for_agency import StopIDsForAgencyResource, AsyncStopIDsForAgencyResource + from .resources.vehicles_for_agency import VehiclesForAgencyResource, AsyncVehiclesForAgencyResource + from .resources.route_ids_for_agency import RouteIDsForAgencyResource, AsyncRouteIDsForAgencyResource + from .resources.arrival_and_departure import ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource + from .resources.agencies_with_coverage import AgenciesWithCoverageResource, AsyncAgenciesWithCoverageResource + from .resources.report_problem_with_stop import ReportProblemWithStopResource, AsyncReportProblemWithStopResource + from .resources.report_problem_with_trip import ReportProblemWithTripResource, AsyncReportProblemWithTripResource + __all__ = [ "Timeout", "Transport", @@ -72,37 +103,6 @@ class OnebusawaySDK(SyncAPIClient): - agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource - agency: agency.AgencyResource - vehicles_for_agency: vehicles_for_agency.VehiclesForAgencyResource - config: config.ConfigResource - current_time: current_time.CurrentTimeResource - stops_for_location: stops_for_location.StopsForLocationResource - stops_for_route: stops_for_route.StopsForRouteResource - stops_for_agency: stops_for_agency.StopsForAgencyResource - stop: stop.StopResource - stop_ids_for_agency: stop_ids_for_agency.StopIDsForAgencyResource - schedule_for_stop: schedule_for_stop.ScheduleForStopResource - route: route.RouteResource - route_ids_for_agency: route_ids_for_agency.RouteIDsForAgencyResource - routes_for_location: routes_for_location.RoutesForLocationResource - routes_for_agency: routes_for_agency.RoutesForAgencyResource - schedule_for_route: schedule_for_route.ScheduleForRouteResource - arrival_and_departure: arrival_and_departure.ArrivalAndDepartureResource - trip: trip.TripResource - trips_for_location: trips_for_location.TripsForLocationResource - trip_details: trip_details.TripDetailsResource - trip_for_vehicle: trip_for_vehicle.TripForVehicleResource - trips_for_route: trips_for_route.TripsForRouteResource - report_problem_with_stop: report_problem_with_stop.ReportProblemWithStopResource - report_problem_with_trip: report_problem_with_trip.ReportProblemWithTripResource - search_for_stop: search_for_stop.SearchForStopResource - search_for_route: search_for_route.SearchForRouteResource - block: block.BlockResource - shape: shape.ShapeResource - with_raw_response: OnebusawaySDKWithRawResponse - with_streaming_response: OnebusawaySDKWithStreamedResponse - # client options api_key: str @@ -157,36 +157,181 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResource(self) - self.agency = agency.AgencyResource(self) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResource(self) - self.config = config.ConfigResource(self) - self.current_time = current_time.CurrentTimeResource(self) - self.stops_for_location = stops_for_location.StopsForLocationResource(self) - self.stops_for_route = stops_for_route.StopsForRouteResource(self) - self.stops_for_agency = stops_for_agency.StopsForAgencyResource(self) - self.stop = stop.StopResource(self) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResource(self) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResource(self) - self.route = route.RouteResource(self) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResource(self) - self.routes_for_location = routes_for_location.RoutesForLocationResource(self) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResource(self) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResource(self) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResource(self) - self.trip = trip.TripResource(self) - self.trips_for_location = trips_for_location.TripsForLocationResource(self) - self.trip_details = trip_details.TripDetailsResource(self) - self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResource(self) - self.trips_for_route = trips_for_route.TripsForRouteResource(self) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResource(self) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResource(self) - self.search_for_stop = search_for_stop.SearchForStopResource(self) - self.search_for_route = search_for_route.SearchForRouteResource(self) - self.block = block.BlockResource(self) - self.shape = shape.ShapeResource(self) - self.with_raw_response = OnebusawaySDKWithRawResponse(self) - self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) + @cached_property + def agencies_with_coverage(self) -> AgenciesWithCoverageResource: + from .resources.agencies_with_coverage import AgenciesWithCoverageResource + + return AgenciesWithCoverageResource(self) + + @cached_property + def agency(self) -> AgencyResource: + from .resources.agency import AgencyResource + + return AgencyResource(self) + + @cached_property + def vehicles_for_agency(self) -> VehiclesForAgencyResource: + from .resources.vehicles_for_agency import VehiclesForAgencyResource + + return VehiclesForAgencyResource(self) + + @cached_property + def config(self) -> ConfigResource: + from .resources.config import ConfigResource + + return ConfigResource(self) + + @cached_property + def current_time(self) -> CurrentTimeResource: + from .resources.current_time import CurrentTimeResource + + return CurrentTimeResource(self) + + @cached_property + def stops_for_location(self) -> StopsForLocationResource: + from .resources.stops_for_location import StopsForLocationResource + + return StopsForLocationResource(self) + + @cached_property + def stops_for_route(self) -> StopsForRouteResource: + from .resources.stops_for_route import StopsForRouteResource + + return StopsForRouteResource(self) + + @cached_property + def stops_for_agency(self) -> StopsForAgencyResource: + from .resources.stops_for_agency import StopsForAgencyResource + + return StopsForAgencyResource(self) + + @cached_property + def stop(self) -> StopResource: + from .resources.stop import StopResource + + return StopResource(self) + + @cached_property + def stop_ids_for_agency(self) -> StopIDsForAgencyResource: + from .resources.stop_ids_for_agency import StopIDsForAgencyResource + + return StopIDsForAgencyResource(self) + + @cached_property + def schedule_for_stop(self) -> ScheduleForStopResource: + from .resources.schedule_for_stop import ScheduleForStopResource + + return ScheduleForStopResource(self) + + @cached_property + def route(self) -> RouteResource: + from .resources.route import RouteResource + + return RouteResource(self) + + @cached_property + def route_ids_for_agency(self) -> RouteIDsForAgencyResource: + from .resources.route_ids_for_agency import RouteIDsForAgencyResource + + return RouteIDsForAgencyResource(self) + + @cached_property + def routes_for_location(self) -> RoutesForLocationResource: + from .resources.routes_for_location import RoutesForLocationResource + + return RoutesForLocationResource(self) + + @cached_property + def routes_for_agency(self) -> RoutesForAgencyResource: + from .resources.routes_for_agency import RoutesForAgencyResource + + return RoutesForAgencyResource(self) + + @cached_property + def schedule_for_route(self) -> ScheduleForRouteResource: + from .resources.schedule_for_route import ScheduleForRouteResource + + return ScheduleForRouteResource(self) + + @cached_property + def arrival_and_departure(self) -> ArrivalAndDepartureResource: + from .resources.arrival_and_departure import ArrivalAndDepartureResource + + return ArrivalAndDepartureResource(self) + + @cached_property + def trip(self) -> TripResource: + from .resources.trip import TripResource + + return TripResource(self) + + @cached_property + def trips_for_location(self) -> TripsForLocationResource: + from .resources.trips_for_location import TripsForLocationResource + + return TripsForLocationResource(self) + + @cached_property + def trip_details(self) -> TripDetailsResource: + from .resources.trip_details import TripDetailsResource + + return TripDetailsResource(self) + + @cached_property + def trip_for_vehicle(self) -> TripForVehicleResource: + from .resources.trip_for_vehicle import TripForVehicleResource + + return TripForVehicleResource(self) + + @cached_property + def trips_for_route(self) -> TripsForRouteResource: + from .resources.trips_for_route import TripsForRouteResource + + return TripsForRouteResource(self) + + @cached_property + def report_problem_with_stop(self) -> ReportProblemWithStopResource: + from .resources.report_problem_with_stop import ReportProblemWithStopResource + + return ReportProblemWithStopResource(self) + + @cached_property + def report_problem_with_trip(self) -> ReportProblemWithTripResource: + from .resources.report_problem_with_trip import ReportProblemWithTripResource + + return ReportProblemWithTripResource(self) + + @cached_property + def search_for_stop(self) -> SearchForStopResource: + from .resources.search_for_stop import SearchForStopResource + + return SearchForStopResource(self) + + @cached_property + def search_for_route(self) -> SearchForRouteResource: + from .resources.search_for_route import SearchForRouteResource + + return SearchForRouteResource(self) + + @cached_property + def block(self) -> BlockResource: + from .resources.block import BlockResource + + return BlockResource(self) + + @cached_property + def shape(self) -> ShapeResource: + from .resources.shape import ShapeResource + + return ShapeResource(self) + + @cached_property + def with_raw_response(self) -> OnebusawaySDKWithRawResponse: + return OnebusawaySDKWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OnebusawaySDKWithStreamedResponse: + return OnebusawaySDKWithStreamedResponse(self) @property @override @@ -305,37 +450,6 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): - agencies_with_coverage: agencies_with_coverage.AsyncAgenciesWithCoverageResource - agency: agency.AsyncAgencyResource - vehicles_for_agency: vehicles_for_agency.AsyncVehiclesForAgencyResource - config: config.AsyncConfigResource - current_time: current_time.AsyncCurrentTimeResource - stops_for_location: stops_for_location.AsyncStopsForLocationResource - stops_for_route: stops_for_route.AsyncStopsForRouteResource - stops_for_agency: stops_for_agency.AsyncStopsForAgencyResource - stop: stop.AsyncStopResource - stop_ids_for_agency: stop_ids_for_agency.AsyncStopIDsForAgencyResource - schedule_for_stop: schedule_for_stop.AsyncScheduleForStopResource - route: route.AsyncRouteResource - route_ids_for_agency: route_ids_for_agency.AsyncRouteIDsForAgencyResource - routes_for_location: routes_for_location.AsyncRoutesForLocationResource - routes_for_agency: routes_for_agency.AsyncRoutesForAgencyResource - schedule_for_route: schedule_for_route.AsyncScheduleForRouteResource - arrival_and_departure: arrival_and_departure.AsyncArrivalAndDepartureResource - trip: trip.AsyncTripResource - trips_for_location: trips_for_location.AsyncTripsForLocationResource - trip_details: trip_details.AsyncTripDetailsResource - trip_for_vehicle: trip_for_vehicle.AsyncTripForVehicleResource - trips_for_route: trips_for_route.AsyncTripsForRouteResource - report_problem_with_stop: report_problem_with_stop.AsyncReportProblemWithStopResource - report_problem_with_trip: report_problem_with_trip.AsyncReportProblemWithTripResource - search_for_stop: search_for_stop.AsyncSearchForStopResource - search_for_route: search_for_route.AsyncSearchForRouteResource - block: block.AsyncBlockResource - shape: shape.AsyncShapeResource - with_raw_response: AsyncOnebusawaySDKWithRawResponse - with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse - # client options api_key: str @@ -390,36 +504,181 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResource(self) - self.agency = agency.AsyncAgencyResource(self) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResource(self) - self.config = config.AsyncConfigResource(self) - self.current_time = current_time.AsyncCurrentTimeResource(self) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResource(self) - self.stops_for_route = stops_for_route.AsyncStopsForRouteResource(self) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResource(self) - self.stop = stop.AsyncStopResource(self) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResource(self) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResource(self) - self.route = route.AsyncRouteResource(self) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResource(self) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResource(self) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResource(self) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResource(self) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResource(self) - self.trip = trip.AsyncTripResource(self) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResource(self) - self.trip_details = trip_details.AsyncTripDetailsResource(self) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResource(self) - self.trips_for_route = trips_for_route.AsyncTripsForRouteResource(self) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResource(self) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResource(self) - self.search_for_stop = search_for_stop.AsyncSearchForStopResource(self) - self.search_for_route = search_for_route.AsyncSearchForRouteResource(self) - self.block = block.AsyncBlockResource(self) - self.shape = shape.AsyncShapeResource(self) - self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) - self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) + @cached_property + def agencies_with_coverage(self) -> AsyncAgenciesWithCoverageResource: + from .resources.agencies_with_coverage import AsyncAgenciesWithCoverageResource + + return AsyncAgenciesWithCoverageResource(self) + + @cached_property + def agency(self) -> AsyncAgencyResource: + from .resources.agency import AsyncAgencyResource + + return AsyncAgencyResource(self) + + @cached_property + def vehicles_for_agency(self) -> AsyncVehiclesForAgencyResource: + from .resources.vehicles_for_agency import AsyncVehiclesForAgencyResource + + return AsyncVehiclesForAgencyResource(self) + + @cached_property + def config(self) -> AsyncConfigResource: + from .resources.config import AsyncConfigResource + + return AsyncConfigResource(self) + + @cached_property + def current_time(self) -> AsyncCurrentTimeResource: + from .resources.current_time import AsyncCurrentTimeResource + + return AsyncCurrentTimeResource(self) + + @cached_property + def stops_for_location(self) -> AsyncStopsForLocationResource: + from .resources.stops_for_location import AsyncStopsForLocationResource + + return AsyncStopsForLocationResource(self) + + @cached_property + def stops_for_route(self) -> AsyncStopsForRouteResource: + from .resources.stops_for_route import AsyncStopsForRouteResource + + return AsyncStopsForRouteResource(self) + + @cached_property + def stops_for_agency(self) -> AsyncStopsForAgencyResource: + from .resources.stops_for_agency import AsyncStopsForAgencyResource + + return AsyncStopsForAgencyResource(self) + + @cached_property + def stop(self) -> AsyncStopResource: + from .resources.stop import AsyncStopResource + + return AsyncStopResource(self) + + @cached_property + def stop_ids_for_agency(self) -> AsyncStopIDsForAgencyResource: + from .resources.stop_ids_for_agency import AsyncStopIDsForAgencyResource + + return AsyncStopIDsForAgencyResource(self) + + @cached_property + def schedule_for_stop(self) -> AsyncScheduleForStopResource: + from .resources.schedule_for_stop import AsyncScheduleForStopResource + + return AsyncScheduleForStopResource(self) + + @cached_property + def route(self) -> AsyncRouteResource: + from .resources.route import AsyncRouteResource + + return AsyncRouteResource(self) + + @cached_property + def route_ids_for_agency(self) -> AsyncRouteIDsForAgencyResource: + from .resources.route_ids_for_agency import AsyncRouteIDsForAgencyResource + + return AsyncRouteIDsForAgencyResource(self) + + @cached_property + def routes_for_location(self) -> AsyncRoutesForLocationResource: + from .resources.routes_for_location import AsyncRoutesForLocationResource + + return AsyncRoutesForLocationResource(self) + + @cached_property + def routes_for_agency(self) -> AsyncRoutesForAgencyResource: + from .resources.routes_for_agency import AsyncRoutesForAgencyResource + + return AsyncRoutesForAgencyResource(self) + + @cached_property + def schedule_for_route(self) -> AsyncScheduleForRouteResource: + from .resources.schedule_for_route import AsyncScheduleForRouteResource + + return AsyncScheduleForRouteResource(self) + + @cached_property + def arrival_and_departure(self) -> AsyncArrivalAndDepartureResource: + from .resources.arrival_and_departure import AsyncArrivalAndDepartureResource + + return AsyncArrivalAndDepartureResource(self) + + @cached_property + def trip(self) -> AsyncTripResource: + from .resources.trip import AsyncTripResource + + return AsyncTripResource(self) + + @cached_property + def trips_for_location(self) -> AsyncTripsForLocationResource: + from .resources.trips_for_location import AsyncTripsForLocationResource + + return AsyncTripsForLocationResource(self) + + @cached_property + def trip_details(self) -> AsyncTripDetailsResource: + from .resources.trip_details import AsyncTripDetailsResource + + return AsyncTripDetailsResource(self) + + @cached_property + def trip_for_vehicle(self) -> AsyncTripForVehicleResource: + from .resources.trip_for_vehicle import AsyncTripForVehicleResource + + return AsyncTripForVehicleResource(self) + + @cached_property + def trips_for_route(self) -> AsyncTripsForRouteResource: + from .resources.trips_for_route import AsyncTripsForRouteResource + + return AsyncTripsForRouteResource(self) + + @cached_property + def report_problem_with_stop(self) -> AsyncReportProblemWithStopResource: + from .resources.report_problem_with_stop import AsyncReportProblemWithStopResource + + return AsyncReportProblemWithStopResource(self) + + @cached_property + def report_problem_with_trip(self) -> AsyncReportProblemWithTripResource: + from .resources.report_problem_with_trip import AsyncReportProblemWithTripResource + + return AsyncReportProblemWithTripResource(self) + + @cached_property + def search_for_stop(self) -> AsyncSearchForStopResource: + from .resources.search_for_stop import AsyncSearchForStopResource + + return AsyncSearchForStopResource(self) + + @cached_property + def search_for_route(self) -> AsyncSearchForRouteResource: + from .resources.search_for_route import AsyncSearchForRouteResource + + return AsyncSearchForRouteResource(self) + + @cached_property + def block(self) -> AsyncBlockResource: + from .resources.block import AsyncBlockResource + + return AsyncBlockResource(self) + + @cached_property + def shape(self) -> AsyncShapeResource: + from .resources.shape import AsyncShapeResource + + return AsyncShapeResource(self) + + @cached_property + def with_raw_response(self) -> AsyncOnebusawaySDKWithRawResponse: + return AsyncOnebusawaySDKWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOnebusawaySDKWithStreamedResponse: + return AsyncOnebusawaySDKWithStreamedResponse(self) @property @override @@ -538,231 +797,707 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: + _client: OnebusawaySDK + def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) - self.agency = agency.AgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) - self.config = config.ConfigResourceWithRawResponse(client.config) - self.current_time = current_time.CurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = stops_for_location.StopsForLocationResourceWithRawResponse(client.stops_for_location) - self.stops_for_route = stops_for_route.StopsForRouteResourceWithRawResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) - self.stop = stop.StopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) - self.route = route.RouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) - self.trip = trip.TripResourceWithRawResponse(client.trip) - self.trips_for_location = trips_for_location.TripsForLocationResourceWithRawResponse(client.trips_for_location) - self.trip_details = trip_details.TripDetailsResourceWithRawResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) - self.trips_for_route = trips_for_route.TripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) - self.search_for_stop = search_for_stop.SearchForStopResourceWithRawResponse(client.search_for_stop) - self.search_for_route = search_for_route.SearchForRouteResourceWithRawResponse(client.search_for_route) - self.block = block.BlockResourceWithRawResponse(client.block) - self.shape = shape.ShapeResourceWithRawResponse(client.shape) + self._client = client + + @cached_property + def agencies_with_coverage(self) -> agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse: + from .resources.agencies_with_coverage import AgenciesWithCoverageResourceWithRawResponse + + return AgenciesWithCoverageResourceWithRawResponse(self._client.agencies_with_coverage) + + @cached_property + def agency(self) -> agency.AgencyResourceWithRawResponse: + from .resources.agency import AgencyResourceWithRawResponse + + return AgencyResourceWithRawResponse(self._client.agency) + + @cached_property + def vehicles_for_agency(self) -> vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse: + from .resources.vehicles_for_agency import VehiclesForAgencyResourceWithRawResponse + + return VehiclesForAgencyResourceWithRawResponse(self._client.vehicles_for_agency) + + @cached_property + def config(self) -> config.ConfigResourceWithRawResponse: + from .resources.config import ConfigResourceWithRawResponse + + return ConfigResourceWithRawResponse(self._client.config) + + @cached_property + def current_time(self) -> current_time.CurrentTimeResourceWithRawResponse: + from .resources.current_time import CurrentTimeResourceWithRawResponse + + return CurrentTimeResourceWithRawResponse(self._client.current_time) + + @cached_property + def stops_for_location(self) -> stops_for_location.StopsForLocationResourceWithRawResponse: + from .resources.stops_for_location import StopsForLocationResourceWithRawResponse + + return StopsForLocationResourceWithRawResponse(self._client.stops_for_location) + + @cached_property + def stops_for_route(self) -> stops_for_route.StopsForRouteResourceWithRawResponse: + from .resources.stops_for_route import StopsForRouteResourceWithRawResponse + + return StopsForRouteResourceWithRawResponse(self._client.stops_for_route) + + @cached_property + def stops_for_agency(self) -> stops_for_agency.StopsForAgencyResourceWithRawResponse: + from .resources.stops_for_agency import StopsForAgencyResourceWithRawResponse + + return StopsForAgencyResourceWithRawResponse(self._client.stops_for_agency) + + @cached_property + def stop(self) -> stop.StopResourceWithRawResponse: + from .resources.stop import StopResourceWithRawResponse + + return StopResourceWithRawResponse(self._client.stop) + + @cached_property + def stop_ids_for_agency(self) -> stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse: + from .resources.stop_ids_for_agency import StopIDsForAgencyResourceWithRawResponse + + return StopIDsForAgencyResourceWithRawResponse(self._client.stop_ids_for_agency) + + @cached_property + def schedule_for_stop(self) -> schedule_for_stop.ScheduleForStopResourceWithRawResponse: + from .resources.schedule_for_stop import ScheduleForStopResourceWithRawResponse + + return ScheduleForStopResourceWithRawResponse(self._client.schedule_for_stop) + + @cached_property + def route(self) -> route.RouteResourceWithRawResponse: + from .resources.route import RouteResourceWithRawResponse + + return RouteResourceWithRawResponse(self._client.route) + + @cached_property + def route_ids_for_agency(self) -> route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse: + from .resources.route_ids_for_agency import RouteIDsForAgencyResourceWithRawResponse + + return RouteIDsForAgencyResourceWithRawResponse(self._client.route_ids_for_agency) + + @cached_property + def routes_for_location(self) -> routes_for_location.RoutesForLocationResourceWithRawResponse: + from .resources.routes_for_location import RoutesForLocationResourceWithRawResponse + + return RoutesForLocationResourceWithRawResponse(self._client.routes_for_location) + + @cached_property + def routes_for_agency(self) -> routes_for_agency.RoutesForAgencyResourceWithRawResponse: + from .resources.routes_for_agency import RoutesForAgencyResourceWithRawResponse + + return RoutesForAgencyResourceWithRawResponse(self._client.routes_for_agency) + + @cached_property + def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithRawResponse: + from .resources.schedule_for_route import ScheduleForRouteResourceWithRawResponse + + return ScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + + @cached_property + def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse: + from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithRawResponse + + return ArrivalAndDepartureResourceWithRawResponse(self._client.arrival_and_departure) + + @cached_property + def trip(self) -> trip.TripResourceWithRawResponse: + from .resources.trip import TripResourceWithRawResponse + + return TripResourceWithRawResponse(self._client.trip) + + @cached_property + def trips_for_location(self) -> trips_for_location.TripsForLocationResourceWithRawResponse: + from .resources.trips_for_location import TripsForLocationResourceWithRawResponse + + return TripsForLocationResourceWithRawResponse(self._client.trips_for_location) + + @cached_property + def trip_details(self) -> trip_details.TripDetailsResourceWithRawResponse: + from .resources.trip_details import TripDetailsResourceWithRawResponse + + return TripDetailsResourceWithRawResponse(self._client.trip_details) + + @cached_property + def trip_for_vehicle(self) -> trip_for_vehicle.TripForVehicleResourceWithRawResponse: + from .resources.trip_for_vehicle import TripForVehicleResourceWithRawResponse + + return TripForVehicleResourceWithRawResponse(self._client.trip_for_vehicle) + + @cached_property + def trips_for_route(self) -> trips_for_route.TripsForRouteResourceWithRawResponse: + from .resources.trips_for_route import TripsForRouteResourceWithRawResponse + + return TripsForRouteResourceWithRawResponse(self._client.trips_for_route) + + @cached_property + def report_problem_with_stop(self) -> report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse: + from .resources.report_problem_with_stop import ReportProblemWithStopResourceWithRawResponse + + return ReportProblemWithStopResourceWithRawResponse(self._client.report_problem_with_stop) + + @cached_property + def report_problem_with_trip(self) -> report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse: + from .resources.report_problem_with_trip import ReportProblemWithTripResourceWithRawResponse + + return ReportProblemWithTripResourceWithRawResponse(self._client.report_problem_with_trip) + + @cached_property + def search_for_stop(self) -> search_for_stop.SearchForStopResourceWithRawResponse: + from .resources.search_for_stop import SearchForStopResourceWithRawResponse + + return SearchForStopResourceWithRawResponse(self._client.search_for_stop) + + @cached_property + def search_for_route(self) -> search_for_route.SearchForRouteResourceWithRawResponse: + from .resources.search_for_route import SearchForRouteResourceWithRawResponse + + return SearchForRouteResourceWithRawResponse(self._client.search_for_route) + + @cached_property + def block(self) -> block.BlockResourceWithRawResponse: + from .resources.block import BlockResourceWithRawResponse + + return BlockResourceWithRawResponse(self._client.block) + + @cached_property + def shape(self) -> shape.ShapeResourceWithRawResponse: + from .resources.shape import ShapeResourceWithRawResponse + + return ShapeResourceWithRawResponse(self._client.shape) class AsyncOnebusawaySDKWithRawResponse: + _client: AsyncOnebusawaySDK + def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) - self.agency = agency.AsyncAgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) - self.config = config.AsyncConfigResourceWithRawResponse(client.config) - self.current_time = current_time.AsyncCurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse( - client.stops_for_location - ) - self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) - self.stop = stop.AsyncStopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) - self.route = route.AsyncRouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) - self.trip = trip.AsyncTripResourceWithRawResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse( - client.trips_for_location - ) - self.trip_details = trip_details.AsyncTripDetailsResourceWithRawResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) - self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) - self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) - self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) - self.block = block.AsyncBlockResourceWithRawResponse(client.block) - self.shape = shape.AsyncShapeResourceWithRawResponse(client.shape) + self._client = client + + @cached_property + def agencies_with_coverage(self) -> agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse: + from .resources.agencies_with_coverage import AsyncAgenciesWithCoverageResourceWithRawResponse + + return AsyncAgenciesWithCoverageResourceWithRawResponse(self._client.agencies_with_coverage) + + @cached_property + def agency(self) -> agency.AsyncAgencyResourceWithRawResponse: + from .resources.agency import AsyncAgencyResourceWithRawResponse + + return AsyncAgencyResourceWithRawResponse(self._client.agency) + + @cached_property + def vehicles_for_agency(self) -> vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse: + from .resources.vehicles_for_agency import AsyncVehiclesForAgencyResourceWithRawResponse + + return AsyncVehiclesForAgencyResourceWithRawResponse(self._client.vehicles_for_agency) + + @cached_property + def config(self) -> config.AsyncConfigResourceWithRawResponse: + from .resources.config import AsyncConfigResourceWithRawResponse + + return AsyncConfigResourceWithRawResponse(self._client.config) + + @cached_property + def current_time(self) -> current_time.AsyncCurrentTimeResourceWithRawResponse: + from .resources.current_time import AsyncCurrentTimeResourceWithRawResponse + + return AsyncCurrentTimeResourceWithRawResponse(self._client.current_time) + + @cached_property + def stops_for_location(self) -> stops_for_location.AsyncStopsForLocationResourceWithRawResponse: + from .resources.stops_for_location import AsyncStopsForLocationResourceWithRawResponse + + return AsyncStopsForLocationResourceWithRawResponse(self._client.stops_for_location) + + @cached_property + def stops_for_route(self) -> stops_for_route.AsyncStopsForRouteResourceWithRawResponse: + from .resources.stops_for_route import AsyncStopsForRouteResourceWithRawResponse + + return AsyncStopsForRouteResourceWithRawResponse(self._client.stops_for_route) + + @cached_property + def stops_for_agency(self) -> stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse: + from .resources.stops_for_agency import AsyncStopsForAgencyResourceWithRawResponse + + return AsyncStopsForAgencyResourceWithRawResponse(self._client.stops_for_agency) + + @cached_property + def stop(self) -> stop.AsyncStopResourceWithRawResponse: + from .resources.stop import AsyncStopResourceWithRawResponse + + return AsyncStopResourceWithRawResponse(self._client.stop) + + @cached_property + def stop_ids_for_agency(self) -> stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse: + from .resources.stop_ids_for_agency import AsyncStopIDsForAgencyResourceWithRawResponse + + return AsyncStopIDsForAgencyResourceWithRawResponse(self._client.stop_ids_for_agency) + + @cached_property + def schedule_for_stop(self) -> schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse: + from .resources.schedule_for_stop import AsyncScheduleForStopResourceWithRawResponse + + return AsyncScheduleForStopResourceWithRawResponse(self._client.schedule_for_stop) + + @cached_property + def route(self) -> route.AsyncRouteResourceWithRawResponse: + from .resources.route import AsyncRouteResourceWithRawResponse + + return AsyncRouteResourceWithRawResponse(self._client.route) + + @cached_property + def route_ids_for_agency(self) -> route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse: + from .resources.route_ids_for_agency import AsyncRouteIDsForAgencyResourceWithRawResponse + + return AsyncRouteIDsForAgencyResourceWithRawResponse(self._client.route_ids_for_agency) + + @cached_property + def routes_for_location(self) -> routes_for_location.AsyncRoutesForLocationResourceWithRawResponse: + from .resources.routes_for_location import AsyncRoutesForLocationResourceWithRawResponse + + return AsyncRoutesForLocationResourceWithRawResponse(self._client.routes_for_location) + + @cached_property + def routes_for_agency(self) -> routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse: + from .resources.routes_for_agency import AsyncRoutesForAgencyResourceWithRawResponse + + return AsyncRoutesForAgencyResourceWithRawResponse(self._client.routes_for_agency) + + @cached_property + def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse: + from .resources.schedule_for_route import AsyncScheduleForRouteResourceWithRawResponse + + return AsyncScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + + @cached_property + def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse: + from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithRawResponse + + return AsyncArrivalAndDepartureResourceWithRawResponse(self._client.arrival_and_departure) + + @cached_property + def trip(self) -> trip.AsyncTripResourceWithRawResponse: + from .resources.trip import AsyncTripResourceWithRawResponse + + return AsyncTripResourceWithRawResponse(self._client.trip) + + @cached_property + def trips_for_location(self) -> trips_for_location.AsyncTripsForLocationResourceWithRawResponse: + from .resources.trips_for_location import AsyncTripsForLocationResourceWithRawResponse + + return AsyncTripsForLocationResourceWithRawResponse(self._client.trips_for_location) + + @cached_property + def trip_details(self) -> trip_details.AsyncTripDetailsResourceWithRawResponse: + from .resources.trip_details import AsyncTripDetailsResourceWithRawResponse + + return AsyncTripDetailsResourceWithRawResponse(self._client.trip_details) + + @cached_property + def trip_for_vehicle(self) -> trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse: + from .resources.trip_for_vehicle import AsyncTripForVehicleResourceWithRawResponse + + return AsyncTripForVehicleResourceWithRawResponse(self._client.trip_for_vehicle) + + @cached_property + def trips_for_route(self) -> trips_for_route.AsyncTripsForRouteResourceWithRawResponse: + from .resources.trips_for_route import AsyncTripsForRouteResourceWithRawResponse + + return AsyncTripsForRouteResourceWithRawResponse(self._client.trips_for_route) + + @cached_property + def report_problem_with_stop(self) -> report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse: + from .resources.report_problem_with_stop import AsyncReportProblemWithStopResourceWithRawResponse + + return AsyncReportProblemWithStopResourceWithRawResponse(self._client.report_problem_with_stop) + + @cached_property + def report_problem_with_trip(self) -> report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse: + from .resources.report_problem_with_trip import AsyncReportProblemWithTripResourceWithRawResponse + + return AsyncReportProblemWithTripResourceWithRawResponse(self._client.report_problem_with_trip) + + @cached_property + def search_for_stop(self) -> search_for_stop.AsyncSearchForStopResourceWithRawResponse: + from .resources.search_for_stop import AsyncSearchForStopResourceWithRawResponse + + return AsyncSearchForStopResourceWithRawResponse(self._client.search_for_stop) + + @cached_property + def search_for_route(self) -> search_for_route.AsyncSearchForRouteResourceWithRawResponse: + from .resources.search_for_route import AsyncSearchForRouteResourceWithRawResponse + + return AsyncSearchForRouteResourceWithRawResponse(self._client.search_for_route) + + @cached_property + def block(self) -> block.AsyncBlockResourceWithRawResponse: + from .resources.block import AsyncBlockResourceWithRawResponse + + return AsyncBlockResourceWithRawResponse(self._client.block) + + @cached_property + def shape(self) -> shape.AsyncShapeResourceWithRawResponse: + from .resources.shape import AsyncShapeResourceWithRawResponse + + return AsyncShapeResourceWithRawResponse(self._client.shape) class OnebusawaySDKWithStreamedResponse: + _client: OnebusawaySDK + def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) - self.agency = agency.AgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) - self.config = config.ConfigResourceWithStreamingResponse(client.config) - self.current_time = current_time.CurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) - self.stops_for_route = stops_for_route.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) - self.stop = stop.StopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) - self.route = route.RouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) - self.trip = trip.TripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) - self.trip_details = trip_details.TripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) - self.trips_for_route = trips_for_route.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) - self.search_for_stop = search_for_stop.SearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = search_for_route.SearchForRouteResourceWithStreamingResponse(client.search_for_route) - self.block = block.BlockResourceWithStreamingResponse(client.block) - self.shape = shape.ShapeResourceWithStreamingResponse(client.shape) + self._client = client + + @cached_property + def agencies_with_coverage(self) -> agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse: + from .resources.agencies_with_coverage import AgenciesWithCoverageResourceWithStreamingResponse + + return AgenciesWithCoverageResourceWithStreamingResponse(self._client.agencies_with_coverage) + + @cached_property + def agency(self) -> agency.AgencyResourceWithStreamingResponse: + from .resources.agency import AgencyResourceWithStreamingResponse + + return AgencyResourceWithStreamingResponse(self._client.agency) + + @cached_property + def vehicles_for_agency(self) -> vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse: + from .resources.vehicles_for_agency import VehiclesForAgencyResourceWithStreamingResponse + + return VehiclesForAgencyResourceWithStreamingResponse(self._client.vehicles_for_agency) + + @cached_property + def config(self) -> config.ConfigResourceWithStreamingResponse: + from .resources.config import ConfigResourceWithStreamingResponse + + return ConfigResourceWithStreamingResponse(self._client.config) + + @cached_property + def current_time(self) -> current_time.CurrentTimeResourceWithStreamingResponse: + from .resources.current_time import CurrentTimeResourceWithStreamingResponse + + return CurrentTimeResourceWithStreamingResponse(self._client.current_time) + + @cached_property + def stops_for_location(self) -> stops_for_location.StopsForLocationResourceWithStreamingResponse: + from .resources.stops_for_location import StopsForLocationResourceWithStreamingResponse + + return StopsForLocationResourceWithStreamingResponse(self._client.stops_for_location) + + @cached_property + def stops_for_route(self) -> stops_for_route.StopsForRouteResourceWithStreamingResponse: + from .resources.stops_for_route import StopsForRouteResourceWithStreamingResponse + + return StopsForRouteResourceWithStreamingResponse(self._client.stops_for_route) + + @cached_property + def stops_for_agency(self) -> stops_for_agency.StopsForAgencyResourceWithStreamingResponse: + from .resources.stops_for_agency import StopsForAgencyResourceWithStreamingResponse + + return StopsForAgencyResourceWithStreamingResponse(self._client.stops_for_agency) + + @cached_property + def stop(self) -> stop.StopResourceWithStreamingResponse: + from .resources.stop import StopResourceWithStreamingResponse + + return StopResourceWithStreamingResponse(self._client.stop) + + @cached_property + def stop_ids_for_agency(self) -> stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse: + from .resources.stop_ids_for_agency import StopIDsForAgencyResourceWithStreamingResponse + + return StopIDsForAgencyResourceWithStreamingResponse(self._client.stop_ids_for_agency) + + @cached_property + def schedule_for_stop(self) -> schedule_for_stop.ScheduleForStopResourceWithStreamingResponse: + from .resources.schedule_for_stop import ScheduleForStopResourceWithStreamingResponse + + return ScheduleForStopResourceWithStreamingResponse(self._client.schedule_for_stop) + + @cached_property + def route(self) -> route.RouteResourceWithStreamingResponse: + from .resources.route import RouteResourceWithStreamingResponse + + return RouteResourceWithStreamingResponse(self._client.route) + + @cached_property + def route_ids_for_agency(self) -> route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse: + from .resources.route_ids_for_agency import RouteIDsForAgencyResourceWithStreamingResponse + + return RouteIDsForAgencyResourceWithStreamingResponse(self._client.route_ids_for_agency) + + @cached_property + def routes_for_location(self) -> routes_for_location.RoutesForLocationResourceWithStreamingResponse: + from .resources.routes_for_location import RoutesForLocationResourceWithStreamingResponse + + return RoutesForLocationResourceWithStreamingResponse(self._client.routes_for_location) + + @cached_property + def routes_for_agency(self) -> routes_for_agency.RoutesForAgencyResourceWithStreamingResponse: + from .resources.routes_for_agency import RoutesForAgencyResourceWithStreamingResponse + + return RoutesForAgencyResourceWithStreamingResponse(self._client.routes_for_agency) + + @cached_property + def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithStreamingResponse: + from .resources.schedule_for_route import ScheduleForRouteResourceWithStreamingResponse + + return ScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + + @cached_property + def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse: + from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithStreamingResponse + + return ArrivalAndDepartureResourceWithStreamingResponse(self._client.arrival_and_departure) + + @cached_property + def trip(self) -> trip.TripResourceWithStreamingResponse: + from .resources.trip import TripResourceWithStreamingResponse + + return TripResourceWithStreamingResponse(self._client.trip) + + @cached_property + def trips_for_location(self) -> trips_for_location.TripsForLocationResourceWithStreamingResponse: + from .resources.trips_for_location import TripsForLocationResourceWithStreamingResponse + + return TripsForLocationResourceWithStreamingResponse(self._client.trips_for_location) + + @cached_property + def trip_details(self) -> trip_details.TripDetailsResourceWithStreamingResponse: + from .resources.trip_details import TripDetailsResourceWithStreamingResponse + + return TripDetailsResourceWithStreamingResponse(self._client.trip_details) + + @cached_property + def trip_for_vehicle(self) -> trip_for_vehicle.TripForVehicleResourceWithStreamingResponse: + from .resources.trip_for_vehicle import TripForVehicleResourceWithStreamingResponse + + return TripForVehicleResourceWithStreamingResponse(self._client.trip_for_vehicle) + + @cached_property + def trips_for_route(self) -> trips_for_route.TripsForRouteResourceWithStreamingResponse: + from .resources.trips_for_route import TripsForRouteResourceWithStreamingResponse + + return TripsForRouteResourceWithStreamingResponse(self._client.trips_for_route) + + @cached_property + def report_problem_with_stop(self) -> report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse: + from .resources.report_problem_with_stop import ReportProblemWithStopResourceWithStreamingResponse + + return ReportProblemWithStopResourceWithStreamingResponse(self._client.report_problem_with_stop) + + @cached_property + def report_problem_with_trip(self) -> report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse: + from .resources.report_problem_with_trip import ReportProblemWithTripResourceWithStreamingResponse + + return ReportProblemWithTripResourceWithStreamingResponse(self._client.report_problem_with_trip) + + @cached_property + def search_for_stop(self) -> search_for_stop.SearchForStopResourceWithStreamingResponse: + from .resources.search_for_stop import SearchForStopResourceWithStreamingResponse + + return SearchForStopResourceWithStreamingResponse(self._client.search_for_stop) + + @cached_property + def search_for_route(self) -> search_for_route.SearchForRouteResourceWithStreamingResponse: + from .resources.search_for_route import SearchForRouteResourceWithStreamingResponse + + return SearchForRouteResourceWithStreamingResponse(self._client.search_for_route) + + @cached_property + def block(self) -> block.BlockResourceWithStreamingResponse: + from .resources.block import BlockResourceWithStreamingResponse + + return BlockResourceWithStreamingResponse(self._client.block) + + @cached_property + def shape(self) -> shape.ShapeResourceWithStreamingResponse: + from .resources.shape import ShapeResourceWithStreamingResponse + + return ShapeResourceWithStreamingResponse(self._client.shape) class AsyncOnebusawaySDKWithStreamedResponse: + _client: AsyncOnebusawaySDK + def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) - self.agency = agency.AsyncAgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) - self.config = config.AsyncConfigResourceWithStreamingResponse(client.config) - self.current_time = current_time.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) - self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse( - client.stops_for_agency - ) - self.stop = stop.AsyncStopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) - self.route = route.AsyncRouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) - self.trip = trip.AsyncTripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) - self.trip_details = trip_details.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse( - client.trip_for_vehicle - ) - self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = ( - report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - ) - self.report_problem_with_trip = ( - report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) - ) - self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse( - client.search_for_route - ) - self.block = block.AsyncBlockResourceWithStreamingResponse(client.block) - self.shape = shape.AsyncShapeResourceWithStreamingResponse(client.shape) + self._client = client + + @cached_property + def agencies_with_coverage(self) -> agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse: + from .resources.agencies_with_coverage import AsyncAgenciesWithCoverageResourceWithStreamingResponse + + return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self._client.agencies_with_coverage) + + @cached_property + def agency(self) -> agency.AsyncAgencyResourceWithStreamingResponse: + from .resources.agency import AsyncAgencyResourceWithStreamingResponse + + return AsyncAgencyResourceWithStreamingResponse(self._client.agency) + + @cached_property + def vehicles_for_agency(self) -> vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse: + from .resources.vehicles_for_agency import AsyncVehiclesForAgencyResourceWithStreamingResponse + + return AsyncVehiclesForAgencyResourceWithStreamingResponse(self._client.vehicles_for_agency) + + @cached_property + def config(self) -> config.AsyncConfigResourceWithStreamingResponse: + from .resources.config import AsyncConfigResourceWithStreamingResponse + + return AsyncConfigResourceWithStreamingResponse(self._client.config) + + @cached_property + def current_time(self) -> current_time.AsyncCurrentTimeResourceWithStreamingResponse: + from .resources.current_time import AsyncCurrentTimeResourceWithStreamingResponse + + return AsyncCurrentTimeResourceWithStreamingResponse(self._client.current_time) + + @cached_property + def stops_for_location(self) -> stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse: + from .resources.stops_for_location import AsyncStopsForLocationResourceWithStreamingResponse + + return AsyncStopsForLocationResourceWithStreamingResponse(self._client.stops_for_location) + + @cached_property + def stops_for_route(self) -> stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse: + from .resources.stops_for_route import AsyncStopsForRouteResourceWithStreamingResponse + + return AsyncStopsForRouteResourceWithStreamingResponse(self._client.stops_for_route) + + @cached_property + def stops_for_agency(self) -> stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse: + from .resources.stops_for_agency import AsyncStopsForAgencyResourceWithStreamingResponse + + return AsyncStopsForAgencyResourceWithStreamingResponse(self._client.stops_for_agency) + + @cached_property + def stop(self) -> stop.AsyncStopResourceWithStreamingResponse: + from .resources.stop import AsyncStopResourceWithStreamingResponse + + return AsyncStopResourceWithStreamingResponse(self._client.stop) + + @cached_property + def stop_ids_for_agency(self) -> stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse: + from .resources.stop_ids_for_agency import AsyncStopIDsForAgencyResourceWithStreamingResponse + + return AsyncStopIDsForAgencyResourceWithStreamingResponse(self._client.stop_ids_for_agency) + + @cached_property + def schedule_for_stop(self) -> schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse: + from .resources.schedule_for_stop import AsyncScheduleForStopResourceWithStreamingResponse + + return AsyncScheduleForStopResourceWithStreamingResponse(self._client.schedule_for_stop) + + @cached_property + def route(self) -> route.AsyncRouteResourceWithStreamingResponse: + from .resources.route import AsyncRouteResourceWithStreamingResponse + + return AsyncRouteResourceWithStreamingResponse(self._client.route) + + @cached_property + def route_ids_for_agency(self) -> route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse: + from .resources.route_ids_for_agency import AsyncRouteIDsForAgencyResourceWithStreamingResponse + + return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self._client.route_ids_for_agency) + + @cached_property + def routes_for_location(self) -> routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse: + from .resources.routes_for_location import AsyncRoutesForLocationResourceWithStreamingResponse + + return AsyncRoutesForLocationResourceWithStreamingResponse(self._client.routes_for_location) + + @cached_property + def routes_for_agency(self) -> routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse: + from .resources.routes_for_agency import AsyncRoutesForAgencyResourceWithStreamingResponse + + return AsyncRoutesForAgencyResourceWithStreamingResponse(self._client.routes_for_agency) + + @cached_property + def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse: + from .resources.schedule_for_route import AsyncScheduleForRouteResourceWithStreamingResponse + + return AsyncScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + + @cached_property + def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse: + from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithStreamingResponse + + return AsyncArrivalAndDepartureResourceWithStreamingResponse(self._client.arrival_and_departure) + + @cached_property + def trip(self) -> trip.AsyncTripResourceWithStreamingResponse: + from .resources.trip import AsyncTripResourceWithStreamingResponse + + return AsyncTripResourceWithStreamingResponse(self._client.trip) + + @cached_property + def trips_for_location(self) -> trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse: + from .resources.trips_for_location import AsyncTripsForLocationResourceWithStreamingResponse + + return AsyncTripsForLocationResourceWithStreamingResponse(self._client.trips_for_location) + + @cached_property + def trip_details(self) -> trip_details.AsyncTripDetailsResourceWithStreamingResponse: + from .resources.trip_details import AsyncTripDetailsResourceWithStreamingResponse + + return AsyncTripDetailsResourceWithStreamingResponse(self._client.trip_details) + + @cached_property + def trip_for_vehicle(self) -> trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse: + from .resources.trip_for_vehicle import AsyncTripForVehicleResourceWithStreamingResponse + + return AsyncTripForVehicleResourceWithStreamingResponse(self._client.trip_for_vehicle) + + @cached_property + def trips_for_route(self) -> trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse: + from .resources.trips_for_route import AsyncTripsForRouteResourceWithStreamingResponse + + return AsyncTripsForRouteResourceWithStreamingResponse(self._client.trips_for_route) + + @cached_property + def report_problem_with_stop( + self, + ) -> report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse: + from .resources.report_problem_with_stop import AsyncReportProblemWithStopResourceWithStreamingResponse + + return AsyncReportProblemWithStopResourceWithStreamingResponse(self._client.report_problem_with_stop) + + @cached_property + def report_problem_with_trip( + self, + ) -> report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse: + from .resources.report_problem_with_trip import AsyncReportProblemWithTripResourceWithStreamingResponse + + return AsyncReportProblemWithTripResourceWithStreamingResponse(self._client.report_problem_with_trip) + + @cached_property + def search_for_stop(self) -> search_for_stop.AsyncSearchForStopResourceWithStreamingResponse: + from .resources.search_for_stop import AsyncSearchForStopResourceWithStreamingResponse + + return AsyncSearchForStopResourceWithStreamingResponse(self._client.search_for_stop) + + @cached_property + def search_for_route(self) -> search_for_route.AsyncSearchForRouteResourceWithStreamingResponse: + from .resources.search_for_route import AsyncSearchForRouteResourceWithStreamingResponse + + return AsyncSearchForRouteResourceWithStreamingResponse(self._client.search_for_route) + + @cached_property + def block(self) -> block.AsyncBlockResourceWithStreamingResponse: + from .resources.block import AsyncBlockResourceWithStreamingResponse + + return AsyncBlockResourceWithStreamingResponse(self._client.block) + + @cached_property + def shape(self) -> shape.AsyncShapeResourceWithStreamingResponse: + from .resources.shape import AsyncShapeResourceWithStreamingResponse + + return AsyncShapeResourceWithStreamingResponse(self._client.shape) Client = OnebusawaySDK From bb271d4d067c06c8848488a5ba050e89b85fd671 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:34:09 +0000 Subject: [PATCH 343/397] fix: use async_to_httpx_files in patch method --- src/onebusaway/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 99208e6..1f218e3 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1774,7 +1774,7 @@ async def patch( options: RequestOptions = {}, ) -> ResponseT: opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) From fecb3edeae22300f16eacd4f35da31e2243f17c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 08:05:37 +0000 Subject: [PATCH 344/397] chore(internal): add `--fix` argument to lint script --- scripts/lint | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/lint b/scripts/lint index 67032eb..ed21d54 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,8 +4,13 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running lints" -rye run lint +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi echo "==> Making sure it imports" rye run python -c 'import onebusaway' From dc918e3df35585c12b7a05e433826563faccb086 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 03:01:16 +0000 Subject: [PATCH 345/397] chore(internal): codegen related update --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 443d70c..26680ba 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Onebusaway SDK + Copyright 2026 Onebusaway SDK Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 38527d7ae133c91f3fdbf542ce7effaac5222180 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 16:10:47 +0000 Subject: [PATCH 346/397] release: 1.17.8 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fb611b1..87b856c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.7" + ".": "1.17.8" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dee931b..b52307e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 1.17.8 (2026-01-02) + +Full Changelog: [v1.17.7...v1.17.8](https://github.com/OneBusAway/python-sdk/compare/v1.17.7...v1.17.8) + +### Bug Fixes + +* compat with Python 3.14 ([2ebc518](https://github.com/OneBusAway/python-sdk/commit/2ebc5184554db31387b2f683265720d58dd9bb2f)) +* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([37abc5b](https://github.com/OneBusAway/python-sdk/commit/37abc5b808843321a5011b935590c5d3455f0c27)) +* ensure streams are always closed ([75f1288](https://github.com/OneBusAway/python-sdk/commit/75f1288ddc3202c2fe6850b8f968720ed88cb470)) +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([f10f373](https://github.com/OneBusAway/python-sdk/commit/f10f3734af08ea934c7b5be9de0cd2af106afaea)) +* use async_to_httpx_files in patch method ([bb271d4](https://github.com/OneBusAway/python-sdk/commit/bb271d4d067c06c8848488a5ba050e89b85fd671)) + + +### Chores + +* add missing docstrings ([5daefdd](https://github.com/OneBusAway/python-sdk/commit/5daefdde179696d3ade876b33b94fb79f5972155)) +* add Python 3.14 classifier and testing ([5ba9679](https://github.com/OneBusAway/python-sdk/commit/5ba9679c37d905d2b994fb3ad033825142ee19e2)) +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([167648d](https://github.com/OneBusAway/python-sdk/commit/167648d8fb485e522aa49611ee25523190b78c9a)) +* **docs:** use environment variables for authentication in code snippets ([a2ac5df](https://github.com/OneBusAway/python-sdk/commit/a2ac5df1da8f164cbe85325385266b5340fd361b)) +* **internal/tests:** avoid race condition with implicit client cleanup ([f6c9ee8](https://github.com/OneBusAway/python-sdk/commit/f6c9ee8b1713fee3b65a599c98653d6183d6e162)) +* **internal:** add `--fix` argument to lint script ([fecb3ed](https://github.com/OneBusAway/python-sdk/commit/fecb3edeae22300f16eacd4f35da31e2243f17c8)) +* **internal:** add missing files argument to base client ([1744224](https://github.com/OneBusAway/python-sdk/commit/17442243ef6d3ca342ac4294de2257e59fdd7da4)) +* **internal:** codegen related update ([dc918e3](https://github.com/OneBusAway/python-sdk/commit/dc918e3df35585c12b7a05e433826563faccb086)) +* **internal:** grammar fix (it's -> its) ([aa8df91](https://github.com/OneBusAway/python-sdk/commit/aa8df91bb2ba826f49bacf3a2a777579931487d9)) +* **package:** drop Python 3.8 support ([b633259](https://github.com/OneBusAway/python-sdk/commit/b633259385cddf32422b425a174a2a7dbe34021c)) +* speedup initial import ([d938f66](https://github.com/OneBusAway/python-sdk/commit/d938f6643cf144bb8db22d8c89024785ff5fdd97)) +* update lockfile ([4fd805d](https://github.com/OneBusAway/python-sdk/commit/4fd805dfa1c4efe2fd53d7aa46c75e368c97463f)) + ## 1.17.7 (2025-10-30) Full Changelog: [v1.17.6...v1.17.7](https://github.com/OneBusAway/python-sdk/compare/v1.17.6...v1.17.7) diff --git a/pyproject.toml b/pyproject.toml index 9f61ec1..f8111ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.7" +version = "1.17.8" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8f0a4ce..3310d15 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.7" # x-release-please-version +__version__ = "1.17.8" # x-release-please-version From 65e70c7ca5821ba92e25975d81f7298e6831962a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 10:22:58 +0000 Subject: [PATCH 347/397] feat(client): add support for binary request streaming --- src/onebusaway/_base_client.py | 145 +++++++++++++++++++++++-- src/onebusaway/_models.py | 17 ++- src/onebusaway/_types.py | 9 ++ tests/test_client.py | 187 ++++++++++++++++++++++++++++++++- 4 files changed, 344 insertions(+), 14 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 1f218e3..a403b8f 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -9,6 +9,7 @@ import inspect import logging import platform +import warnings import email.utils from types import TracebackType from random import random @@ -51,9 +52,11 @@ ResponseT, AnyMapping, PostParser, + BinaryTypes, RequestFiles, HttpxSendArgs, RequestOptions, + AsyncBinaryTypes, HttpxRequestFiles, ModelBuilderProtocol, not_given, @@ -477,8 +480,19 @@ def _build_request( retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): - log.debug("Request options: %s", model_dump(options, exclude_unset=True)) - + log.debug( + "Request options: %s", + model_dump( + options, + exclude_unset=True, + # Pydantic v1 can't dump every type we support in content, so we exclude it for now. + exclude={ + "content", + } + if PYDANTIC_V1 + else {}, + ), + ) kwargs: dict[str, Any] = {} json_data = options.json_data @@ -532,7 +546,13 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - if isinstance(json_data, bytes): + if options.content is not None and json_data is not None: + raise TypeError("Passing both `content` and `json_data` is not supported") + if options.content is not None and files is not None: + raise TypeError("Passing both `content` and `files` is not supported") + if options.content is not None: + kwargs["content"] = options.content + elif isinstance(json_data, bytes): kwargs["content"] = json_data else: kwargs["json"] = json_data if is_given(json_data) else None @@ -1194,6 +1214,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, @@ -1206,6 +1227,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[True], @@ -1219,6 +1241,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool, @@ -1231,13 +1254,25 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) @@ -1247,11 +1282,23 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1261,11 +1308,23 @@ def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1275,9 +1334,19 @@ def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return self.request(cast_to, opts) def get_api_list( @@ -1717,6 +1786,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, @@ -1729,6 +1799,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[True], @@ -1742,6 +1813,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool, @@ -1754,13 +1826,25 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, ) -> ResponseT | _AsyncStreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) @@ -1770,11 +1854,28 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="patch", + url=path, + json_data=body, + content=content, + files=await async_to_httpx_files(files), + **options, ) return await self.request(cast_to, opts) @@ -1784,11 +1885,23 @@ async def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) @@ -1798,9 +1911,19 @@ async def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return await self.request(cast_to, opts) def get_api_list( diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index ca9500b..29070e0 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -3,7 +3,20 @@ import os import inspect import weakref -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast +from typing import ( + IO, + TYPE_CHECKING, + Any, + Type, + Union, + Generic, + TypeVar, + Callable, + Iterable, + Optional, + AsyncIterable, + cast, +) from datetime import date, datetime from typing_extensions import ( List, @@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): timeout: float | Timeout | None files: HttpxRequestFiles | None idempotency_key: str + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] json_data: Body extra_json: AnyMapping follow_redirects: bool @@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel): post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() follow_redirects: Union[bool, None] = None + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. json_data: Union[Body, None] = None diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py index 93ca645..73b0d5e 100644 --- a/src/onebusaway/_types.py +++ b/src/onebusaway/_types.py @@ -13,9 +13,11 @@ Mapping, TypeVar, Callable, + Iterable, Iterator, Optional, Sequence, + AsyncIterable, ) from typing_extensions import ( Set, @@ -56,6 +58,13 @@ else: Base64FileInput = Union[IO[bytes], PathLike] FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. + + +# Used for sending raw binary data / streaming data in request bodies +# e.g. for file uploads without multipart encoding +BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]] +AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]] + FileTypes = Union[ # file (or bytes) FileContent, diff --git a/tests/test_client.py b/tests/test_client.py index feeeacf..ecd3352 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -8,11 +8,12 @@ import json import asyncio import inspect +import dataclasses import tracemalloc import urllib.parse -from typing import Any, Union, cast +from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock -from typing_extensions import Literal +from typing_extensions import Literal, AsyncIterator, override import httpx import pytest @@ -37,6 +38,7 @@ from .utils import update_env +T = TypeVar("T") base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -51,6 +53,57 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def mirror_request_content(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, content=request.content) + + +# note: we can't use the httpx.MockTransport class as it consumes the request +# body itself, which means we can't test that the body is read lazily +class MockTransport(httpx.BaseTransport, httpx.AsyncBaseTransport): + def __init__( + self, + handler: Callable[[httpx.Request], httpx.Response] + | Callable[[httpx.Request], Coroutine[Any, Any, httpx.Response]], + ) -> None: + self.handler = handler + + @override + def handle_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert not inspect.iscoroutinefunction(self.handler), "handler must not be a coroutine function" + assert inspect.isfunction(self.handler), "handler must be a function" + return self.handler(request) + + @override + async def handle_async_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert inspect.iscoroutinefunction(self.handler), "handler must be a coroutine function" + return await self.handler(request) + + +@dataclasses.dataclass +class Counter: + value: int = 0 + + +def _make_sync_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> Iterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + +async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> AsyncIterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -493,6 +546,70 @@ def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + def test_binary_content_upload_with_iterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_sync_iterator([file_content], counter=counter) + + def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=request.read()) + + with OnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(transport=MockTransport(handler=mock_handler)), + ) as client: + response = client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) def test_basic_union_response(self, respx_mock: MockRouter, client: OnebusawaySDK) -> None: class Model1(BaseModel): @@ -1314,6 +1431,72 @@ def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> No b"", ] + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = await async_client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + async def test_binary_content_upload_with_asynciterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_async_iterator([file_content], counter=counter) + + async def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=await request.aread()) + + async with AsyncOnebusawaySDK( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)), + ) as client: + response = await client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload_with_body_is_deprecated( + self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK + ) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = await async_client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncOnebusawaySDK) -> None: class Model1(BaseModel): From 4ea97188a5ba86b763d7bc24aee9aae7707da47d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 10:23:22 +0000 Subject: [PATCH 348/397] release: 1.18.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 87b856c..4ce109a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.8" + ".": "1.18.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b52307e..327d777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.18.0 (2026-01-14) + +Full Changelog: [v1.17.8...v1.18.0](https://github.com/OneBusAway/python-sdk/compare/v1.17.8...v1.18.0) + +### Features + +* **client:** add support for binary request streaming ([65e70c7](https://github.com/OneBusAway/python-sdk/commit/65e70c7ca5821ba92e25975d81f7298e6831962a)) + ## 1.17.8 (2026-01-02) Full Changelog: [v1.17.7...v1.17.8](https://github.com/OneBusAway/python-sdk/compare/v1.17.7...v1.17.8) diff --git a/pyproject.toml b/pyproject.toml index f8111ee..a45fcae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.17.8" +version = "1.18.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 3310d15..4172afb 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.17.8" # x-release-please-version +__version__ = "1.18.0" # x-release-please-version From a74da998f5ff890a42dee0d2ca3b35e5b0bee99f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 07:32:20 +0000 Subject: [PATCH 349/397] chore(internal): update `actions/checkout` version --- .github/workflows/ci.yml | 6 +++--- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a957cd..866aeb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -44,7 +44,7 @@ jobs: id-token: write runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -81,7 +81,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 13dc1e5..5da47ec 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 908ad72..421021c 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'OneBusAway/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Check release environment run: | From 3b4da60c338a388654b65f45cd4c22879781cd2d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 07:32:40 +0000 Subject: [PATCH 350/397] release: 1.18.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4ce109a..aa06f86 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.18.0" + ".": "1.18.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 327d777..7029987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.18.1 (2026-01-17) + +Full Changelog: [v1.18.0...v1.18.1](https://github.com/OneBusAway/python-sdk/compare/v1.18.0...v1.18.1) + +### Chores + +* **internal:** update `actions/checkout` version ([a74da99](https://github.com/OneBusAway/python-sdk/commit/a74da998f5ff890a42dee0d2ca3b35e5b0bee99f)) + ## 1.18.0 (2026-01-14) Full Changelog: [v1.17.8...v1.18.0](https://github.com/OneBusAway/python-sdk/compare/v1.17.8...v1.18.0) diff --git a/pyproject.toml b/pyproject.toml index a45fcae..d312724 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.18.0" +version = "1.18.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4172afb..98ff657 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.18.0" # x-release-please-version +__version__ = "1.18.1" # x-release-please-version From b53a0e7521f6bd5a5b91ca044ab1170e19f66d9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 06:30:55 +0000 Subject: [PATCH 351/397] chore(ci): upgrade `actions/github-script` --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 866aeb8..feec789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/open-transit-python' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); From 0965824627e99c2867aef763fe8818d58e62cc49 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 06:31:14 +0000 Subject: [PATCH 352/397] release: 1.18.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aa06f86..dffe698 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.18.1" + ".": "1.18.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7029987..9196afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.18.2 (2026-01-24) + +Full Changelog: [v1.18.1...v1.18.2](https://github.com/OneBusAway/python-sdk/compare/v1.18.1...v1.18.2) + +### Chores + +* **ci:** upgrade `actions/github-script` ([b53a0e7](https://github.com/OneBusAway/python-sdk/commit/b53a0e7521f6bd5a5b91ca044ab1170e19f66d9c)) + ## 1.18.1 (2026-01-17) Full Changelog: [v1.18.0...v1.18.1](https://github.com/OneBusAway/python-sdk/compare/v1.18.0...v1.18.1) diff --git a/pyproject.toml b/pyproject.toml index d312724..7d2c57e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.18.1" +version = "1.18.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 98ff657..8a13405 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.18.1" # x-release-please-version +__version__ = "1.18.2" # x-release-please-version From b86708cb3174d253d5a1165314e2be906fcb7f45 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:11:52 +0000 Subject: [PATCH 353/397] feat(client): add custom JSON encoder for extended type support --- src/onebusaway/_base_client.py | 7 +- src/onebusaway/_compat.py | 6 +- src/onebusaway/_utils/_json.py | 35 +++++++++ tests/test_utils/test_json.py | 126 +++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 src/onebusaway/_utils/_json.py create mode 100644 tests/test_utils/test_json.py diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index a403b8f..1990426 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -86,6 +86,7 @@ APIConnectionError, APIResponseValidationError, ) +from ._utils._json import openapi_dumps log: logging.Logger = logging.getLogger(__name__) @@ -554,8 +555,10 @@ def _build_request( kwargs["content"] = options.content elif isinstance(json_data, bytes): kwargs["content"] = json_data - else: - kwargs["json"] = json_data if is_given(json_data) else None + elif not files: + # Don't set content when JSON is sent as multipart/form-data, + # since httpx's content param overrides other body arguments + kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index bdef67f..786ff42 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -139,6 +139,7 @@ def model_dump( exclude_defaults: bool = False, warnings: bool = True, mode: Literal["json", "python"] = "python", + by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( @@ -148,13 +149,12 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, + by_alias=by_alias, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - exclude=exclude, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias) ), ) diff --git a/src/onebusaway/_utils/_json.py b/src/onebusaway/_utils/_json.py new file mode 100644 index 0000000..6058421 --- /dev/null +++ b/src/onebusaway/_utils/_json.py @@ -0,0 +1,35 @@ +import json +from typing import Any +from datetime import datetime +from typing_extensions import override + +import pydantic + +from .._compat import model_dump + + +def openapi_dumps(obj: Any) -> bytes: + """ + Serialize an object to UTF-8 encoded JSON bytes. + + Extends the standard json.dumps with support for additional types + commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc. + """ + return json.dumps( + obj, + cls=_CustomEncoder, + # Uses the same defaults as httpx's JSON serialization + ensure_ascii=False, + separators=(",", ":"), + allow_nan=False, + ).encode() + + +class _CustomEncoder(json.JSONEncoder): + @override + def default(self, o: Any) -> Any: + if isinstance(o, datetime): + return o.isoformat() + if isinstance(o, pydantic.BaseModel): + return model_dump(o, exclude_unset=True, mode="json", by_alias=True) + return super().default(o) diff --git a/tests/test_utils/test_json.py b/tests/test_utils/test_json.py new file mode 100644 index 0000000..a8c3324 --- /dev/null +++ b/tests/test_utils/test_json.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +from typing import Union + +import pydantic + +from onebusaway import _compat +from onebusaway._utils._json import openapi_dumps + + +class TestOpenapiDumps: + def test_basic(self) -> None: + data = {"key": "value", "number": 42} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"key":"value","number":42}' + + def test_datetime_serialization(self) -> None: + dt = datetime.datetime(2023, 1, 1, 12, 0, 0) + data = {"datetime": dt} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}' + + def test_pydantic_model_serialization(self) -> None: + class User(pydantic.BaseModel): + first_name: str + last_name: str + age: int + + model_instance = User(first_name="John", last_name="Kramer", age=83) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}' + + def test_pydantic_model_with_default_values(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + score: int = 0 + + model_instance = User(name="Alice") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Alice"}}' + + def test_pydantic_model_with_default_values_overridden(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + + model_instance = User(name="Bob", role="admin", active=False) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}' + + def test_pydantic_model_with_alias(self) -> None: + class User(pydantic.BaseModel): + first_name: str = pydantic.Field(alias="firstName") + last_name: str = pydantic.Field(alias="lastName") + + model_instance = User(firstName="John", lastName="Doe") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}' + + def test_pydantic_model_with_alias_and_default(self) -> None: + class User(pydantic.BaseModel): + user_name: str = pydantic.Field(alias="userName") + user_role: str = pydantic.Field(default="member", alias="userRole") + is_active: bool = pydantic.Field(default=True, alias="isActive") + + model_instance = User(userName="charlie") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"charlie"}}' + + model_with_overrides = User(userName="diana", userRole="admin", isActive=False) + data = {"model": model_with_overrides} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}' + + def test_pydantic_model_with_nested_models_and_defaults(self) -> None: + class Address(pydantic.BaseModel): + street: str + city: str = "Unknown" + + class User(pydantic.BaseModel): + name: str + address: Address + verified: bool = False + + if _compat.PYDANTIC_V1: + # to handle forward references in Pydantic v1 + User.update_forward_refs(**locals()) # type: ignore[reportDeprecated] + + address = Address(street="123 Main St") + user = User(name="Diana", address=address) + data = {"user": user} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}' + + address_with_city = Address(street="456 Oak Ave", city="Boston") + user_verified = User(name="Eve", address=address_with_city, verified=True) + data = {"user": user_verified} + json_bytes = openapi_dumps(data) + assert ( + json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}' + ) + + def test_pydantic_model_with_optional_fields(self) -> None: + class User(pydantic.BaseModel): + name: str + email: Union[str, None] + phone: Union[str, None] + + model_with_none = User(name="Eve", email=None, phone=None) + data = {"model": model_with_none} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}' + + model_with_values = User(name="Frank", email="frank@example.com", phone=None) + data = {"model": model_with_values} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}' From d185acc69c942e63a899ba7b39be51d7581c3906 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 06:12:11 +0000 Subject: [PATCH 354/397] release: 1.19.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dffe698..de44c40 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.18.2" + ".": "1.19.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9196afd..a0c89b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.0 (2026-01-30) + +Full Changelog: [v1.18.2...v1.19.0](https://github.com/OneBusAway/python-sdk/compare/v1.18.2...v1.19.0) + +### Features + +* **client:** add custom JSON encoder for extended type support ([b86708c](https://github.com/OneBusAway/python-sdk/commit/b86708cb3174d253d5a1165314e2be906fcb7f45)) + ## 1.18.2 (2026-01-24) Full Changelog: [v1.18.1...v1.18.2](https://github.com/OneBusAway/python-sdk/compare/v1.18.1...v1.18.2) diff --git a/pyproject.toml b/pyproject.toml index 7d2c57e..24f0c1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.18.2" +version = "1.19.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 8a13405..6e9ac6c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.18.2" # x-release-please-version +__version__ = "1.19.0" # x-release-please-version From 62f3fa13edd93af703978251b8fab75f831f7c24 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:31:43 +0000 Subject: [PATCH 355/397] chore(internal): bump dependencies --- requirements-dev.lock | 20 ++++++++++---------- requirements.lock | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 69573c8..8bdb7bf 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,14 +12,14 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via onebusaway aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via onebusaway argcomplete==3.6.3 @@ -31,7 +31,7 @@ attrs==25.4.0 # via nox backports-asyncio-runner==1.2.0 # via pytest-asyncio -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx colorlog==6.10.1 @@ -61,7 +61,7 @@ httpx==0.28.1 # via httpx-aiohttp # via onebusaway # via respx -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via onebusaway humanize==4.13.0 # via nox @@ -69,7 +69,7 @@ idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 @@ -82,14 +82,14 @@ multidict==6.7.0 mypy==1.17.0 mypy-extensions==1.1.0 # via mypy -nodeenv==1.9.1 +nodeenv==1.10.0 # via pyright nox==2025.11.12 packaging==25.0 # via dependency-groups # via nox # via pytest -pathspec==0.12.1 +pathspec==1.0.3 # via mypy platformdirs==4.4.0 # via virtualenv @@ -115,13 +115,13 @@ python-dateutil==2.9.0.post0 # via time-machine respx==0.22.0 rich==14.2.0 -ruff==0.14.7 +ruff==0.14.13 six==1.17.0 # via python-dateutil sniffio==1.3.1 # via onebusaway time-machine==2.19.0 -tomli==2.3.0 +tomli==2.4.0 # via dependency-groups # via mypy # via nox @@ -141,7 +141,7 @@ typing-extensions==4.15.0 # via virtualenv typing-inspection==0.4.2 # via pydantic -virtualenv==20.35.4 +virtualenv==20.36.1 # via nox yarl==1.22.0 # via aiohttp diff --git a/requirements.lock b/requirements.lock index 2c479e1..6724bb1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,21 +12,21 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via onebusaway aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via onebusaway async-timeout==5.0.1 # via aiohttp attrs==25.4.0 # via aiohttp -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx distro==1.9.0 @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via httpx-aiohttp # via onebusaway -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via onebusaway idna==3.11 # via anyio From 6c19d0b5b0b9f9a11dc18e996100f50a9afa805f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:32:04 +0000 Subject: [PATCH 356/397] release: 1.19.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de44c40..8255acf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.0" + ".": "1.19.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c89b5..6cbc1ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.1 (2026-02-10) + +Full Changelog: [v1.19.0...v1.19.1](https://github.com/OneBusAway/python-sdk/compare/v1.19.0...v1.19.1) + +### Chores + +* **internal:** bump dependencies ([62f3fa1](https://github.com/OneBusAway/python-sdk/commit/62f3fa13edd93af703978251b8fab75f831f7c24)) + ## 1.19.0 (2026-01-30) Full Changelog: [v1.18.2...v1.19.0](https://github.com/OneBusAway/python-sdk/compare/v1.18.2...v1.19.0) diff --git a/pyproject.toml b/pyproject.toml index 24f0c1a..36d541c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.0" +version = "1.19.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6e9ac6c..5b5229c 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.0" # x-release-please-version +__version__ = "1.19.1" # x-release-please-version From 790e84dee02f5b6a1a4a2a5180c641c79ab7e49a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 08:16:09 +0000 Subject: [PATCH 357/397] chore(internal): fix lint error on Python 3.14 --- src/onebusaway/_utils/_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebusaway/_utils/_compat.py b/src/onebusaway/_utils/_compat.py index dd70323..2c70b29 100644 --- a/src/onebusaway/_utils/_compat.py +++ b/src/onebusaway/_utils/_compat.py @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool: else: import types - return tp is Union or tp is types.UnionType + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] def is_typeddict(tp: Type[Any]) -> bool: From a800c7de6f87bf874032cabc42285ac1f27e4a7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 05:21:42 +0000 Subject: [PATCH 358/397] chore: format all `api.md` files --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 36d541c..bbe5a6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" "lint" = { chain = [ From df732db630eed90f7aafd53608ab79ee57dc45e2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 05:22:03 +0000 Subject: [PATCH 359/397] release: 1.19.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8255acf..b94f19a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.1" + ".": "1.19.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cbc1ed..01b46a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.19.2 (2026-02-13) + +Full Changelog: [v1.19.1...v1.19.2](https://github.com/OneBusAway/python-sdk/compare/v1.19.1...v1.19.2) + +### Chores + +* format all `api.md` files ([a800c7d](https://github.com/OneBusAway/python-sdk/commit/a800c7de6f87bf874032cabc42285ac1f27e4a7b)) +* **internal:** fix lint error on Python 3.14 ([790e84d](https://github.com/OneBusAway/python-sdk/commit/790e84dee02f5b6a1a4a2a5180c641c79ab7e49a)) + ## 1.19.1 (2026-02-10) Full Changelog: [v1.19.0...v1.19.1](https://github.com/OneBusAway/python-sdk/compare/v1.19.0...v1.19.1) diff --git a/pyproject.toml b/pyproject.toml index bbe5a6b..d40328a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.1" +version = "1.19.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 5b5229c..0854b3a 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.1" # x-release-please-version +__version__ = "1.19.2" # x-release-please-version From 71a7ebfcc6f43c0b67397498ace5627a6a4f6138 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 07:43:34 +0000 Subject: [PATCH 360/397] chore: update mock server docs --- CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6b6615..2100731 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,8 +88,7 @@ $ pip install ./path-to-wheel-file.whl Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml +$ ./scripts/mock ``` ```sh From 4af2ab9770524667ae047db8a8a6b65c7a19d858 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 07:43:53 +0000 Subject: [PATCH 361/397] release: 1.19.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b94f19a..f257435 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.2" + ".": "1.19.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 01b46a9..90c2f99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.3 (2026-02-20) + +Full Changelog: [v1.19.2...v1.19.3](https://github.com/OneBusAway/python-sdk/compare/v1.19.2...v1.19.3) + +### Chores + +* update mock server docs ([71a7ebf](https://github.com/OneBusAway/python-sdk/commit/71a7ebfcc6f43c0b67397498ace5627a6a4f6138)) + ## 1.19.2 (2026-02-13) Full Changelog: [v1.19.1...v1.19.2](https://github.com/OneBusAway/python-sdk/compare/v1.19.1...v1.19.2) diff --git a/pyproject.toml b/pyproject.toml index d40328a..dcb2c96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.2" +version = "1.19.3" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 0854b3a..3597c9e 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.2" # x-release-please-version +__version__ = "1.19.3" # x-release-please-version From 82eb18f84a795101b3d593a4d0ca0ffe8c2f61ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 07:56:45 +0000 Subject: [PATCH 362/397] chore(internal): add request options to SSE classes --- src/onebusaway/_response.py | 3 +++ src/onebusaway/_streaming.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index cc4f68e..5c83603 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: ), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=extract_stream_chunk_type(self._stream_cls), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 288db03..6a64d81 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -4,7 +4,7 @@ import json import inspect from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable import httpx @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import OnebusawaySDK, AsyncOnebusawaySDK + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -22,7 +23,7 @@ class Stream(Generic[_T]): """Provides the core interface to iterate over a synchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEBytesDecoder def __init__( @@ -31,10 +32,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: OnebusawaySDK, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]): """Provides the core interface to iterate over an asynchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEDecoder | SSEBytesDecoder def __init__( @@ -94,10 +97,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncOnebusawaySDK, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() From 8d549cc7fd49514167e74d5c7f6889e7681223bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 08:08:05 +0000 Subject: [PATCH 363/397] chore(internal): make `test_proxy_environment_variables` more resilient --- tests/test_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index ecd3352..fafc02b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -953,6 +953,8 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has this set + monkeypatch.delenv("HTTP_PROXY", raising=False) client = DefaultHttpxClient() @@ -1856,6 +1858,8 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has this set + monkeypatch.delenv("HTTP_PROXY", raising=False) client = DefaultAsyncHttpxClient() From 2326c9e73e900efb2bee71b840f5278ff19ff67b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 08:08:24 +0000 Subject: [PATCH 364/397] release: 1.19.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f257435..545be23 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.3" + ".": "1.19.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c2f99..5f3249c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.19.4 (2026-02-24) + +Full Changelog: [v1.19.3...v1.19.4](https://github.com/OneBusAway/python-sdk/compare/v1.19.3...v1.19.4) + +### Chores + +* **internal:** add request options to SSE classes ([82eb18f](https://github.com/OneBusAway/python-sdk/commit/82eb18f84a795101b3d593a4d0ca0ffe8c2f61ad)) +* **internal:** make `test_proxy_environment_variables` more resilient ([8d549cc](https://github.com/OneBusAway/python-sdk/commit/8d549cc7fd49514167e74d5c7f6889e7681223bd)) + ## 1.19.3 (2026-02-20) Full Changelog: [v1.19.2...v1.19.3](https://github.com/OneBusAway/python-sdk/compare/v1.19.2...v1.19.3) diff --git a/pyproject.toml b/pyproject.toml index dcb2c96..1761896 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.3" +version = "1.19.4" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 3597c9e..822ea3d 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.3" # x-release-please-version +__version__ = "1.19.4" # x-release-please-version From e583264585805a1f82d86dc004c34c5eb1bb3bac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 07:50:18 +0000 Subject: [PATCH 365/397] chore(internal): make `test_proxy_environment_variables` more resilient to env --- tests/test_client.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index fafc02b..0940f79 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -953,8 +953,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") - # Delete in case our environment has this set + # Delete in case our environment has any proxy env vars set monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultHttpxClient() @@ -1858,8 +1864,14 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") - # Delete in case our environment has this set + # Delete in case our environment has any proxy env vars set monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultAsyncHttpxClient() From 5450f553fd840096b0f5f9aa6b80f5f08b7060f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 03:20:07 +0000 Subject: [PATCH 366/397] release: 1.19.5 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 545be23..a470a59 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.4" + ".": "1.19.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f3249c..5a4518d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.5 (2026-02-26) + +Full Changelog: [v1.19.4...v1.19.5](https://github.com/OneBusAway/python-sdk/compare/v1.19.4...v1.19.5) + +### Chores + +* **internal:** make `test_proxy_environment_variables` more resilient to env ([e583264](https://github.com/OneBusAway/python-sdk/commit/e583264585805a1f82d86dc004c34c5eb1bb3bac)) + ## 1.19.4 (2026-02-24) Full Changelog: [v1.19.3...v1.19.4](https://github.com/OneBusAway/python-sdk/compare/v1.19.3...v1.19.4) diff --git a/pyproject.toml b/pyproject.toml index 1761896..07da016 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.4" +version = "1.19.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 822ea3d..1773491 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.4" # x-release-please-version +__version__ = "1.19.5" # x-release-please-version From 7869bca87c7ed3f3ea2944f20a3d3d92abb2b374 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:54:52 +0000 Subject: [PATCH 367/397] chore(test): do not count install time for mock server timeout --- scripts/mock | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 0b28f6e..bcf3b39 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done From ec124700930b0e228a367eea68c3700730f1c3f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:55:16 +0000 Subject: [PATCH 368/397] release: 1.19.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a470a59..d2df7be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.5" + ".": "1.19.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a4518d..02a0431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.6 (2026-03-06) + +Full Changelog: [v1.19.5...v1.19.6](https://github.com/OneBusAway/python-sdk/compare/v1.19.5...v1.19.6) + +### Chores + +* **test:** do not count install time for mock server timeout ([7869bca](https://github.com/OneBusAway/python-sdk/commit/7869bca87c7ed3f3ea2944f20a3d3d92abb2b374)) + ## 1.19.5 (2026-02-26) Full Changelog: [v1.19.4...v1.19.5](https://github.com/OneBusAway/python-sdk/compare/v1.19.4...v1.19.5) diff --git a/pyproject.toml b/pyproject.toml index 07da016..10809af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.5" +version = "1.19.6" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 1773491..4c469a0 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.5" # x-release-please-version +__version__ = "1.19.6" # x-release-please-version From 0192fc9c9015032655a23bb9217d60488709a277 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 19:16:29 +0000 Subject: [PATCH 369/397] chore(ci): skip uploading artifacts on stainless-internal branches --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feec789..68ef435 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/open-transit-python' + if: |- + github.repository == 'stainless-sdks/open-transit-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/open-transit-python' + if: |- + github.repository == 'stainless-sdks/open-transit-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From efb036faa73bfdd33bcbc0994d17a00001462cbf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 19:34:10 +0000 Subject: [PATCH 370/397] release: 1.19.7 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d2df7be..2884c2e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.6" + ".": "1.19.7" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a0431..6521df7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.19.7 (2026-03-07) + +Full Changelog: [v1.19.6...v1.19.7](https://github.com/OneBusAway/python-sdk/compare/v1.19.6...v1.19.7) + +### Chores + +* **ci:** skip uploading artifacts on stainless-internal branches ([0192fc9](https://github.com/OneBusAway/python-sdk/commit/0192fc9c9015032655a23bb9217d60488709a277)) + ## 1.19.6 (2026-03-06) Full Changelog: [v1.19.5...v1.19.6](https://github.com/OneBusAway/python-sdk/compare/v1.19.5...v1.19.6) diff --git a/pyproject.toml b/pyproject.toml index 10809af..a4bfc4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.6" +version = "1.19.7" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4c469a0..37c15e9 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.6" # x-release-please-version +__version__ = "1.19.7" # x-release-please-version From e11aff5e8aee29546c94b7c555bbe1383a1233b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:06:55 +0000 Subject: [PATCH 371/397] feat(api): api update --- .stats.yml | 4 +- .../schedule_for_route_retrieve_response.py | 54 ------------------- .../types/stops_for_agency_list_response.py | 12 +++-- .../types/stops_for_route_list_response.py | 37 +++++++------ 4 files changed, 31 insertions(+), 76 deletions(-) diff --git a/.stats.yml b/.stats.yml index ad9cf70..26b456c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4fcbe9547537b22a2d68329e1d94e0c1a6f81b5af734ca213f7b95eef5da7adb.yml -openapi_spec_hash: 417ea17b08e186b15b2986372592185e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-162c2011b5784e2258775ec72e5da7bc86cb411d738b627f1eae6a0d56ee3aec.yml +openapi_spec_hash: 2e32c25a86f9ff55bab7cfa1d9c985a7 config_hash: 3871f5d21bb38ddd334ec04721dea64d diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index c970b6c..e749333 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -11,38 +11,12 @@ "ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", - "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", - "ScheduleForRouteRetrieveResponseDataEntryTrip", ] -class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): - id: str - - lat: float - - location_type: int = FieldInfo(alias="locationType") - - lon: float - - name: str - - parent: str - - route_ids: List[str] = FieldInfo(alias="routeIds") - - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") - - code: Optional[str] = None - - direction: Optional[str] = None - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) - - class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime(BaseModel): arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") @@ -83,30 +57,6 @@ class ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping(BaseModel): ] = FieldInfo(alias="tripsWithStopTimes", default=None) -class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): - id: str - - route_id: str = FieldInfo(alias="routeId") - - service_id: str = FieldInfo(alias="serviceId") - - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) - - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) - - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) - - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) - - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) - - class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): route_id: str = FieldInfo(alias="routeId") @@ -114,14 +64,10 @@ class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): service_ids: List[str] = FieldInfo(alias="serviceIds") - stops: List[ScheduleForRouteRetrieveResponseDataEntryStop] - stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo( alias="stopTripGroupings" ) - trips: List[ScheduleForRouteRetrieveResponseDataEntryTrip] - class ScheduleForRouteRetrieveResponseData(BaseModel): entry: ScheduleForRouteRetrieveResponseDataEntry diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index efab70c..a414d54 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -8,10 +8,10 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] +__all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseData", "StopsForAgencyListResponseDataList"] -class StopsForAgencyListResponseList(BaseModel): +class StopsForAgencyListResponseDataList(BaseModel): id: str lat: float @@ -35,11 +35,15 @@ class StopsForAgencyListResponseList(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) -class StopsForAgencyListResponse(ResponseWrapper): +class StopsForAgencyListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForAgencyListResponseList] + list: List[StopsForAgencyListResponseDataList] references: References out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + + +class StopsForAgencyListResponse(ResponseWrapper): + data: StopsForAgencyListResponseData diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 53cff4e..f7336c0 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -11,15 +11,16 @@ __all__ = [ "StopsForRouteListResponse", "StopsForRouteListResponseData", - "StopsForRouteListResponseDataEntry", - "StopsForRouteListResponseDataEntryPolyline", - "StopsForRouteListResponseDataEntryStopGrouping", - "StopsForRouteListResponseDataEntryStopGroupingName", - "StopsForRouteListResponseDataEntryStopGroupingPolyline", + "StopsForRouteListResponseDataData", + "StopsForRouteListResponseDataDataEntry", + "StopsForRouteListResponseDataDataEntryPolyline", + "StopsForRouteListResponseDataDataEntryStopGrouping", + "StopsForRouteListResponseDataDataEntryStopGroupingName", + "StopsForRouteListResponseDataDataEntryStopGroupingPolyline", ] -class StopsForRouteListResponseDataEntryPolyline(BaseModel): +class StopsForRouteListResponseDataDataEntryPolyline(BaseModel): length: Optional[int] = None levels: Optional[str] = None @@ -27,7 +28,7 @@ class StopsForRouteListResponseDataEntryPolyline(BaseModel): points: Optional[str] = None -class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): +class StopsForRouteListResponseDataDataEntryStopGroupingName(BaseModel): name: Optional[str] = None names: Optional[List[str]] = None @@ -35,7 +36,7 @@ class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): type: Optional[str] = None -class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): +class StopsForRouteListResponseDataDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None levels: Optional[str] = None @@ -43,33 +44,37 @@ class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None -class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): +class StopsForRouteListResponseDataDataEntryStopGrouping(BaseModel): id: Optional[str] = None - name: Optional[StopsForRouteListResponseDataEntryStopGroupingName] = None + name: Optional[StopsForRouteListResponseDataDataEntryStopGroupingName] = None - polylines: Optional[List[StopsForRouteListResponseDataEntryStopGroupingPolyline]] = None + polylines: Optional[List[StopsForRouteListResponseDataDataEntryStopGroupingPolyline]] = None stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) -class StopsForRouteListResponseDataEntry(BaseModel): - polylines: Optional[List[StopsForRouteListResponseDataEntryPolyline]] = None +class StopsForRouteListResponseDataDataEntry(BaseModel): + polylines: Optional[List[StopsForRouteListResponseDataDataEntryPolyline]] = None route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo( + stop_groupings: Optional[List[StopsForRouteListResponseDataDataEntryStopGrouping]] = FieldInfo( alias="stopGroupings", default=None ) stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) -class StopsForRouteListResponseData(BaseModel): - entry: StopsForRouteListResponseDataEntry +class StopsForRouteListResponseDataData(BaseModel): + entry: StopsForRouteListResponseDataDataEntry references: References +class StopsForRouteListResponseData(BaseModel): + data: StopsForRouteListResponseDataData + + class StopsForRouteListResponse(ResponseWrapper): data: StopsForRouteListResponseData From 5f55ef1165888a1834d6681042e889f695ce7d54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:48:42 +0000 Subject: [PATCH 372/397] feat(api): api update --- .stats.yml | 4 +- .../types/stops_for_route_list_response.py | 37 ++++++++----------- .../vehicles_for_agency_list_response.py | 12 +++--- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.stats.yml b/.stats.yml index 26b456c..8dd1ce7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-162c2011b5784e2258775ec72e5da7bc86cb411d738b627f1eae6a0d56ee3aec.yml -openapi_spec_hash: 2e32c25a86f9ff55bab7cfa1d9c985a7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-22e1c98416f77779b2c07db272016be0b623b94f6b55cca2d1909f9dc4032c3f.yml +openapi_spec_hash: dd25fff6bc185752d92e93f6e47d3a5e config_hash: 3871f5d21bb38ddd334ec04721dea64d diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index f7336c0..53cff4e 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -11,16 +11,15 @@ __all__ = [ "StopsForRouteListResponse", "StopsForRouteListResponseData", - "StopsForRouteListResponseDataData", - "StopsForRouteListResponseDataDataEntry", - "StopsForRouteListResponseDataDataEntryPolyline", - "StopsForRouteListResponseDataDataEntryStopGrouping", - "StopsForRouteListResponseDataDataEntryStopGroupingName", - "StopsForRouteListResponseDataDataEntryStopGroupingPolyline", + "StopsForRouteListResponseDataEntry", + "StopsForRouteListResponseDataEntryPolyline", + "StopsForRouteListResponseDataEntryStopGrouping", + "StopsForRouteListResponseDataEntryStopGroupingName", + "StopsForRouteListResponseDataEntryStopGroupingPolyline", ] -class StopsForRouteListResponseDataDataEntryPolyline(BaseModel): +class StopsForRouteListResponseDataEntryPolyline(BaseModel): length: Optional[int] = None levels: Optional[str] = None @@ -28,7 +27,7 @@ class StopsForRouteListResponseDataDataEntryPolyline(BaseModel): points: Optional[str] = None -class StopsForRouteListResponseDataDataEntryStopGroupingName(BaseModel): +class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): name: Optional[str] = None names: Optional[List[str]] = None @@ -36,7 +35,7 @@ class StopsForRouteListResponseDataDataEntryStopGroupingName(BaseModel): type: Optional[str] = None -class StopsForRouteListResponseDataDataEntryStopGroupingPolyline(BaseModel): +class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None levels: Optional[str] = None @@ -44,37 +43,33 @@ class StopsForRouteListResponseDataDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None -class StopsForRouteListResponseDataDataEntryStopGrouping(BaseModel): +class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): id: Optional[str] = None - name: Optional[StopsForRouteListResponseDataDataEntryStopGroupingName] = None + name: Optional[StopsForRouteListResponseDataEntryStopGroupingName] = None - polylines: Optional[List[StopsForRouteListResponseDataDataEntryStopGroupingPolyline]] = None + polylines: Optional[List[StopsForRouteListResponseDataEntryStopGroupingPolyline]] = None stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) -class StopsForRouteListResponseDataDataEntry(BaseModel): - polylines: Optional[List[StopsForRouteListResponseDataDataEntryPolyline]] = None +class StopsForRouteListResponseDataEntry(BaseModel): + polylines: Optional[List[StopsForRouteListResponseDataEntryPolyline]] = None route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - stop_groupings: Optional[List[StopsForRouteListResponseDataDataEntryStopGrouping]] = FieldInfo( + stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo( alias="stopGroupings", default=None ) stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) -class StopsForRouteListResponseDataData(BaseModel): - entry: StopsForRouteListResponseDataDataEntry +class StopsForRouteListResponseData(BaseModel): + entry: StopsForRouteListResponseDataEntry references: References -class StopsForRouteListResponseData(BaseModel): - data: StopsForRouteListResponseDataData - - class StopsForRouteListResponse(ResponseWrapper): data: StopsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index f40d3a9..8806aee 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -150,14 +150,10 @@ class VehiclesForAgencyListResponseDataList(BaseModel): last_update_time: int = FieldInfo(alias="lastUpdateTime") - location: VehiclesForAgencyListResponseDataListLocation - - trip_id: str = FieldInfo(alias="tripId") - - trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias="tripStatus") - vehicle_id: str = FieldInfo(alias="vehicleId") + location: Optional[VehiclesForAgencyListResponseDataListLocation] = None + occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) @@ -168,6 +164,10 @@ class VehiclesForAgencyListResponseDataList(BaseModel): status: Optional[str] = None + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + + trip_status: Optional[VehiclesForAgencyListResponseDataListTripStatus] = FieldInfo(alias="tripStatus", default=None) + class VehiclesForAgencyListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") From fc63081cfb7e0f8d57cf85ee3215bfefa0ec06ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:49:02 +0000 Subject: [PATCH 373/397] release: 1.20.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2884c2e..69eb19a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.7" + ".": "1.20.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6521df7..27d6708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.20.0 (2026-03-09) + +Full Changelog: [v1.19.7...v1.20.0](https://github.com/OneBusAway/python-sdk/compare/v1.19.7...v1.20.0) + +### Features + +* **api:** api update ([5f55ef1](https://github.com/OneBusAway/python-sdk/commit/5f55ef1165888a1834d6681042e889f695ce7d54)) +* **api:** api update ([e11aff5](https://github.com/OneBusAway/python-sdk/commit/e11aff5e8aee29546c94b7c555bbe1383a1233b5)) + ## 1.19.7 (2026-03-07) Full Changelog: [v1.19.6...v1.19.7](https://github.com/OneBusAway/python-sdk/compare/v1.19.6...v1.19.7) diff --git a/pyproject.toml b/pyproject.toml index a4bfc4c..346ad9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.19.7" +version = "1.20.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 37c15e9..1ce7cf1 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.19.7" # x-release-please-version +__version__ = "1.20.0" # x-release-please-version From 9e0b66ce6927ef0060c6cb81bafd576915c9803f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:34:46 +0000 Subject: [PATCH 374/397] feat(api): api update --- .stats.yml | 4 ++-- .../types/agencies_with_coverage_list_response.py | 6 +++--- src/onebusaway/types/agency_retrieve_response.py | 2 -- src/onebusaway/types/route_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/routes_for_agency_list_response.py | 4 ++-- src/onebusaway/types/routes_for_location_list_response.py | 4 ++-- src/onebusaway/types/search_for_route_list_response.py | 4 ++-- src/onebusaway/types/search_for_stop_list_response.py | 4 ++-- src/onebusaway/types/shared/references.py | 5 +---- src/onebusaway/types/stop_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/stops_for_agency_list_response.py | 4 ++-- src/onebusaway/types/stops_for_location_list_response.py | 4 ++-- src/onebusaway/types/trips_for_location_list_response.py | 6 +++--- src/onebusaway/types/trips_for_route_list_response.py | 4 ++-- src/onebusaway/types/vehicles_for_agency_list_response.py | 4 ++-- 15 files changed, 31 insertions(+), 36 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8dd1ce7..1594ba1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-22e1c98416f77779b2c07db272016be0b623b94f6b55cca2d1909f9dc4032c3f.yml -openapi_spec_hash: dd25fff6bc185752d92e93f6e47d3a5e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-0c305d11543f8fc11bd55586c4dc4a724b10de1898cab0fe11364b4db6455752.yml +openapi_spec_hash: 6d10c2ac411cd65f30d200f298577b32 config_hash: 3871f5d21bb38ddd334ec04721dea64d diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py index 13f182b..27082f9 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from pydantic import Field as FieldInfo @@ -28,12 +28,12 @@ class AgenciesWithCoverageListResponseDataList(BaseModel): class AgenciesWithCoverageListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[AgenciesWithCoverageListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class AgenciesWithCoverageListResponse(ResponseWrapper): data: AgenciesWithCoverageListResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 61d8e79..61e1bc6 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -36,8 +36,6 @@ class AgencyRetrieveResponseDataEntry(BaseModel): class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - references: References diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index 193704e..ffe9c32 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class RouteIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[str] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class RouteIDsForAgencyListResponse(ResponseWrapper): data: RouteIDsForAgencyListResponseData diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 672141d..34ddc66 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -34,12 +34,12 @@ class RoutesForAgencyListResponseDataList(BaseModel): class RoutesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[RoutesForAgencyListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class RoutesForAgencyListResponse(ResponseWrapper): data: RoutesForAgencyListResponseData diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index 0393f01..aebd12d 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -38,14 +38,14 @@ class RoutesForLocationListResponseDataList(BaseModel): class RoutesForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[RoutesForLocationListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class RoutesForLocationListResponse(ResponseWrapper): data: RoutesForLocationListResponseData diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py index e54153a..f6b53f7 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -34,14 +34,14 @@ class SearchForRouteListResponseDataList(BaseModel): class SearchForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[SearchForRouteListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class SearchForRouteListResponse(ResponseWrapper): data: Optional[SearchForRouteListResponseData] = None diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 28574d5..5c40083 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -36,14 +36,14 @@ class SearchForStopListResponseDataList(BaseModel): class SearchForStopListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[SearchForStopListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class SearchForStopListResponse(ResponseWrapper): data: Optional[SearchForStopListResponseData] = None diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 2c50704..4a95520 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -181,9 +180,7 @@ class Situation(BaseModel): alias="publicationWindows", default=None ) - reason: Optional[ - Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"] - ] = None + reason: Optional[str] = None """Reason for the service alert, taken from TPEG codes.""" severity: Optional[str] = None diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index 3ae9947..f36b63f 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class StopIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[str] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class StopIDsForAgencyListResponse(ResponseWrapper): data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index a414d54..c44e7e3 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -36,12 +36,12 @@ class StopsForAgencyListResponseDataList(BaseModel): class StopsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForAgencyListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index 75d9ba9..69234bb 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -36,12 +36,12 @@ class StopsForLocationListResponseDataList(BaseModel): class StopsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForLocationListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index b104313..1af09eb 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -181,13 +181,13 @@ class TripsForLocationListResponseDataList(BaseModel): class TripsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - """Indicates if the limit of trips has been exceeded""" - list: List[TripsForLocationListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + """Indicates if the limit of trips has been exceeded""" + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) """Indicates if the search location is out of range""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index f373c34..9f931da 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -181,12 +181,12 @@ class TripsForRouteListResponseDataList(BaseModel): class TripsForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[TripsForRouteListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class TripsForRouteListResponse(ResponseWrapper): data: TripsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 8806aee..d5c7037 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -170,12 +170,12 @@ class VehiclesForAgencyListResponseDataList(BaseModel): class VehiclesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[VehiclesForAgencyListResponseDataList] references: References + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + class VehiclesForAgencyListResponse(ResponseWrapper): data: VehiclesForAgencyListResponseData From a9159653aba9f21500b782195182dd7cb3dab583 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:35:09 +0000 Subject: [PATCH 375/397] release: 1.21.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 69eb19a..ba231b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.20.0" + ".": "1.21.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d6708..490f474 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.21.0 (2026-03-10) + +Full Changelog: [v1.20.0...v1.21.0](https://github.com/OneBusAway/python-sdk/compare/v1.20.0...v1.21.0) + +### Features + +* **api:** api update ([9e0b66c](https://github.com/OneBusAway/python-sdk/commit/9e0b66ce6927ef0060c6cb81bafd576915c9803f)) + ## 1.20.0 (2026-03-09) Full Changelog: [v1.19.7...v1.20.0](https://github.com/OneBusAway/python-sdk/compare/v1.19.7...v1.20.0) diff --git a/pyproject.toml b/pyproject.toml index 346ad9c..c8b9d4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.20.0" +version = "1.21.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 1ce7cf1..6fa78eb 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.20.0" # x-release-please-version +__version__ = "1.21.0" # x-release-please-version From 9c5ed4a46e17562d8c1f2a80a2e44b4374c09aea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2026 03:21:40 +0000 Subject: [PATCH 376/397] feat(api): api update --- .stats.yml | 4 ++-- src/onebusaway/types/arrival_and_departure_list_response.py | 4 ++-- .../types/arrival_and_departure_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_detail_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 4 ++-- src/onebusaway/types/trips_for_location_list_response.py | 4 ++-- src/onebusaway/types/trips_for_route_list_response.py | 4 ++-- src/onebusaway/types/vehicles_for_agency_list_response.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1594ba1..1266cd8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-0c305d11543f8fc11bd55586c4dc4a724b10de1898cab0fe11364b4db6455752.yml -openapi_spec_hash: 6d10c2ac411cd65f30d200f298577b32 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-30baad9d29b0909d180aae300750a0cd8425b52d7a60ba365b6aa4e5f8da6fab.yml +openapi_spec_hash: 218466af34966d9b08728f107cb3b3b0 config_hash: 3871f5d21bb38ddd334ec04721dea64d diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index cb8aeb3..4da3e86 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -20,7 +20,7 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -108,7 +108,7 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas last_known_location: Optional[ ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation ] = FieldInfo(alias="lastKnownLocation", default=None) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index a4ed922..b45d300 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -19,7 +19,7 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -107,7 +107,7 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index cb1552c..ccb12cc 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -47,7 +47,7 @@ class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -133,7 +133,7 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 3ee8582..d7f7ee9 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -47,7 +47,7 @@ class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -133,7 +133,7 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 1af09eb..9530952 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -47,7 +47,7 @@ class TripsForLocationListResponseDataListSchedule(BaseModel): class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -133,7 +133,7 @@ class TripsForLocationListResponseDataListStatus(BaseModel): last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index 9f931da..e7ecb00 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -47,7 +47,7 @@ class TripsForRouteListResponseDataListSchedule(BaseModel): class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -133,7 +133,7 @@ class TripsForRouteListResponseDataListStatus(BaseModel): last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index d5c7037..0cb3e14 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -26,7 +26,7 @@ class VehiclesForAgencyListResponseDataListLocation(BaseModel): class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel): - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -112,7 +112,7 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) - """Last known location of the transit vehicle.""" + """Last known location of the transit vehicle (optional).""" last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" From 7ab059a4b45c642bcfe8fa71bdc8bd16189a3aa0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2026 03:21:58 +0000 Subject: [PATCH 377/397] release: 1.22.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ba231b0..397c420 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.21.0" + ".": "1.22.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 490f474..711e52d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.22.0 (2026-03-14) + +Full Changelog: [v1.21.0...v1.22.0](https://github.com/OneBusAway/python-sdk/compare/v1.21.0...v1.22.0) + +### Features + +* **api:** api update ([9c5ed4a](https://github.com/OneBusAway/python-sdk/commit/9c5ed4a46e17562d8c1f2a80a2e44b4374c09aea)) + ## 1.21.0 (2026-03-10) Full Changelog: [v1.20.0...v1.21.0](https://github.com/OneBusAway/python-sdk/compare/v1.20.0...v1.21.0) diff --git a/pyproject.toml b/pyproject.toml index c8b9d4e..1036225 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.21.0" +version = "1.22.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6fa78eb..6f32ea8 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.21.0" # x-release-please-version +__version__ = "1.22.0" # x-release-please-version From 658f6ca0c5da679a8a771952e19fbef3654bc66b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 08:51:49 +0000 Subject: [PATCH 378/397] fix(pydantic): do not pass `by_alias` unless set --- src/onebusaway/_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 786ff42..e6690a4 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", From 13f6b82ee19b6e51b29e800ce5715f967db07b64 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 08:55:19 +0000 Subject: [PATCH 379/397] fix(deps): bump minimum typing-extensions version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1036225..9b5c36e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", + "typing-extensions>=4.14, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", From 0187280015c3dd74afef273cc66cb8892ff8c772 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 08:58:07 +0000 Subject: [PATCH 380/397] chore(internal): tweak CI branches --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68ef435..84b4bce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' From b5a0ef812c736cc0d554993d60fd2e0ff0a0f577 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 08:58:27 +0000 Subject: [PATCH 381/397] release: 1.22.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 397c420..efc2d51 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.22.0" + ".": "1.22.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 711e52d..9ab862c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 1.22.1 (2026-03-17) + +Full Changelog: [v1.22.0...v1.22.1](https://github.com/OneBusAway/python-sdk/compare/v1.22.0...v1.22.1) + +### Bug Fixes + +* **deps:** bump minimum typing-extensions version ([13f6b82](https://github.com/OneBusAway/python-sdk/commit/13f6b82ee19b6e51b29e800ce5715f967db07b64)) +* **pydantic:** do not pass `by_alias` unless set ([658f6ca](https://github.com/OneBusAway/python-sdk/commit/658f6ca0c5da679a8a771952e19fbef3654bc66b)) + + +### Chores + +* **internal:** tweak CI branches ([0187280](https://github.com/OneBusAway/python-sdk/commit/0187280015c3dd74afef273cc66cb8892ff8c772)) + ## 1.22.0 (2026-03-14) Full Changelog: [v1.21.0...v1.22.0](https://github.com/OneBusAway/python-sdk/compare/v1.21.0...v1.22.0) diff --git a/pyproject.toml b/pyproject.toml index 9b5c36e..10c2fe6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.22.0" +version = "1.22.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 6f32ea8..bb45419 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.22.0" # x-release-please-version +__version__ = "1.22.1" # x-release-please-version From 3d04ad1d05edb09c8eac32fc6a0752fadf20a04e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:11:13 +0000 Subject: [PATCH 382/397] fix: sanitize endpoint path params --- src/onebusaway/_utils/__init__.py | 1 + src/onebusaway/_utils/_path.py | 127 ++++++++++++++++++ src/onebusaway/resources/agency.py | 5 +- .../resources/arrival_and_departure.py | 10 +- src/onebusaway/resources/block.py | 5 +- .../resources/report_problem_with_stop.py | 6 +- .../resources/report_problem_with_trip.py | 6 +- src/onebusaway/resources/route.py | 5 +- .../resources/route_ids_for_agency.py | 5 +- src/onebusaway/resources/routes_for_agency.py | 5 +- .../resources/schedule_for_route.py | 6 +- src/onebusaway/resources/schedule_for_stop.py | 6 +- src/onebusaway/resources/shape.py | 5 +- src/onebusaway/resources/stop.py | 5 +- .../resources/stop_ids_for_agency.py | 5 +- src/onebusaway/resources/stops_for_agency.py | 5 +- src/onebusaway/resources/stops_for_route.py | 6 +- src/onebusaway/resources/trip.py | 5 +- src/onebusaway/resources/trip_details.py | 6 +- src/onebusaway/resources/trip_for_vehicle.py | 6 +- src/onebusaway/resources/trips_for_route.py | 6 +- .../resources/vehicles_for_agency.py | 6 +- tests/test_utils/test_path.py | 89 ++++++++++++ 23 files changed, 279 insertions(+), 52 deletions(-) create mode 100644 src/onebusaway/_utils/_path.py create mode 100644 tests/test_utils/test_path.py diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py index dc64e29..10cb66d 100644 --- a/src/onebusaway/_utils/__init__.py +++ b/src/onebusaway/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( diff --git a/src/onebusaway/_utils/_path.py b/src/onebusaway/_utils/_path.py new file mode 100644 index 0000000..4d6e1e4 --- /dev/null +++ b/src/onebusaway/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 6510af2..f877a6f 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/agency/{agency_id}.json", + path_template("/api/where/agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/agency/{agency_id}.json", + path_template("/api/where/agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 7f935c8..b2dce82 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -9,7 +9,7 @@ from ..types import arrival_and_departure_list_params, arrival_and_departure_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -76,7 +76,7 @@ def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( - f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", + path_template("/api/where/arrival-and-departure-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -131,7 +131,7 @@ def list( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( - f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", + path_template("/api/where/arrivals-and-departures-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -201,7 +201,7 @@ async def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( - f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", + path_template("/api/where/arrival-and-departure-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -256,7 +256,7 @@ async def list( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( - f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", + path_template("/api/where/arrivals-and-departures-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index 5ce7bdc..93a2d31 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not block_id: raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") return self._get( - f"/api/where/block/{block_id}.json", + path_template("/api/where/block/{block_id}.json", block_id=block_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not block_id: raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") return await self._get( - f"/api/where/block/{block_id}.json", + path_template("/api/where/block/{block_id}.json", block_id=block_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index 6127491..071dc6f 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -8,7 +8,7 @@ from ..types import report_problem_with_stop_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -85,7 +85,7 @@ def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( - f"/api/where/report-problem-with-stop/{stop_id}.json", + path_template("/api/where/report-problem-with-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +168,7 @@ async def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( - f"/api/where/report-problem-with-stop/{stop_id}.json", + path_template("/api/where/report-problem-with-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index 6c3dc23..4c4e460 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -8,7 +8,7 @@ from ..types import report_problem_with_trip_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -107,7 +107,7 @@ def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( - f"/api/where/report-problem-with-trip/{trip_id}.json", + path_template("/api/where/report-problem-with-trip/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -217,7 +217,7 @@ async def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( - f"/api/where/report-problem-with-trip/{trip_id}.json", + path_template("/api/where/report-problem-with-trip/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index be67b63..4b40004 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( - f"/api/where/route/{route_id}.json", + path_template("/api/where/route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( - f"/api/where/route/{route_id}.json", + path_template("/api/where/route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index c9d7ef5..956bca9 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/route-ids-for-agency/{agency_id}.json", + path_template("/api/where/route-ids-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/route-ids-for-agency/{agency_id}.json", + path_template("/api/where/route-ids-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index b4b36da..6845cb8 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/routes-for-agency/{agency_id}.json", + path_template("/api/where/routes-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/routes-for-agency/{agency_id}.json", + path_template("/api/where/routes-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 0c12dd4..5df8b5c 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -9,7 +9,7 @@ from ..types import schedule_for_route_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -74,7 +74,7 @@ def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( - f"/api/where/schedule-for-route/{route_id}.json", + path_template("/api/where/schedule-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -138,7 +138,7 @@ async def retrieve( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( - f"/api/where/schedule-for-route/{route_id}.json", + path_template("/api/where/schedule-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 06ebe98..894b014 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -9,7 +9,7 @@ from ..types import schedule_for_stop_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -74,7 +74,7 @@ def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( - f"/api/where/schedule-for-stop/{stop_id}.json", + path_template("/api/where/schedule-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -136,7 +136,7 @@ async def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( - f"/api/where/schedule-for-stop/{stop_id}.json", + path_template("/api/where/schedule-for-stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 8001169..42d75ac 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not shape_id: raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") return self._get( - f"/api/where/shape/{shape_id}.json", + path_template("/api/where/shape/{shape_id}.json", shape_id=shape_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not shape_id: raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") return await self._get( - f"/api/where/shape/{shape_id}.json", + path_template("/api/where/shape/{shape_id}.json", shape_id=shape_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 21a8cf1..9efd7f2 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return self._get( - f"/api/where/stop/{stop_id}.json", + path_template("/api/where/stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not stop_id: raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") return await self._get( - f"/api/where/stop/{stop_id}.json", + path_template("/api/where/stop/{stop_id}.json", stop_id=stop_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index a14de79..5127022 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/stop-ids-for-agency/{agency_id}.json", + path_template("/api/where/stop-ids-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/stop-ids-for-agency/{agency_id}.json", + path_template("/api/where/stop-ids-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 74da5c1..70f5597 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/stops-for-agency/{agency_id}.json", + path_template("/api/where/stops-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/stops-for-agency/{agency_id}.json", + path_template("/api/where/stops-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 0d940e3..1540baa 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -6,7 +6,7 @@ from ..types import stops_for_route_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -73,7 +73,7 @@ def list( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( - f"/api/where/stops-for-route/{route_id}.json", + path_template("/api/where/stops-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +143,7 @@ async def list( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( - f"/api/where/stops-for-route/{route_id}.json", + path_template("/api/where/stops-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index b13fb0d..4fd0004 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( - f"/api/where/trip/{trip_id}.json", + path_template("/api/where/trip/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( - f"/api/where/trip/{trip_id}.json", + path_template("/api/where/trip/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 3c5e8b0..a2728d6 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -6,7 +6,7 @@ from ..types import trip_detail_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -85,7 +85,7 @@ def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return self._get( - f"/api/where/trip-details/{trip_id}.json", + path_template("/api/where/trip-details/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -170,7 +170,7 @@ async def retrieve( if not trip_id: raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") return await self._get( - f"/api/where/trip-details/{trip_id}.json", + path_template("/api/where/trip-details/{trip_id}.json", trip_id=trip_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 510ea65..cac7897 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -6,7 +6,7 @@ from ..types import trip_for_vehicle_retrieve_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -82,7 +82,7 @@ def retrieve( if not vehicle_id: raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return self._get( - f"/api/where/trip-for-vehicle/{vehicle_id}.json", + path_template("/api/where/trip-for-vehicle/{vehicle_id}.json", vehicle_id=vehicle_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -163,7 +163,7 @@ async def retrieve( if not vehicle_id: raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") return await self._get( - f"/api/where/trip-for-vehicle/{vehicle_id}.json", + path_template("/api/where/trip-for-vehicle/{vehicle_id}.json", vehicle_id=vehicle_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index 5ada544..ed7840d 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -6,7 +6,7 @@ from ..types import trips_for_route_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -77,7 +77,7 @@ def list( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return self._get( - f"/api/where/trips-for-route/{route_id}.json", + path_template("/api/where/trips-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -152,7 +152,7 @@ async def list( if not route_id: raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") return await self._get( - f"/api/where/trips-for-route/{route_id}.json", + path_template("/api/where/trips-for-route/{route_id}.json", route_id=route_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index aba7f80..80c6fd2 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -6,7 +6,7 @@ from ..types import vehicles_for_agency_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +70,7 @@ def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return self._get( - f"/api/where/vehicles-for-agency/{agency_id}.json", + path_template("/api/where/vehicles-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -131,7 +131,7 @@ async def list( if not agency_id: raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") return await self._get( - f"/api/where/vehicles-for-agency/{agency_id}.json", + path_template("/api/where/vehicles-for-agency/{agency_id}.json", agency_id=agency_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 0000000..5cc6b87 --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from onebusaway._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs) From 9737588d82b10a90ecc22f6c0e9b7918362ff799 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:11:54 +0000 Subject: [PATCH 383/397] refactor(tests): switch from prism to steady --- CONTRIBUTING.md | 2 +- scripts/mock | 26 +++++++++++++------------- scripts/test | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2100731..9abb25c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,7 +85,7 @@ $ pip install ./path-to-wheel-file.whl ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. +Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests. ```sh $ ./scripts/mock diff --git a/scripts/mock b/scripts/mock index bcf3b39..00b490b 100755 --- a/scripts/mock +++ b/scripts/mock @@ -19,34 +19,34 @@ fi echo "==> Starting mock server with URL ${URL}" -# Run prism mock on the given spec +# Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stdy/cli@0.19.3 -- steady --version - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" &> .stdy.log & - # Wait for server to come online (max 30s) + # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi attempts=$((attempts + 1)) if [ "$attempts" -ge 300 ]; then echo - echo "Timed out waiting for Prism server to start" - cat .prism.log + echo "Timed out waiting for Steady server to start" + cat .stdy.log exit 1 fi echo -n "." sleep 0.1 done - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - echo else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index dbeda2d..d0fe9be 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,8 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -25,7 +25,7 @@ function is_overriding_api_base_url() { [ -n "$TEST_API_BASE_URL" ] } -if ! is_overriding_api_base_url && ! prism_is_running ; then +if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process trap 'kill_server_on_port 4010' EXIT @@ -36,19 +36,19 @@ fi if is_overriding_api_base_url ; then echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server" echo -e "running against your OpenAPI spec." echo echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" + echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets${NC}" echo exit 1 else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" echo fi From 7dc10afd245b84a539d7e37b62d3cb67dcab0407 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 03:54:33 +0000 Subject: [PATCH 384/397] chore(tests): bump steady to v0.19.4 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 00b490b..f310477 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.3 -- steady --version + npm exec --package=@stdy/cli@0.19.4 -- steady --version - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index d0fe9be..0c2bfad 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.4 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From d0e4a0fe58e465c809f224ea81f08835be586a77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 03:58:18 +0000 Subject: [PATCH 385/397] chore(tests): bump steady to v0.19.5 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index f310477..54fc791 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.4 -- steady --version + npm exec --package=@stdy/cli@0.19.5 -- steady --version - npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.4 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 0c2bfad..4153738 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.4 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From ad434527afac6ff4640dc8ba70871149a7ecab4e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:00:07 +0000 Subject: [PATCH 386/397] chore(internal): update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 95ceb18..3824f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log _dev __pycache__ From b06831111127830e923c9e069bcedc089cd319c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:04:34 +0000 Subject: [PATCH 387/397] chore(tests): bump steady to v0.19.6 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 54fc791..0f82c95 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.5 -- steady --version + npm exec --package=@stdy/cli@0.19.6 -- steady --version - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 4153738..4f9eef9 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From dc9ab43ae3b46cf4dee88f431b1333d9bf152b58 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 02:56:31 +0000 Subject: [PATCH 388/397] chore(ci): skip lint on metadata-only changes Note that we still want to run tests, as these depend on the metadata. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84b4bce..35bbf55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/open-transit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -38,7 +38,7 @@ jobs: run: ./scripts/lint build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') timeout-minutes: 10 name: build permissions: From d9c762957c1bc68715a3b8f7f91b034d054fa58b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 02:56:58 +0000 Subject: [PATCH 389/397] chore(tests): bump steady to v0.19.7 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 0f82c95..3732f8e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.6 -- steady --version + npm exec --package=@stdy/cli@0.19.7 -- steady --version - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 4f9eef9..e642cea 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 0ad17d5bf726b30e6a0dabaa9f119b3d7d3b87aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 02:57:15 +0000 Subject: [PATCH 390/397] release: 1.22.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index efc2d51..f6c1863 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.22.1" + ".": "1.22.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab862c..c2e2125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 1.22.2 (2026-03-25) + +Full Changelog: [v1.22.1...v1.22.2](https://github.com/OneBusAway/python-sdk/compare/v1.22.1...v1.22.2) + +### Bug Fixes + +* sanitize endpoint path params ([3d04ad1](https://github.com/OneBusAway/python-sdk/commit/3d04ad1d05edb09c8eac32fc6a0752fadf20a04e)) + + +### Chores + +* **ci:** skip lint on metadata-only changes ([dc9ab43](https://github.com/OneBusAway/python-sdk/commit/dc9ab43ae3b46cf4dee88f431b1333d9bf152b58)) +* **internal:** update gitignore ([ad43452](https://github.com/OneBusAway/python-sdk/commit/ad434527afac6ff4640dc8ba70871149a7ecab4e)) +* **tests:** bump steady to v0.19.4 ([7dc10af](https://github.com/OneBusAway/python-sdk/commit/7dc10afd245b84a539d7e37b62d3cb67dcab0407)) +* **tests:** bump steady to v0.19.5 ([d0e4a0f](https://github.com/OneBusAway/python-sdk/commit/d0e4a0fe58e465c809f224ea81f08835be586a77)) +* **tests:** bump steady to v0.19.6 ([b068311](https://github.com/OneBusAway/python-sdk/commit/b06831111127830e923c9e069bcedc089cd319c9)) +* **tests:** bump steady to v0.19.7 ([d9c7629](https://github.com/OneBusAway/python-sdk/commit/d9c762957c1bc68715a3b8f7f91b034d054fa58b)) + + +### Refactors + +* **tests:** switch from prism to steady ([9737588](https://github.com/OneBusAway/python-sdk/commit/9737588d82b10a90ecc22f6c0e9b7918362ff799)) + ## 1.22.1 (2026-03-17) Full Changelog: [v1.22.0...v1.22.1](https://github.com/OneBusAway/python-sdk/compare/v1.22.0...v1.22.1) diff --git a/pyproject.toml b/pyproject.toml index 10c2fe6..fe99a7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.22.1" +version = "1.22.2" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index bb45419..d7dc3fd 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.22.1" # x-release-please-version +__version__ = "1.22.2" # x-release-please-version From b5f2cbb5007ec41ed5e29e1efee72347521767db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 05:11:18 +0000 Subject: [PATCH 391/397] feat(internal): implement indices array format for query and form serialization --- scripts/mock | 4 ++-- scripts/test | 2 +- src/onebusaway/_qs.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 3732f8e..58e4628 100755 --- a/scripts/mock +++ b/scripts/mock @@ -24,7 +24,7 @@ if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout npm exec --package=@stdy/cli@0.19.7 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index e642cea..3970464 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py index ada6fd3..de8c99b 100644 --- a/src/onebusaway/_qs.py +++ b/src/onebusaway/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" From 469b9a4c2e640e5f07cc536826cbd258e1d27220 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 05:11:38 +0000 Subject: [PATCH 392/397] release: 1.23.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f6c1863..cdcf20e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.22.2" + ".": "1.23.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e2125..d43b05e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.23.0 (2026-03-27) + +Full Changelog: [v1.22.2...v1.23.0](https://github.com/OneBusAway/python-sdk/compare/v1.22.2...v1.23.0) + +### Features + +* **internal:** implement indices array format for query and form serialization ([b5f2cbb](https://github.com/OneBusAway/python-sdk/commit/b5f2cbb5007ec41ed5e29e1efee72347521767db)) + ## 1.22.2 (2026-03-25) Full Changelog: [v1.22.1...v1.22.2](https://github.com/OneBusAway/python-sdk/compare/v1.22.1...v1.22.2) diff --git a/pyproject.toml b/pyproject.toml index fe99a7e..27beb69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.22.2" +version = "1.23.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index d7dc3fd..fb204a9 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.22.2" # x-release-please-version +__version__ = "1.23.0" # x-release-please-version From 349fab1505b040ed2e6fc7dd8d44a8f5cbe90385 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:19:43 +0000 Subject: [PATCH 393/397] feat(api): api update --- .stats.yml | 8 +- api.md | 12 + src/onebusaway/_client.py | 65 ++++ src/onebusaway/resources/__init__.py | 14 + .../arrivals_and_departures_for_location.py | 269 +++++++++++++++ src/onebusaway/types/__init__.py | 6 + ...and_departures_for_location_list_params.py | 50 +++ ...d_departures_for_location_list_response.py | 306 ++++++++++++++++++ ...st_arrivals_and_departures_for_location.py | 144 +++++++++ 9 files changed, 870 insertions(+), 4 deletions(-) create mode 100644 src/onebusaway/resources/arrivals_and_departures_for_location.py create mode 100644 src/onebusaway/types/arrivals_and_departures_for_location_list_params.py create mode 100644 src/onebusaway/types/arrivals_and_departures_for_location_list_response.py create mode 100644 tests/api_resources/test_arrivals_and_departures_for_location.py diff --git a/.stats.yml b/.stats.yml index 1266cd8..fa222e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-30baad9d29b0909d180aae300750a0cd8425b52d7a60ba365b6aa4e5f8da6fab.yml -openapi_spec_hash: 218466af34966d9b08728f107cb3b3b0 -config_hash: 3871f5d21bb38ddd334ec04721dea64d +configured_endpoints: 30 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a30b0967ffed17b866dc65b5528148a06a42cce7c3c6d8f740ae2f6079963e7d.yml +openapi_spec_hash: 9bf1e5bf00ef9936a9181ebd0956d5b8 +config_hash: c28ddf5b7754155603d9fd1c5fcaeeff diff --git a/api.md b/api.md index 7a627ca..99bf45d 100644 --- a/api.md +++ b/api.md @@ -196,6 +196,18 @@ Methods: - client.schedule_for_route.retrieve(route_id, \*\*params) -> ScheduleForRouteRetrieveResponse +# ArrivalsAndDeparturesForLocation + +Types: + +```python +from onebusaway.types import ArrivalsAndDeparturesForLocationListResponse +``` + +Methods: + +- client.arrivals_and_departures_for_location.list(\*\*params) -> ArrivalsAndDeparturesForLocationListResponse + # ArrivalAndDeparture Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 5923bba..43f6c0b 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -60,6 +60,7 @@ agencies_with_coverage, report_problem_with_stop, report_problem_with_trip, + arrivals_and_departures_for_location, ) from .resources.stop import StopResource, AsyncStopResource from .resources.trip import TripResource, AsyncTripResource @@ -89,6 +90,10 @@ from .resources.agencies_with_coverage import AgenciesWithCoverageResource, AsyncAgenciesWithCoverageResource from .resources.report_problem_with_stop import ReportProblemWithStopResource, AsyncReportProblemWithStopResource from .resources.report_problem_with_trip import ReportProblemWithTripResource, AsyncReportProblemWithTripResource + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResource, + AsyncArrivalsAndDeparturesForLocationResource, + ) __all__ = [ "Timeout", @@ -253,6 +258,12 @@ def schedule_for_route(self) -> ScheduleForRouteResource: return ScheduleForRouteResource(self) + @cached_property + def arrivals_and_departures_for_location(self) -> ArrivalsAndDeparturesForLocationResource: + from .resources.arrivals_and_departures_for_location import ArrivalsAndDeparturesForLocationResource + + return ArrivalsAndDeparturesForLocationResource(self) + @cached_property def arrival_and_departure(self) -> ArrivalAndDepartureResource: from .resources.arrival_and_departure import ArrivalAndDepartureResource @@ -600,6 +611,12 @@ def schedule_for_route(self) -> AsyncScheduleForRouteResource: return AsyncScheduleForRouteResource(self) + @cached_property + def arrivals_and_departures_for_location(self) -> AsyncArrivalsAndDeparturesForLocationResource: + from .resources.arrivals_and_departures_for_location import AsyncArrivalsAndDeparturesForLocationResource + + return AsyncArrivalsAndDeparturesForLocationResource(self) + @cached_property def arrival_and_departure(self) -> AsyncArrivalAndDepartureResource: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResource @@ -898,6 +915,18 @@ def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithR return ScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.ArrivalsAndDeparturesForLocationResourceWithRawResponse: + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResourceWithRawResponse, + ) + + return ArrivalsAndDeparturesForLocationResourceWithRawResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse: from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithRawResponse @@ -1073,6 +1102,18 @@ def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResource return AsyncScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + from .resources.arrivals_and_departures_for_location import ( + AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse, + ) + + return AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithRawResponse @@ -1248,6 +1289,18 @@ def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithS return ScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + ) + + return ArrivalsAndDeparturesForLocationResourceWithStreamingResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse: from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithStreamingResponse @@ -1423,6 +1476,18 @@ def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResource return AsyncScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + from .resources.arrivals_and_departures_for_location import ( + AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + ) + + return AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithStreamingResponse diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 0a958d2..99cd939 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -224,6 +224,14 @@ ReportProblemWithTripResourceWithStreamingResponse, AsyncReportProblemWithTripResourceWithStreamingResponse, ) +from .arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResource, + AsyncArrivalsAndDeparturesForLocationResource, + ArrivalsAndDeparturesForLocationResourceWithRawResponse, + AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse, + ArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse, +) __all__ = [ "AgenciesWithCoverageResource", @@ -322,6 +330,12 @@ "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", + "ArrivalsAndDeparturesForLocationResource", + "AsyncArrivalsAndDeparturesForLocationResource", + "ArrivalsAndDeparturesForLocationResourceWithRawResponse", + "AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse", + "ArrivalsAndDeparturesForLocationResourceWithStreamingResponse", + "AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", diff --git a/src/onebusaway/resources/arrivals_and_departures_for_location.py b/src/onebusaway/resources/arrivals_and_departures_for_location.py new file mode 100644 index 0000000..adf45b7 --- /dev/null +++ b/src/onebusaway/resources/arrivals_and_departures_for_location.py @@ -0,0 +1,269 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import arrivals_and_departures_for_location_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.arrivals_and_departures_for_location_list_response import ArrivalsAndDeparturesForLocationListResponse + +__all__ = ["ArrivalsAndDeparturesForLocationResource", "AsyncArrivalsAndDeparturesForLocationResource"] + + +class ArrivalsAndDeparturesForLocationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ArrivalsAndDeparturesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return ArrivalsAndDeparturesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return ArrivalsAndDeparturesForLocationResourceWithStreamingResponse(self) + + def list( + self, + *, + lat: float, + lon: float, + empty_returns_not_found: bool | Omit = omit, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + max_count: int | Omit = omit, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + radius: float | Omit = omit, + route_type: str | Omit = omit, + time: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ArrivalsAndDeparturesForLocationListResponse: + """ + Returns real-time arrival and departure data for stops within a bounding box or + radius centered on a specific location. + + Args: + lat: The latitude coordinate of the search center. + + lon: The longitude coordinate of the search center. + + empty_returns_not_found: If true, returns a 404 Not Found error instead of an empty result. + + lat_span: Sets the latitude limits of the search bounding box. + + lon_span: Sets the longitude limits of the search bounding box. + + max_count: The max size of the list of nearby stops and arrivals to return. Defaults to + 250, max 1000. + + minutes_after: Include arrivals and departures this many minutes after the query time. + + minutes_before: Include arrivals and departures this many minutes before the query time. + + radius: The search radius in meters. + + route_type: Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3". + + time: By default, returns the status right now. Can be queried at a specific time + (milliseconds since epoch) for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/api/where/arrivals-and-departures-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lon": lon, + "empty_returns_not_found": empty_returns_not_found, + "lat_span": lat_span, + "lon_span": lon_span, + "max_count": max_count, + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "radius": radius, + "route_type": route_type, + "time": time, + }, + arrivals_and_departures_for_location_list_params.ArrivalsAndDeparturesForLocationListParams, + ), + ), + cast_to=ArrivalsAndDeparturesForLocationListResponse, + ) + + +class AsyncArrivalsAndDeparturesForLocationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse(self) + + async def list( + self, + *, + lat: float, + lon: float, + empty_returns_not_found: bool | Omit = omit, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + max_count: int | Omit = omit, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + radius: float | Omit = omit, + route_type: str | Omit = omit, + time: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ArrivalsAndDeparturesForLocationListResponse: + """ + Returns real-time arrival and departure data for stops within a bounding box or + radius centered on a specific location. + + Args: + lat: The latitude coordinate of the search center. + + lon: The longitude coordinate of the search center. + + empty_returns_not_found: If true, returns a 404 Not Found error instead of an empty result. + + lat_span: Sets the latitude limits of the search bounding box. + + lon_span: Sets the longitude limits of the search bounding box. + + max_count: The max size of the list of nearby stops and arrivals to return. Defaults to + 250, max 1000. + + minutes_after: Include arrivals and departures this many minutes after the query time. + + minutes_before: Include arrivals and departures this many minutes before the query time. + + radius: The search radius in meters. + + route_type: Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3". + + time: By default, returns the status right now. Can be queried at a specific time + (milliseconds since epoch) for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/api/where/arrivals-and-departures-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lon": lon, + "empty_returns_not_found": empty_returns_not_found, + "lat_span": lat_span, + "lon_span": lon_span, + "max_count": max_count, + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "radius": radius, + "route_type": route_type, + "time": time, + }, + arrivals_and_departures_for_location_list_params.ArrivalsAndDeparturesForLocationListParams, + ), + ), + cast_to=ArrivalsAndDeparturesForLocationListResponse, + ) + + +class ArrivalsAndDeparturesForLocationResourceWithRawResponse: + def __init__(self, arrivals_and_departures_for_location: ArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = to_raw_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + def __init__(self, arrivals_and_departures_for_location: AsyncArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = async_to_raw_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + def __init__(self, arrivals_and_departures_for_location: ArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = to_streamed_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + def __init__(self, arrivals_and_departures_for_location: AsyncArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = async_to_streamed_response_wrapper( + arrivals_and_departures_for_location.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index a4bb996..bfd556d 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -54,3 +54,9 @@ from .report_problem_with_trip_retrieve_params import ( ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams, ) +from .arrivals_and_departures_for_location_list_params import ( + ArrivalsAndDeparturesForLocationListParams as ArrivalsAndDeparturesForLocationListParams, +) +from .arrivals_and_departures_for_location_list_response import ( + ArrivalsAndDeparturesForLocationListResponse as ArrivalsAndDeparturesForLocationListResponse, +) diff --git a/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py b/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py new file mode 100644 index 0000000..e1ed0f3 --- /dev/null +++ b/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ArrivalsAndDeparturesForLocationListParams"] + + +class ArrivalsAndDeparturesForLocationListParams(TypedDict, total=False): + lat: Required[float] + """The latitude coordinate of the search center.""" + + lon: Required[float] + """The longitude coordinate of the search center.""" + + empty_returns_not_found: Annotated[bool, PropertyInfo(alias="emptyReturnsNotFound")] + """If true, returns a 404 Not Found error instead of an empty result.""" + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + """Sets the latitude limits of the search bounding box.""" + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + """Sets the longitude limits of the search bounding box.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max size of the list of nearby stops and arrivals to return. + + Defaults to 250, max 1000. + """ + + minutes_after: Annotated[int, PropertyInfo(alias="minutesAfter")] + """Include arrivals and departures this many minutes after the query time.""" + + minutes_before: Annotated[int, PropertyInfo(alias="minutesBefore")] + """Include arrivals and departures this many minutes before the query time.""" + + radius: float + """The search radius in meters.""" + + route_type: Annotated[str, PropertyInfo(alias="routeType")] + """Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3".""" + + time: int + """By default, returns the status right now. + + Can be queried at a specific time (milliseconds since epoch) for testing. + """ diff --git a/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py b/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py new file mode 100644 index 0000000..a04ff1a --- /dev/null +++ b/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py @@ -0,0 +1,306 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "ArrivalsAndDeparturesForLocationListResponse", + "ArrivalsAndDeparturesForLocationListResponseData", + "ArrivalsAndDeparturesForLocationListResponseDataEntry", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition", + "ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID", +] + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle (optional).""" + + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): + """Trip-specific status for the arriving transit vehicle.""" + + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[ + ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation + ] = FieldInfo(alias="lastKnownLocation", default=None) + """Last known location of the transit vehicle (optional).""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = ( + None + ) + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture(BaseModel): + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + """Indicates if riders can arrive on this transit vehicle.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of this arrival’s trip into the sequence of trips for the active block.""" + + departure_enabled: bool = FieldInfo(alias="departureEnabled") + """Indicates if riders can depart from this transit vehicle.""" + + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + """Distance of the arriving transit vehicle from the stop, in meters.""" + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + """Historical occupancy information of the transit vehicle.""" + + last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + """Timestamp of the last update time for this arrival.""" + + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + """Current occupancy status of the transit vehicle.""" + + predicted: Optional[bool] = None + """Indicates if real-time arrival info is available for this trip.""" + + predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + """Interval for predicted arrival time, if available.""" + + predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + """Interval for predicted departure time, if available.""" + + predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + """Predicted occupancy status of the transit vehicle.""" + + route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + """ + Optional route long name that potentially overrides the route long name in the + referenced route element. + """ + + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + """ + Optional route short name that potentially overrides the route short name in the + referenced route element. + """ + + scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + """Interval for scheduled arrival time.""" + + scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + """Interval for scheduled departure time.""" + + scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + """Scheduled track information of the arriving transit vehicle.""" + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this arrival.""" + + status: Optional[str] = None + """Current status of the arrival.""" + + trip_status: Optional[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus] = ( + FieldInfo(alias="tripStatus", default=None) + ) + """Trip-specific status for the arriving transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID(BaseModel): + distance_from_query: Optional[float] = FieldInfo(alias="distanceFromQuery", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class ArrivalsAndDeparturesForLocationListResponseDataEntry(BaseModel): + arrivals_and_departures: List[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture] = ( + FieldInfo(alias="arrivalsAndDepartures") + ) + + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + nearby_stop_ids: List[ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID] = FieldInfo( + alias="nearbyStopIds" + ) + + stop_ids: List[str] = FieldInfo(alias="stopIds") + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + +class ArrivalsAndDeparturesForLocationListResponseData(BaseModel): + entry: ArrivalsAndDeparturesForLocationListResponseDataEntry + + references: References + + +class ArrivalsAndDeparturesForLocationListResponse(ResponseWrapper): + data: ArrivalsAndDeparturesForLocationListResponseData diff --git a/tests/api_resources/test_arrivals_and_departures_for_location.py b/tests/api_resources/test_arrivals_and_departures_for_location.py new file mode 100644 index 0000000..d08dae6 --- /dev/null +++ b/tests/api_resources/test_arrivals_and_departures_for_location.py @@ -0,0 +1,144 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import ( + ArrivalsAndDeparturesForLocationListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestArrivalsAndDeparturesForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + arrivals_and_departures_for_location = client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + arrivals_and_departures_for_location = client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + empty_returns_not_found=True, + lat_span=0, + lon_span=0, + max_count=1000, + minutes_after=0, + minutes_before=0, + radius=0, + route_type="routeType", + time=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.arrivals_and_departures_for_location.with_raw_response.list( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + arrivals_and_departures_for_location = response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.arrivals_and_departures_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + arrivals_and_departures_for_location = response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncArrivalsAndDeparturesForLocation: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + arrivals_and_departures_for_location = await async_client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + arrivals_and_departures_for_location = await async_client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + empty_returns_not_found=True, + lat_span=0, + lon_span=0, + max_count=1000, + minutes_after=0, + minutes_before=0, + radius=0, + route_type="routeType", + time=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrivals_and_departures_for_location.with_raw_response.list( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + arrivals_and_departures_for_location = await response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.arrivals_and_departures_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + arrivals_and_departures_for_location = await response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + assert cast(Any, response.is_closed) is True From 7782fff303fa90a90d141f0b78b49e1511446bfe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:20:02 +0000 Subject: [PATCH 394/397] release: 1.24.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cdcf20e..bfaab56 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.23.0" + ".": "1.24.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d43b05e..0dbdfcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.24.0 (2026-03-29) + +Full Changelog: [v1.23.0...v1.24.0](https://github.com/OneBusAway/python-sdk/compare/v1.23.0...v1.24.0) + +### Features + +* **api:** api update ([349fab1](https://github.com/OneBusAway/python-sdk/commit/349fab1505b040ed2e6fc7dd8d44a8f5cbe90385)) + ## 1.23.0 (2026-03-27) Full Changelog: [v1.22.2...v1.23.0](https://github.com/OneBusAway/python-sdk/compare/v1.22.2...v1.23.0) diff --git a/pyproject.toml b/pyproject.toml index 27beb69..ba3113d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.23.0" +version = "1.24.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index fb204a9..ae2ec79 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.23.0" # x-release-please-version +__version__ = "1.24.0" # x-release-please-version From 5fb2fbfcd95cd4db968c0c2e592c063e6b9a5135 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 06:43:32 +0000 Subject: [PATCH 395/397] chore(tests): bump steady to v0.20.1 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 58e4628..5ea72a2 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.7 -- steady --version + npm exec --package=@stdy/cli@0.20.1 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 3970464..3fdac80 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 From 007d6fdf2b3f40022fd4e40ec794defdd933115e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 06:46:55 +0000 Subject: [PATCH 396/397] chore(tests): bump steady to v0.20.2 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 5ea72a2..7c58865 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.20.1 -- steady --version + npm exec --package=@stdy/cli@0.20.2 -- steady --version - npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 3fdac80..87cdeac 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 From 48461f6aec514986d7f1f13b20b444d036df4d91 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 06:47:16 +0000 Subject: [PATCH 397/397] release: 1.24.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfaab56..347a18e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.24.0" + ".": "1.24.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dbdfcc..7a341e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.24.1 (2026-04-01) + +Full Changelog: [v1.24.0...v1.24.1](https://github.com/OneBusAway/python-sdk/compare/v1.24.0...v1.24.1) + +### Chores + +* **tests:** bump steady to v0.20.1 ([5fb2fbf](https://github.com/OneBusAway/python-sdk/commit/5fb2fbfcd95cd4db968c0c2e592c063e6b9a5135)) +* **tests:** bump steady to v0.20.2 ([007d6fd](https://github.com/OneBusAway/python-sdk/commit/007d6fdf2b3f40022fd4e40ec794defdd933115e)) + ## 1.24.0 (2026-03-29) Full Changelog: [v1.23.0...v1.24.0](https://github.com/OneBusAway/python-sdk/compare/v1.23.0...v1.24.0) diff --git a/pyproject.toml b/pyproject.toml index ba3113d..7076507 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.24.0" +version = "1.24.1" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index ae2ec79..f7b3f58 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.24.0" # x-release-please-version +__version__ = "1.24.1" # x-release-please-version