From 63b9ed5d689d6418243b8f67ecac5d9e211207fa Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Sat, 13 Jul 2024 19:30:17 +0000 Subject: [PATCH 001/376] feat(api): update via SDK Studio --- .github/workflows/ci.yml | 1 + .stats.yml | 4 +- api.md | 12 + requirements-dev.lock | 2 +- src/onebusaway/_base_client.py | 22 +- src/onebusaway/_client.py | 18 +- src/onebusaway/_models.py | 8 + src/onebusaway/resources/__init__.py | 14 + .../resources/agencies_with_coverage.py | 4 +- src/onebusaway/resources/agency.py | 8 +- .../resources/arrival_and_departure.py | 12 +- src/onebusaway/resources/config.py | 4 +- src/onebusaway/resources/current_time.py | 4 +- src/onebusaway/resources/route.py | 8 +- .../resources/stops_for_location.py | 4 +- src/onebusaway/resources/stops_for_route.py | 8 +- src/onebusaway/resources/trip.py | 8 +- src/onebusaway/resources/trip_details.py | 208 ++++++++++++ .../resources/trips_for_location.py | 4 +- src/onebusaway/types/__init__.py | 2 + src/onebusaway/types/shared/references.py | 17 +- .../types/trip_detail_retrieve_params.py | 35 ++ .../types/trip_detail_retrieve_response.py | 188 +++++++++++ tests/api_resources/test_agency.py | 12 +- .../test_arrival_and_departure.py | 64 ++-- tests/api_resources/test_route.py | 12 +- .../api_resources/test_stops_for_location.py | 16 +- tests/api_resources/test_stops_for_route.py | 24 +- tests/api_resources/test_trip.py | 12 +- tests/api_resources/test_trip_details.py | 122 +++++++ tests/test_client.py | 298 +++++++++--------- 31 files changed, 874 insertions(+), 281 deletions(-) create mode 100644 src/onebusaway/resources/trip_details.py create mode 100644 src/onebusaway/types/trip_detail_retrieve_params.py create mode 100644 src/onebusaway/types/trip_detail_retrieve_response.py create mode 100644 tests/api_resources/test_trip_details.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 257f056..4029396 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: pull_request: branches: - main + - next jobs: lint: diff --git a/.stats.yml b/.stats.yml index f3cb114..f78fb11 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-c1ea5e90257369e139272db8e69752724a4c2ba2a4fc1a2df99b1f744fedd05f.yml +configured_endpoints: 12 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-d7feb31fedeae9f0af2581bf85d95d374eb2eee635e6823975bc4f419bd8e492.yml diff --git a/api.md b/api.md index 959f82e..5ad83b7 100644 --- a/api.md +++ b/api.md @@ -124,3 +124,15 @@ from onebusaway.types import TripsForLocationRetrieveResponse Methods: - client.trips_for_location.retrieve(\*\*params) -> TripsForLocationRetrieveResponse + +# TripDetails + +Types: + +```python +from onebusaway.types import TripDetailRetrieveResponse +``` + +Methods: + +- client.trip_details.retrieve(trip_id, \*\*params) -> TripDetailRetrieveResponse diff --git a/requirements-dev.lock b/requirements-dev.lock index 547a783..7beb2f6 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.7.1 +mypy==1.10.1 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 7753691..a1271cb 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -955,6 +955,11 @@ def _request( 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) self._prepare_options(options) @@ -979,7 +984,7 @@ def _request( if retries > 0: return self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -994,7 +999,7 @@ def _request( if retries > 0: return self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1022,7 +1027,7 @@ def _request( if retries > 0 and self._should_retry(err.response): err.response.close() return self._retry_request( - options, + input_options, cast_to, retries, err.response.headers, @@ -1518,6 +1523,11 @@ async def _request( # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + # 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) await self._prepare_options(options) @@ -1540,7 +1550,7 @@ async def _request( if retries > 0: return await self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1555,7 +1565,7 @@ async def _request( if retries > 0: return await self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1578,7 +1588,7 @@ async def _request( if retries > 0 and self._should_retry(err.response): await err.response.aclose() return await self._retry_request( - options, + input_options, cast_to, retries, err.response.headers, diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index bfb3263..562d0e7 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -56,6 +56,7 @@ class OnebusawaySDK(SyncAPIClient): arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource trips_for_location: resources.TripsForLocationResource + trip_details: resources.TripDetailsResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -123,6 +124,7 @@ def __init__( 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.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -132,9 +134,8 @@ def qs(self) -> Querystring: return Querystring(array_format="repeat") @property - @override - def auth_headers(self) -> dict[str, str]: - return {} + def auth_headers(self) -> httpx.Auth: + raise NotImplementedError("This auth method has not been implemented yet.") @property @override @@ -250,6 +251,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource trips_for_location: resources.AsyncTripsForLocationResource + trip_details: resources.AsyncTripDetailsResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -317,6 +319,7 @@ def __init__( 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.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -326,9 +329,8 @@ def qs(self) -> Querystring: return Querystring(array_format="repeat") @property - @override - def auth_headers(self) -> dict[str, str]: - return {} + def auth_headers(self) -> httpx.Auth: + raise NotImplementedError("This auth method has not been implemented yet.") @property @override @@ -447,6 +449,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) class AsyncOnebusawaySDKWithRawResponse: @@ -465,6 +468,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.trip = resources.AsyncTripResourceWithRawResponse(client.trip) self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) + self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details) class OnebusawaySDKWithStreamedResponse: @@ -483,6 +487,7 @@ def __init__(self, client: OnebusawaySDK) -> None: ) self.trip = resources.TripResourceWithStreamingResponse(client.trip) self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) + self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details) class AsyncOnebusawaySDKWithStreamedResponse: @@ -505,6 +510,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.trips_for_location = resources.AsyncTripsForLocationResourceWithStreamingResponse( client.trips_for_location ) + self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) Client = OnebusawaySDK diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 5d95bb4..eb7ce3b 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -643,6 +643,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T: return cast(_T, _validate_non_model_type(type_=type_, value=value)) +def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: + """Add a pydantic config for the given type. + + Note: this is a no-op on Pydantic v1. + """ + setattr(typ, "__pydantic_config__", config) # noqa: B010 + + # our use of subclasssing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 8da65fe..528774f 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -40,6 +40,14 @@ CurrentTimeResourceWithStreamingResponse, AsyncCurrentTimeResourceWithStreamingResponse, ) +from .trip_details import ( + TripDetailsResource, + AsyncTripDetailsResource, + TripDetailsResourceWithRawResponse, + AsyncTripDetailsResourceWithRawResponse, + TripDetailsResourceWithStreamingResponse, + AsyncTripDetailsResourceWithStreamingResponse, +) from .stops_for_route import ( StopsForRouteResource, AsyncStopsForRouteResource, @@ -142,4 +150,10 @@ "AsyncTripsForLocationResourceWithRawResponse", "TripsForLocationResourceWithStreamingResponse", "AsyncTripsForLocationResourceWithStreamingResponse", + "TripDetailsResource", + "AsyncTripDetailsResource", + "TripDetailsResourceWithRawResponse", + "AsyncTripDetailsResourceWithRawResponse", + "TripDetailsResourceWithStreamingResponse", + "AsyncTripDetailsResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index 4fdc02b..60fa85e 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.agencies_with_coverage_retrieve_response import AgenciesWithCoverageRetrieveResponse __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index d456632..891cd4e 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.agency_retrieve_response import AgencyRetrieveResponse __all__ = ["AgencyResource", "AsyncAgencyResource"] @@ -56,7 +54,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", + f"/api/where/agency/agencyID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +97,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", + f"/api/where/agency/agencyID.json", 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 56a582b..cab33b8 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -21,9 +21,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +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 @@ -70,7 +68,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", + f"/api/where/arrival-and-departure-for-stop/stopID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -125,7 +123,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", + f"/api/where/arrivals-and-departures-for-stop/stopID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -184,7 +182,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", + f"/api/where/arrival-and-departure-for-stop/stopID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +237,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", + f"/api/where/arrivals-and-departures-for-stop/stopID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 9f36569..983c10e 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +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 25ddce3..70f504e 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.current_time_retrieve_response import CurrentTimeRetrieveResponse __all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 515d6fd..a91762c 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.route_retrieve_response import RouteRetrieveResponse __all__ = ["RouteResource", "AsyncRouteResource"] @@ -56,7 +54,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", + f"/api/where/route/routeID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +97,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", + f"/api/where/route/routeID.json", 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_location.py b/src/onebusaway/resources/stops_for_location.py index fd61842..c7c654f 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -18,9 +18,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.stops_for_location_retrieve_response import StopsForLocationRetrieveResponse __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 34d825c..1dc9ca7 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -18,9 +18,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.stops_for_route_list_response import StopsForRouteListResponse __all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] @@ -67,7 +65,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", + f"/api/where/stops-for-route/routeID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -126,7 +124,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", + f"/api/where/stops-for-route/routeID.json", 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 936760c..02f13f6 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -13,9 +13,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.trip_retrieve_response import TripRetrieveResponse __all__ = ["TripResource", "AsyncTripResource"] @@ -56,7 +54,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", + f"/api/where/trip/tripID.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +97,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", + f"/api/where/trip/tripID.json", 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 new file mode 100644 index 0000000..56c983e --- /dev/null +++ b/src/onebusaway/resources/trip_details.py @@ -0,0 +1,208 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +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"] + + +class TripDetailsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TripDetailsResourceWithRawResponse: + return TripDetailsResourceWithRawResponse(self) + + @cached_property + 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: + """ + Retrieve Trip Details + + Args: + include_schedule: Whether to include the full schedule element in the tripDetails section + (defaults to true). + + include_status: Whether to include the full status element in the tripDetails section (defaults + to true). + + include_trip: Whether to include the full trip element in the references section (defaults to + true). + + service_date: Service date for the trip as Unix time in milliseconds (optional). + + time: Time parameter to query the system at a specific time (optional). + + 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/trip-details/tripID.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, + ), + ), + cast_to=TripDetailRetrieveResponse, + ) + + +class AsyncTripDetailsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: + return AsyncTripDetailsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTripDetailsResourceWithStreamingResponse: + 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: + """ + Retrieve Trip Details + + Args: + include_schedule: Whether to include the full schedule element in the tripDetails section + (defaults to true). + + include_status: Whether to include the full status element in the tripDetails section (defaults + to true). + + include_trip: Whether to include the full trip element in the references section (defaults to + true). + + service_date: Service date for the trip as Unix time in milliseconds (optional). + + time: Time parameter to query the system at a specific time (optional). + + 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/trip-details/tripID.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, + ), + ), + cast_to=TripDetailRetrieveResponse, + ) + + +class TripDetailsResourceWithRawResponse: + def __init__(self, trip_details: TripDetailsResource) -> None: + self._trip_details = trip_details + + self.retrieve = to_raw_response_wrapper( + trip_details.retrieve, + ) + + +class AsyncTripDetailsResourceWithRawResponse: + def __init__(self, trip_details: AsyncTripDetailsResource) -> None: + self._trip_details = trip_details + + self.retrieve = async_to_raw_response_wrapper( + trip_details.retrieve, + ) + + +class TripDetailsResourceWithStreamingResponse: + def __init__(self, trip_details: TripDetailsResource) -> None: + self._trip_details = trip_details + + self.retrieve = to_streamed_response_wrapper( + 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, + ) diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index b4d5775..947283d 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -18,9 +18,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.trips_for_location_retrieve_response import TripsForLocationRetrieveResponse __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 66fc2de..1e53f4a 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -8,7 +8,9 @@ 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 +from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams 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 .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 49d6281..827d72a 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -22,6 +22,7 @@ "SituationSummary", "SituationURL", "Stop", + "StopTime", "Trip", ] @@ -217,6 +218,20 @@ class Stop(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) +class StopTime(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 Trip(BaseModel): id: str @@ -250,6 +265,6 @@ class References(BaseModel): stops: Optional[List[Stop]] = None - stop_times: Optional[List[object]] = FieldInfo(alias="stopTimes", default=None) + stop_times: Optional[List[StopTime]] = FieldInfo(alias="stopTimes", default=None) trips: Optional[List[Trip]] = None diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py new file mode 100644 index 0000000..a8529bf --- /dev/null +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -0,0 +1,35 @@ +# 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__ = ["TripDetailRetrieveParams"] + + +class TripDetailRetrieveParams(TypedDict, total=False): + include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] + """ + Whether to include the full schedule element in the tripDetails section + (defaults to true). + """ + + include_status: Annotated[bool, PropertyInfo(alias="includeStatus")] + """ + Whether to include the full status element in the tripDetails section (defaults + to true). + """ + + include_trip: Annotated[bool, PropertyInfo(alias="includeTrip")] + """ + Whether to include the full trip element in the references section (defaults to + true). + """ + + service_date: Annotated[int, PropertyInfo(alias="serviceDate")] + """Service date for the trip as Unix time in milliseconds (optional).""" + + time: int + """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 new file mode 100644 index 0000000..e88b30c --- /dev/null +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -0,0 +1,188 @@ +# 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__ = [ + "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) + + 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 TripDetailRetrieveResponseDataEntrySchedule(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[TripDetailRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(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 TripDetailRetrieveResponseDataEntryStatusPosition(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 TripDetailRetrieveResponseDataEntryStatus(BaseModel): + active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + """ID of the closest stop to the current location of the transit vehicle.""" + + 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 + ) + """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.""" + + 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.""" + + 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). + """ + + 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.""" + + +class TripDetailRetrieveResponseDataEntry(BaseModel): + frequency: Optional[str] = None + + schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None + + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + + +class TripDetailRetrieveResponseData(BaseModel): + entry: Optional[TripDetailRetrieveResponseDataEntry] = None + + references: Optional[References] = None + + +class TripDetailRetrieveResponse(ResponseWrapper): + data: Optional[TripDetailRetrieveResponseData] = None diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index 8fb1b49..05b83a8 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -20,14 +20,14 @@ class TestAgency: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: agency = client.agency.retrieve( - "string", + "agencyID", ) assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: response = client.agency.with_raw_response.retrieve( - "string", + "agencyID", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.agency.with_streaming_response.retrieve( - "string", + "agencyID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,14 +62,14 @@ class TestAsyncAgency: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: agency = await async_client.agency.retrieve( - "string", + "agencyID", ) 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( - "string", + "agencyID", ) assert response.is_closed is True @@ -80,7 +80,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.agency.with_streaming_response.retrieve( - "string", + "agencyID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index 3a9c01e..0ba8109 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -24,30 +24,30 @@ class TestArrivalAndDeparture: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", stop_sequence=0, time=0, - vehicle_id="string", + vehicle_id="vehicleId", ) 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( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) assert response.is_closed is True @@ -58,9 +58,9 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.arrival_and_departure.with_streaming_response.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -74,22 +74,22 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: 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="string", + trip_id="tripId", ) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.list( - "string", + stop_id="1_75403", ) assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.list( - "string", + stop_id="1_75403", minutes_after=0, minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -99,7 +99,7 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: response = client.arrival_and_departure.with_raw_response.list( - "string", + stop_id="1_75403", ) assert response.is_closed is True @@ -110,7 +110,7 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.arrival_and_departure.with_streaming_response.list( - "string", + stop_id="1_75403", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -124,7 +124,7 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: 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="", ) @@ -134,30 +134,30 @@ class TestAsyncArrivalAndDeparture: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", stop_sequence=0, time=0, - vehicle_id="string", + vehicle_id="vehicleId", ) 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( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) assert response.is_closed is True @@ -168,9 +168,9 @@ 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.arrival_and_departure.with_streaming_response.retrieve( - "string", + stop_id="1_75403", service_date=0, - trip_id="string", + trip_id="tripId", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -184,22 +184,22 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD 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="string", + trip_id="tripId", ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.list( - "string", + stop_id="1_75403", ) assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.list( - "string", + stop_id="1_75403", minutes_after=0, minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -209,7 +209,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: response = await async_client.arrival_and_departure.with_raw_response.list( - "string", + stop_id="1_75403", ) assert response.is_closed is True @@ -220,7 +220,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.arrival_and_departure.with_streaming_response.list( - "string", + stop_id="1_75403", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -234,5 +234,5 @@ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) - 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="", ) diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index 1d8a0df..8b773cf 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -20,14 +20,14 @@ class TestRoute: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: route = client.route.retrieve( - "string", + "routeID", ) assert_matches_type(RouteRetrieveResponse, route, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: response = client.route.with_raw_response.retrieve( - "string", + "routeID", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.route.with_streaming_response.retrieve( - "string", + "routeID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,14 +62,14 @@ class TestAsyncRoute: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: route = await async_client.route.retrieve( - "string", + "routeID", ) 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( - "string", + "routeID", ) assert response.is_closed is True @@ -80,7 +80,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.route.with_streaming_response.retrieve( - "string", + "routeID", ) 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_location.py b/tests/api_resources/test_stops_for_location.py index a2da9d4..6613263 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -20,14 +20,14 @@ class TestStopsForLocation: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: stops_for_location = client.stops_for_location.retrieve( - key="string", + key="key", ) 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="string", + key="key", lat=0, lon=0, ) @@ -36,7 +36,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="string", + key="key", ) assert response.is_closed is True @@ -47,7 +47,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="string", + key="key", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,14 +64,14 @@ class TestAsyncStopsForLocation: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_location = await async_client.stops_for_location.retrieve( - key="string", + key="key", ) 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="string", + key="key", lat=0, lon=0, ) @@ -80,7 +80,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="string", + key="key", ) assert response.is_closed is True @@ -91,7 +91,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="string", + key="key", ) 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 index 972c880..e062f7d 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -20,23 +20,23 @@ class TestStopsForRoute: @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_route = client.stops_for_route.list( - "string", + route_id="routeID", ) assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: stops_for_route = client.stops_for_route.list( - "string", + route_id="routeID", include_polylines=True, - time="string", + time="time", ) 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( - "string", + route_id="routeID", ) assert response.is_closed is True @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_route.with_streaming_response.list( - "string", + route_id="routeID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,7 +61,7 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: 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="", ) @@ -71,23 +71,23 @@ class TestAsyncStopsForRoute: @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_route = await async_client.stops_for_route.list( - "string", + route_id="routeID", ) assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_route = await async_client.stops_for_route.list( - "string", + route_id="routeID", include_polylines=True, - time="string", + time="time", ) 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( - "string", + route_id="routeID", ) assert response.is_closed is True @@ -98,7 +98,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.stops_for_route.with_streaming_response.list( - "string", + route_id="routeID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,5 +112,5 @@ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) - 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="", ) diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index aca3581..ef2bd7f 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -20,14 +20,14 @@ class TestTrip: @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip = client.trip.retrieve( - "string", + "tripID", ) assert_matches_type(TripRetrieveResponse, trip, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: response = client.trip.with_raw_response.retrieve( - "string", + "tripID", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip.with_streaming_response.retrieve( - "string", + "tripID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,14 +62,14 @@ class TestAsyncTrip: @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip = await async_client.trip.retrieve( - "string", + "tripID", ) 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( - "string", + "tripID", ) assert response.is_closed is True @@ -80,7 +80,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.trip.with_streaming_response.retrieve( - "string", + "tripID", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py new file mode 100644 index 0000000..82d00d9 --- /dev/null +++ b/tests/api_resources/test_trip_details.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 import TripDetailRetrieveResponse + +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 + 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"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + trip_detail = client.trip_details.retrieve( + trip_id="tripID", + include_schedule=True, + include_status=True, + include_trip=True, + service_date=0, + time=0, + ) + 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" + trip_detail = response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trip_detail = response.parse() + 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"]) + + @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"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trip_detail = await async_client.trip_details.retrieve( + trip_id="tripID", + include_schedule=True, + include_status=True, + include_trip=True, + service_date=0, + time=0, + ) + 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" + trip_detail = await response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trip_detail = await response.parse() + 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="", + ) diff --git a/tests/test_client.py b/tests/test_client.py index a099efe..1eebb8a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,13 +2,12 @@ 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 @@ -157,7 +156,7 @@ def test_copy_default_query(self) -> None: # completely overrides already set values copied = client.copy(set_default_query={}) - assert _get_params(copied) == {"key": api_key} + assert _get_params(copied) == {} copied = client.copy(set_default_query={"bar": "Robert"}) assert _get_params(copied)["bar"] == "Robert" @@ -167,7 +166,7 @@ def test_copy_default_query(self) -> None: # 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"}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method @@ -185,67 +184,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")) @@ -335,7 +334,7 @@ def test_default_query_option(self) -> None: ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) url = httpx.URL(request.url) - assert dict(url.params) == {"query_param": "bar", "key": api_key} + assert dict(url.params) == {"query_param": "bar"} request = client._build_request( FinalRequestOptions( @@ -345,7 +344,7 @@ def test_default_query_option(self) -> None: ) ) 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": "overriden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -414,7 +413,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"my_query_param": "Foo", "key": api_key} + assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged request = self.client._build_request( @@ -428,7 +427,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"} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -442,7 +441,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {"foo": "2"} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -568,8 +567,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}" - assert request.url == expected_url + assert request.url == "http://localhost:5000/custom/path/foo" @pytest.mark.parametrize( "client", @@ -594,8 +592,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}" - assert request.url == expected_url + assert request.url == "http://localhost:5000/custom/path/foo" @pytest.mark.parametrize( "client", @@ -620,8 +617,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}" - assert request.url == expected_url + assert request.url == "https://myapi.com/foo" def test_copied_client_does_not_close_http(self) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -842,7 +838,7 @@ def test_copy_default_query(self) -> None: # completely overrides already set values copied = client.copy(set_default_query={}) - assert _get_params(copied) == {"key": api_key} + assert _get_params(copied) == {} copied = client.copy(set_default_query={"bar": "Robert"}) assert _get_params(copied)["bar"] == "Robert" @@ -870,67 +866,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")) @@ -1020,18 +1016,17 @@ def test_default_query_option(self) -> None: ) 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} + assert dict(url.params) == {"query_param": "bar"} request = client._build_request( FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden", "key": api_key}, + params={"foo": "baz", "query_param": "overriden"}, ) ) 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": "overriden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1100,7 +1095,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"my_query_param": "Foo", "key": api_key} + assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged request = self.client._build_request( @@ -1114,7 +1109,8 @@ 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"} + # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( FinalRequestOptions( @@ -1127,7 +1123,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {"foo": "2"} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1253,8 +1249,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}" - assert request.url == excepted_url + assert request.url == "http://localhost:5000/custom/path/foo" @pytest.mark.parametrize( "client", @@ -1279,9 +1274,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: json_data={"foo": "bar"}, ), ) - - expected_url = f"http://localhost:5000/custom/path/foo?key={client.api_key}" - assert request.url == expected_url + assert request.url == "http://localhost:5000/custom/path/foo" @pytest.mark.parametrize( "client", @@ -1306,8 +1299,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}" - assert request.url == expected_url + assert request.url == "https://myapi.com/foo" 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) From c839dda2782fddd3d951b1cf58a6b7049acbd53d Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Sat, 13 Jul 2024 20:39:13 +0000 Subject: [PATCH 002/376] chore: update SDK settings --- README.md | 4 ++-- pyproject.toml | 2 +- requirements-dev.lock | 12 ++++++------ requirements.lock | 12 ++++++------ src/onebusaway/_base_client.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 7cdfb8d..d6d3a71 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://img.shields.io/pypi/v/onebusaway-sdk.svg)](https://pypi.org/project/onebusaway-sdk/) The Onebusaway SDK Python library provides convenient access to the Onebusaway SDK REST API from any Python 3.7+ application. The library includes type definitions for all request params and response fields, @@ -20,7 +20,7 @@ pip install git+ssh://git@github.com/stainless-sdks/open-transit-python.git ``` > [!NOTE] -> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway` +> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway-sdk` ## Usage diff --git a/pyproject.toml b/pyproject.toml index 3c29849..78820b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "onebusaway" +name = "onebusaway-sdk" version = "0.0.1-alpha.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] diff --git a/requirements-dev.lock b/requirements-dev.lock index 7beb2f6..90e2390 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -13,7 +13,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via onebusaway-sdk argcomplete==3.1.2 # via nox attrs==23.1.0 @@ -27,7 +27,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via onebusaway + # via onebusaway-sdk exceptiongroup==1.1.3 # via anyio filelock==3.12.4 @@ -37,7 +37,7 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via onebusaway + # via onebusaway-sdk # via respx idna==3.4 # via anyio @@ -65,7 +65,7 @@ pluggy==1.3.0 py==1.11.0 # via pytest pydantic==2.7.1 - # via onebusaway + # via onebusaway-sdk pydantic-core==2.18.2 # via pydantic pygments==2.18.0 @@ -88,7 +88,7 @@ six==1.16.0 sniffio==1.3.0 # via anyio # via httpx - # via onebusaway + # via onebusaway-sdk time-machine==2.9.0 tomli==2.0.1 # via mypy @@ -96,7 +96,7 @@ tomli==2.0.1 typing-extensions==4.8.0 # via anyio # via mypy - # via onebusaway + # via onebusaway-sdk # via pydantic # via pydantic-core virtualenv==20.24.5 diff --git a/requirements.lock b/requirements.lock index b7ce65e..de3be5d 100644 --- a/requirements.lock +++ b/requirements.lock @@ -13,12 +13,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via onebusaway-sdk certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via onebusaway + # via onebusaway-sdk exceptiongroup==1.1.3 # via anyio h11==0.14.0 @@ -26,20 +26,20 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via onebusaway + # via onebusaway-sdk idna==3.4 # via anyio # via httpx pydantic==2.7.1 - # via onebusaway + # via onebusaway-sdk pydantic-core==2.18.2 # via pydantic sniffio==1.3.0 # via anyio # via httpx - # via onebusaway + # via onebusaway-sdk typing-extensions==4.8.0 # via anyio - # via onebusaway + # via onebusaway-sdk # via pydantic # via pydantic-core diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index a1271cb..7912e83 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -363,7 +363,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `onebusaway.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `onebusaway-sdk.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: From ab7217fb63c8a7dcfc30cd0f392cb729a68bec4d Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Sun, 14 Jul 2024 19:06:01 +0000 Subject: [PATCH 003/376] chore: update SDK settings --- README.md | 4 ++-- pyproject.toml | 2 +- requirements-dev.lock | 12 ++++++------ requirements.lock | 12 ++++++------ src/onebusaway/_base_client.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d6d3a71..7cdfb8d 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-sdk.svg)](https://pypi.org/project/onebusaway-sdk/) +[![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+ application. The library includes type definitions for all request params and response fields, @@ -20,7 +20,7 @@ pip install git+ssh://git@github.com/stainless-sdks/open-transit-python.git ``` > [!NOTE] -> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway-sdk` +> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway` ## Usage diff --git a/pyproject.toml b/pyproject.toml index 78820b8..3c29849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "onebusaway-sdk" +name = "onebusaway" version = "0.0.1-alpha.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] diff --git a/requirements-dev.lock b/requirements-dev.lock index 90e2390..7beb2f6 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -13,7 +13,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway-sdk + # via onebusaway argcomplete==3.1.2 # via nox attrs==23.1.0 @@ -27,7 +27,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via onebusaway-sdk + # via onebusaway exceptiongroup==1.1.3 # via anyio filelock==3.12.4 @@ -37,7 +37,7 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via onebusaway-sdk + # via onebusaway # via respx idna==3.4 # via anyio @@ -65,7 +65,7 @@ pluggy==1.3.0 py==1.11.0 # via pytest pydantic==2.7.1 - # via onebusaway-sdk + # via onebusaway pydantic-core==2.18.2 # via pydantic pygments==2.18.0 @@ -88,7 +88,7 @@ six==1.16.0 sniffio==1.3.0 # via anyio # via httpx - # via onebusaway-sdk + # via onebusaway time-machine==2.9.0 tomli==2.0.1 # via mypy @@ -96,7 +96,7 @@ tomli==2.0.1 typing-extensions==4.8.0 # via anyio # via mypy - # via onebusaway-sdk + # via onebusaway # via pydantic # via pydantic-core virtualenv==20.24.5 diff --git a/requirements.lock b/requirements.lock index de3be5d..b7ce65e 100644 --- a/requirements.lock +++ b/requirements.lock @@ -13,12 +13,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway-sdk + # via onebusaway certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via onebusaway-sdk + # via onebusaway exceptiongroup==1.1.3 # via anyio h11==0.14.0 @@ -26,20 +26,20 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via onebusaway-sdk + # via onebusaway idna==3.4 # via anyio # via httpx pydantic==2.7.1 - # via onebusaway-sdk + # via onebusaway pydantic-core==2.18.2 # via pydantic sniffio==1.3.0 # via anyio # via httpx - # via onebusaway-sdk + # via onebusaway typing-extensions==4.8.0 # via anyio - # via onebusaway-sdk + # via onebusaway # via pydantic # via pydantic-core diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 7912e83..a1271cb 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -363,7 +363,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `onebusaway-sdk.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `onebusaway.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: From 701fa8655918b0009f7e322cda893980c995d130 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 14 Jul 2024 21:46:56 +0000 Subject: [PATCH 004/376] feat(api): update via SDK Studio (#1) --- .github/workflows/publish-pypi.yml | 31 +++++++++++++ .github/workflows/release-doctor.yml | 19 ++++++++ .release-please-manifest.json | 3 ++ CONTRIBUTING.md | 4 +- README.md | 13 +++--- bin/check-release-environment | 32 ++++++++++++++ pyproject.toml | 6 +-- release-please-config.json | 66 ++++++++++++++++++++++++++++ src/onebusaway/_version.py | 2 +- 9 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish-pypi.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .release-please-manifest.json create mode 100644 bin/check-release-environment create mode 100644 release-please-config.json diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 0000000..3e178a6 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to PyPI in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/OneBusAway/python-sdk/actions/workflows/publish-pypi.yml +name: Publish PyPI +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + 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.35.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Publish to PyPI + run: | + bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.ONEBUSAWAY_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..8ed1bc4 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,19 @@ +name: Release Doctor +on: + pull_request: + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + 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: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.ONEBUSAWAY_SDK_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..c476280 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1-alpha.0" +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5454c2a..2d89975 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,7 +59,7 @@ 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/stainless-sdks/open-transit-python.git +pip install git+ssh://git@github.com/OneBusAway/python-sdk.git ``` Alternatively, you can build from source and install the wheel file: @@ -117,7 +117,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/open-transit-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/OneBusAway/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 7cdfb8d..7b8dfb1 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,10 @@ The REST API documentation can be found [on developer.onebusaway.org](https://de ## Installation ```sh -# install from this staging repo -pip install git+ssh://git@github.com/stainless-sdks/open-transit-python.git +# install from PyPI +pip install --pre onebusaway ``` -> [!NOTE] -> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway` - ## Usage The full API of this library can be found in [api.md](api.md). @@ -204,9 +201,9 @@ current_time = response.parse() # get the object that `current_time.retrieve()` print(current_time) ``` -These methods return an [`APIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/onebusaway/_response.py) object. +These methods return an [`APIResponse`](https://github.com/OneBusAway/python-sdk/tree/main/src/onebusaway/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/onebusaway/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/OneBusAway/python-sdk/tree/main/src/onebusaway/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -294,7 +291,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/open-transit-python/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/OneBusAway/python-sdk/issues) with questions, bugs, or suggestions. ## Requirements diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..bc4b301 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +warnings=() +errors=() + +if [ -z "${PYPI_TOKEN}" ]; then + warnings+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + +lenWarnings=${#warnings[@]} + +if [[ lenWarnings -gt 0 ]]; then + echo -e "Found the following warnings in the release environment:\n" + + for warning in "${warnings[@]}"; do + echo -e "- $warning\n" + done +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/pyproject.toml b/pyproject.toml index 3c29849..a8a85c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,8 @@ classifiers = [ [project.urls] -Homepage = "https://github.com/stainless-sdks/open-transit-python" -Repository = "https://github.com/stainless-sdks/open-transit-python" +Homepage = "https://github.com/OneBusAway/python-sdk" +Repository = "https://github.com/OneBusAway/python-sdk" @@ -124,7 +124,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/stainless-sdks/open-transit-python/tree/main/\g<2>)' +replacement = '[\1](https://github.com/OneBusAway/python-sdk/tree/main/\g<2>)' [tool.black] line-length = 120 diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..585927e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "python", + "extra-files": [ + "src/onebusaway/_version.py" + ] +} \ No newline at end of file diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index 4ff512e..a76c8cb 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.0.1-alpha.0" +__version__ = "0.0.1-alpha.0" # x-release-please-version From b6167f7a7eca9c5ac096bc1161700eceebb8d856 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 14 Jul 2024 21:48:51 +0000 Subject: [PATCH 005/376] chore(internal): version bump (#3) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c476280..ba6c348 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1-alpha.0" + ".": "0.1.0-alpha.1" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a8a85c0..78310a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.0.1-alpha.0" +version = "0.1.0-alpha.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 a76c8cb..4bb7461 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.0.1-alpha.0" # x-release-please-version +__version__ = "0.1.0-alpha.1" # x-release-please-version From dd8145a975dd03f3dda3374bd41bffeb61eb3bc0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:51:30 +0000 Subject: [PATCH 006/376] feat(api): OpenAPI spec update via Stainless API (#4) --- .github/workflows/release-doctor.yml | 2 + .stats.yml | 4 +- README.md | 8 +- api.md | 12 ++ src/onebusaway/_base_client.py | 12 +- src/onebusaway/_client.py | 8 + src/onebusaway/_compat.py | 6 +- src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/trip_for_vehicle.py | 200 ++++++++++++++++++ src/onebusaway/types/__init__.py | 2 + .../types/trip_for_vehicle_retrieve_params.py | 33 +++ .../trip_for_vehicle_retrieve_response.py | 188 ++++++++++++++++ tests/api_resources/test_trip_for_vehicle.py | 120 +++++++++++ 13 files changed, 597 insertions(+), 12 deletions(-) create mode 100644 src/onebusaway/resources/trip_for_vehicle.py create mode 100644 src/onebusaway/types/trip_for_vehicle_retrieve_params.py create mode 100644 src/onebusaway/types/trip_for_vehicle_retrieve_response.py create mode 100644 tests/api_resources/test_trip_for_vehicle.py diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 8ed1bc4..908ad72 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,6 +1,8 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: jobs: diff --git a/.stats.yml b/.stats.yml index f78fb11..74bfdc8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 12 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-d7feb31fedeae9f0af2581bf85d95d374eb2eee635e6823975bc4f419bd8e492.yml +configured_endpoints: 13 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml diff --git a/README.md b/README.md index 7b8dfb1..22f2108 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/). ## Documentation -The REST API documentation can be found [on developer.onebusaway.org](https://developer.onebusaway.org). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). The full API of this library can be found in [api.md](api.md). ## Installation @@ -277,6 +277,12 @@ client = OnebusawaySDK( ) ``` +You can also customize the client on a per-request basis by using `with_options()`: + +```python +client.with_options(http_client=DefaultHttpxClient(...)) +``` + ### Managing HTTP resources 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. diff --git a/api.md b/api.md index 5ad83b7..29c129c 100644 --- a/api.md +++ b/api.md @@ -136,3 +136,15 @@ from onebusaway.types import TripDetailRetrieveResponse Methods: - client.trip_details.retrieve(trip_id, \*\*params) -> TripDetailRetrieveResponse + +# TripForVehicle + +Types: + +```python +from onebusaway.types import TripForVehicleRetrieveResponse +``` + +Methods: + +- client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index a1271cb..d17404e 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -879,9 +879,9 @@ def __exit__( def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options def _prepare_request( self, @@ -961,7 +961,7 @@ def _request( input_options = model_copy(options) cast_to = self._maybe_override_cast_to(cast_to, options) - self._prepare_options(options) + options = self._prepare_options(options) retries = self._remaining_retries(remaining_retries, options) request = self._build_request(options) @@ -1442,9 +1442,9 @@ async def __aexit__( async def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options async def _prepare_request( self, @@ -1529,7 +1529,7 @@ async def _request( input_options = model_copy(options) cast_to = self._maybe_override_cast_to(cast_to, options) - await self._prepare_options(options) + options = await self._prepare_options(options) retries = self._remaining_retries(remaining_retries, options) request = self._build_request(options) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 562d0e7..f75c441 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -57,6 +57,7 @@ class OnebusawaySDK(SyncAPIClient): trip: resources.TripResource trips_for_location: resources.TripsForLocationResource trip_details: resources.TripDetailsResource + trip_for_vehicle: resources.TripForVehicleResource with_raw_response: OnebusawaySDKWithRawResponse with_streaming_response: OnebusawaySDKWithStreamedResponse @@ -125,6 +126,7 @@ def __init__( 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.with_raw_response = OnebusawaySDKWithRawResponse(self) self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self) @@ -252,6 +254,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trip: resources.AsyncTripResource trips_for_location: resources.AsyncTripsForLocationResource trip_details: resources.AsyncTripDetailsResource + trip_for_vehicle: resources.AsyncTripForVehicleResource with_raw_response: AsyncOnebusawaySDKWithRawResponse with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse @@ -320,6 +323,7 @@ def __init__( 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.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self) self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self) @@ -450,6 +454,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) class AsyncOnebusawaySDKWithRawResponse: @@ -469,6 +474,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: 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) class OnebusawaySDKWithStreamedResponse: @@ -488,6 +494,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) class AsyncOnebusawaySDKWithStreamedResponse: @@ -511,6 +518,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.trips_for_location ) self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) + self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) Client = OnebusawaySDK diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py index 74c7639..c919b5a 100644 --- a/src/onebusaway/_compat.py +++ b/src/onebusaway/_compat.py @@ -118,10 +118,10 @@ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: return model.__fields__ # type: ignore -def model_copy(model: _ModelT) -> _ModelT: +def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: if PYDANTIC_V2: - return model.model_copy() - return model.copy() # type: ignore + return model.model_copy(deep=deep) + return model.copy(deep=deep) # type: ignore def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 528774f..65b959b 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -56,6 +56,14 @@ StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse, ) +from .trip_for_vehicle import ( + TripForVehicleResource, + AsyncTripForVehicleResource, + TripForVehicleResourceWithRawResponse, + AsyncTripForVehicleResourceWithRawResponse, + TripForVehicleResourceWithStreamingResponse, + AsyncTripForVehicleResourceWithStreamingResponse, +) from .stops_for_location import ( StopsForLocationResource, AsyncStopsForLocationResource, @@ -156,4 +164,10 @@ "AsyncTripDetailsResourceWithRawResponse", "TripDetailsResourceWithStreamingResponse", "AsyncTripDetailsResourceWithStreamingResponse", + "TripForVehicleResource", + "AsyncTripForVehicleResource", + "TripForVehicleResourceWithRawResponse", + "AsyncTripForVehicleResourceWithRawResponse", + "TripForVehicleResourceWithStreamingResponse", + "AsyncTripForVehicleResourceWithStreamingResponse", ] diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py new file mode 100644 index 0000000..f0091cd --- /dev/null +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +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"] + + +class TripForVehicleResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: + return TripForVehicleResourceWithRawResponse(self) + + @cached_property + 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: + """ + Retrieve trip for a specific vehicle + + Args: + include_schedule: Determines whether full element is included in the + section. Defaults to false. + + include_status: Determines whether the full element is included in the + section. Defaults to true. + + include_trip: Determines whether full element is included in the + section. Defaults to false. + + time: Time parameter to query the system at a specific time (optional). + + 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 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", + 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: + return AsyncTripForVehicleResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingResponse: + 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: + """ + Retrieve trip for a specific vehicle + + Args: + include_schedule: Determines whether full element is included in the + section. Defaults to false. + + include_status: Determines whether the full element is included in the + section. Defaults to true. + + include_trip: Determines whether full element is included in the + section. Defaults to false. + + time: Time parameter to query the system at a specific time (optional). + + 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 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", + 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 + + self.retrieve = to_raw_response_wrapper( + trip_for_vehicle.retrieve, + ) + + +class AsyncTripForVehicleResourceWithRawResponse: + def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: + self._trip_for_vehicle = trip_for_vehicle + + self.retrieve = async_to_raw_response_wrapper( + trip_for_vehicle.retrieve, + ) + + +class TripForVehicleResourceWithStreamingResponse: + def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: + self._trip_for_vehicle = trip_for_vehicle + + self.retrieve = to_streamed_response_wrapper( + 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, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 1e53f4a..3ea05d3 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -12,8 +12,10 @@ 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 .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams 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 .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py new file mode 100644 index 0000000..3e8240c --- /dev/null +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -0,0 +1,33 @@ +# 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__ = ["TripForVehicleRetrieveParams"] + + +class TripForVehicleRetrieveParams(TypedDict, total=False): + include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] + """ + Determines whether full element is included in the + section. Defaults to false. + """ + + include_status: Annotated[bool, PropertyInfo(alias="includeStatus")] + """ + Determines whether the full element is included in the + section. Defaults to true. + """ + + include_trip: Annotated[bool, PropertyInfo(alias="includeTrip")] + """Determines whether full element is included in the + section. + + Defaults to false. + """ + + time: int + """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 new file mode 100644 index 0000000..fdebda9 --- /dev/null +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -0,0 +1,188 @@ +# 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__ = [ + "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) + + 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 TripForVehicleRetrieveResponseDataEntrySchedule(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[TripForVehicleRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(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 TripForVehicleRetrieveResponseDataEntryStatusPosition(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 TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): + active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + """ID of the closest stop to the current location of the transit vehicle.""" + + 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 + ) + """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.""" + + 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.""" + + 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). + """ + + 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.""" + + +class TripForVehicleRetrieveResponseDataEntry(BaseModel): + frequency: Optional[str] = None + + schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None + + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + + +class TripForVehicleRetrieveResponseData(BaseModel): + entry: Optional[TripForVehicleRetrieveResponseDataEntry] = None + + references: Optional[References] = None + + +class TripForVehicleRetrieveResponse(ResponseWrapper): + data: Optional[TripForVehicleRetrieveResponseData] = None diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py new file mode 100644 index 0000000..be96fa6 --- /dev/null +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -0,0 +1,120 @@ +# 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 TripForVehicleRetrieveResponse + +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 + 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"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: + trip_for_vehicle = client.trip_for_vehicle.retrieve( + vehicle_id="vehicleID", + include_schedule=True, + include_status=True, + include_trip=True, + time=0, + ) + 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" + trip_for_vehicle = response.parse() + 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: + assert not response.is_closed + 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 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"]) + + @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"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trip_for_vehicle = await async_client.trip_for_vehicle.retrieve( + vehicle_id="vehicleID", + include_schedule=True, + include_status=True, + include_trip=True, + time=0, + ) + 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" + trip_for_vehicle = await response.parse() + 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: + assert not response.is_closed + 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 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="", + ) From 251a0b84e6ef73679657b309e0e02350a8bf6d2a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:06:16 +0000 Subject: [PATCH 007/376] feat(api): OpenAPI spec update via Stainless API (#6) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/stop.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/stop_retrieve_response.py | 54 +++++++ tests/api_resources/test_stop.py | 98 ++++++++++++ 8 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/stop.py create mode 100644 src/onebusaway/types/stop_retrieve_response.py create mode 100644 tests/api_resources/test_stop.py diff --git a/.stats.yml b/.stats.yml index 74bfdc8..0ee6a7f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 13 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml +configured_endpoints: 14 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-3a44d3a64c0f613f81e7dd42644c2b2df90e8be20210428450149f771c7f13d8.yml diff --git a/api.md b/api.md index 29c129c..4d50a2d 100644 --- a/api.md +++ b/api.md @@ -76,6 +76,18 @@ Methods: - client.stops_for_route.list(route_id, \*\*params) -> StopsForRouteListResponse +# Stop + +Types: + +```python +from onebusaway.types import StopRetrieveResponse +``` + +Methods: + +- client.stop.retrieve(stop_id) -> StopRetrieveResponse + # Route Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index f75c441..e8ea4d1 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -52,6 +52,7 @@ class OnebusawaySDK(SyncAPIClient): current_time: resources.CurrentTimeResource stops_for_location: resources.StopsForLocationResource stops_for_route: resources.StopsForRouteResource + stop: resources.StopResource route: resources.RouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource @@ -121,6 +122,7 @@ def __init__( self.current_time = resources.CurrentTimeResource(self) self.stops_for_location = resources.StopsForLocationResource(self) self.stops_for_route = resources.StopsForRouteResource(self) + self.stop = resources.StopResource(self) self.route = resources.RouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) @@ -249,6 +251,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): current_time: resources.AsyncCurrentTimeResource stops_for_location: resources.AsyncStopsForLocationResource stops_for_route: resources.AsyncStopsForRouteResource + stop: resources.AsyncStopResource route: resources.AsyncRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource @@ -318,6 +321,7 @@ def __init__( self.current_time = resources.AsyncCurrentTimeResource(self) self.stops_for_location = resources.AsyncStopsForLocationResource(self) self.stops_for_route = resources.AsyncStopsForRouteResource(self) + self.stop = resources.AsyncStopResource(self) self.route = resources.AsyncRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) @@ -449,6 +453,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.stop = resources.StopResourceWithRawResponse(client.stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) @@ -467,6 +472,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.stop = resources.AsyncStopResourceWithRawResponse(client.stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure @@ -487,6 +493,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.stop = resources.StopResourceWithStreamingResponse(client.stop) self.route = resources.RouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure @@ -509,6 +516,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.stops_for_location ) self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.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 65b959b..9c3ef40 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,5 +1,13 @@ # 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, @@ -134,6 +142,12 @@ "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", + "StopResource", + "AsyncStopResource", + "StopResourceWithRawResponse", + "AsyncStopResourceWithRawResponse", + "StopResourceWithStreamingResponse", + "AsyncStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py new file mode 100644 index 0000000..e1939d1 --- /dev/null +++ b/src/onebusaway/resources/stop.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.stop_retrieve_response import StopRetrieveResponse + +__all__ = ["StopResource", "AsyncStopResource"] + + +class StopResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StopResourceWithRawResponse: + return StopResourceWithRawResponse(self) + + @cached_property + 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: + """ + Retrieve information for a specific stop identified by its unique 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 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/stopID.json", + 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: + return AsyncStopResourceWithRawResponse(self) + + @cached_property + 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: + """ + Retrieve information for a specific stop identified by its unique 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 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/stopID.json", + 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 + + self.retrieve = to_raw_response_wrapper( + stop.retrieve, + ) + + +class AsyncStopResourceWithRawResponse: + def __init__(self, stop: AsyncStopResource) -> None: + self._stop = stop + + self.retrieve = async_to_raw_response_wrapper( + stop.retrieve, + ) + + +class StopResourceWithStreamingResponse: + def __init__(self, stop: StopResource) -> None: + self._stop = stop + + self.retrieve = to_streamed_response_wrapper( + stop.retrieve, + ) + + +class AsyncStopResourceWithStreamingResponse: + def __init__(self, stop: AsyncStopResource) -> None: + self._stop = stop + + self.retrieve = async_to_streamed_response_wrapper( + stop.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 3ea05d3..7a04693 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -3,6 +3,7 @@ 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 .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py new file mode 100644 index 0000000..cfebd4f --- /dev/null +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -0,0 +1,54 @@ +# 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__ = [ + "StopRetrieveResponse", + "StopRetrieveResponseData", + "StopRetrieveResponseDataData", + "StopRetrieveResponseDataDataEntry", +] + + +class StopRetrieveResponseDataDataEntry(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 StopRetrieveResponseDataData(BaseModel): + entry: Optional[StopRetrieveResponseDataDataEntry] = None + + references: Optional[References] = None + + +class StopRetrieveResponseData(BaseModel): + data: Optional[StopRetrieveResponseDataData] = None + + +class StopRetrieveResponse(ResponseWrapper): + data: Optional[StopRetrieveResponseData] = None diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py new file mode 100644 index 0000000..9286176 --- /dev/null +++ b/tests/api_resources/test_stop.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 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 + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + stop = client.stop.retrieve( + "stopID", + ) + 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" + stop = response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stop = response.parse() + 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"]) + + @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"]) + + @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" + stop = await response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stop = await response.parse() + 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( + "", + ) From c688070122be3bcfdd71ad5f0c274c2e00727134 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:52:17 +0000 Subject: [PATCH 008/376] feat(api): OpenAPI spec update via Stainless API (#7) --- .stats.yml | 2 +- src/onebusaway/types/stop_retrieve_response.py | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0ee6a7f..859917b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 14 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-3a44d3a64c0f613f81e7dd42644c2b2df90e8be20210428450149f771c7f13d8.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-3cfabaee09407ed498a1483aeca8f63eeacb184750b4c22df4c14f2949f35ca5.yml diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index cfebd4f..abb6779 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -8,15 +8,10 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopRetrieveResponse", - "StopRetrieveResponseData", - "StopRetrieveResponseDataData", - "StopRetrieveResponseDataDataEntry", -] +__all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] -class StopRetrieveResponseDataDataEntry(BaseModel): +class StopRetrieveResponseDataEntry(BaseModel): id: str code: str @@ -40,15 +35,11 @@ class StopRetrieveResponseDataDataEntry(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) -class StopRetrieveResponseDataData(BaseModel): - entry: Optional[StopRetrieveResponseDataDataEntry] = None +class StopRetrieveResponseData(BaseModel): + entry: Optional[StopRetrieveResponseDataEntry] = None references: Optional[References] = None -class StopRetrieveResponseData(BaseModel): - data: Optional[StopRetrieveResponseDataData] = None - - class StopRetrieveResponse(ResponseWrapper): data: Optional[StopRetrieveResponseData] = None From dbf5ea5cf4ea7f365e2816189d265647bd02ba73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:17:05 +0000 Subject: [PATCH 009/376] feat(api): OpenAPI spec update via Stainless API (#8) --- .stats.yml | 4 +- api.md | 12 -- src/onebusaway/_client.py | 8 - src/onebusaway/resources/__init__.py | 14 -- src/onebusaway/resources/stop.py | 141 ------------------ src/onebusaway/types/__init__.py | 1 - .../types/stop_retrieve_response.py | 45 ------ tests/api_resources/test_stop.py | 98 ------------ 8 files changed, 2 insertions(+), 321 deletions(-) delete mode 100644 src/onebusaway/resources/stop.py delete mode 100644 src/onebusaway/types/stop_retrieve_response.py delete mode 100644 tests/api_resources/test_stop.py diff --git a/.stats.yml b/.stats.yml index 859917b..74bfdc8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 14 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-3cfabaee09407ed498a1483aeca8f63eeacb184750b4c22df4c14f2949f35ca5.yml +configured_endpoints: 13 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml diff --git a/api.md b/api.md index 4d50a2d..29c129c 100644 --- a/api.md +++ b/api.md @@ -76,18 +76,6 @@ Methods: - client.stops_for_route.list(route_id, \*\*params) -> StopsForRouteListResponse -# Stop - -Types: - -```python -from onebusaway.types import StopRetrieveResponse -``` - -Methods: - -- client.stop.retrieve(stop_id) -> StopRetrieveResponse - # Route Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e8ea4d1..f75c441 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -52,7 +52,6 @@ class OnebusawaySDK(SyncAPIClient): current_time: resources.CurrentTimeResource stops_for_location: resources.StopsForLocationResource stops_for_route: resources.StopsForRouteResource - stop: resources.StopResource route: resources.RouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource @@ -122,7 +121,6 @@ def __init__( self.current_time = resources.CurrentTimeResource(self) self.stops_for_location = resources.StopsForLocationResource(self) self.stops_for_route = resources.StopsForRouteResource(self) - self.stop = resources.StopResource(self) self.route = resources.RouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) @@ -251,7 +249,6 @@ class AsyncOnebusawaySDK(AsyncAPIClient): current_time: resources.AsyncCurrentTimeResource stops_for_location: resources.AsyncStopsForLocationResource stops_for_route: resources.AsyncStopsForRouteResource - stop: resources.AsyncStopResource route: resources.AsyncRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource @@ -321,7 +318,6 @@ def __init__( self.current_time = resources.AsyncCurrentTimeResource(self) self.stops_for_location = resources.AsyncStopsForLocationResource(self) self.stops_for_route = resources.AsyncStopsForRouteResource(self) - self.stop = resources.AsyncStopResource(self) self.route = resources.AsyncRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) @@ -453,7 +449,6 @@ 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.stop = resources.StopResourceWithRawResponse(client.stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) @@ -472,7 +467,6 @@ 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.stop = resources.AsyncStopResourceWithRawResponse(client.stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure @@ -493,7 +487,6 @@ 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.stop = resources.StopResourceWithStreamingResponse(client.stop) self.route = resources.RouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure @@ -516,7 +509,6 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.stops_for_location ) self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.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 9c3ef40..65b959b 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,13 +1,5 @@ # 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, @@ -142,12 +134,6 @@ "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", - "StopResource", - "AsyncStopResource", - "StopResourceWithRawResponse", - "AsyncStopResourceWithRawResponse", - "StopResourceWithStreamingResponse", - "AsyncStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py deleted file mode 100644 index e1939d1..0000000 --- a/src/onebusaway/resources/stop.py +++ /dev/null @@ -1,141 +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.stop_retrieve_response import StopRetrieveResponse - -__all__ = ["StopResource", "AsyncStopResource"] - - -class StopResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StopResourceWithRawResponse: - return StopResourceWithRawResponse(self) - - @cached_property - 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: - """ - Retrieve information for a specific stop identified by its unique 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 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/stopID.json", - 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: - return AsyncStopResourceWithRawResponse(self) - - @cached_property - 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: - """ - Retrieve information for a specific stop identified by its unique 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 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/stopID.json", - 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 - - self.retrieve = to_raw_response_wrapper( - stop.retrieve, - ) - - -class AsyncStopResourceWithRawResponse: - def __init__(self, stop: AsyncStopResource) -> None: - self._stop = stop - - self.retrieve = async_to_raw_response_wrapper( - stop.retrieve, - ) - - -class StopResourceWithStreamingResponse: - def __init__(self, stop: StopResource) -> None: - self._stop = stop - - self.retrieve = to_streamed_response_wrapper( - stop.retrieve, - ) - - -class AsyncStopResourceWithStreamingResponse: - def __init__(self, stop: AsyncStopResource) -> None: - self._stop = stop - - self.retrieve = async_to_streamed_response_wrapper( - stop.retrieve, - ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 7a04693..3ea05d3 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -3,7 +3,6 @@ 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 .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py deleted file mode 100644 index abb6779..0000000 --- a/src/onebusaway/types/stop_retrieve_response.py +++ /dev/null @@ -1,45 +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__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] - - -class StopRetrieveResponseDataEntry(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 StopRetrieveResponseData(BaseModel): - entry: Optional[StopRetrieveResponseDataEntry] = None - - references: Optional[References] = None - - -class StopRetrieveResponse(ResponseWrapper): - data: Optional[StopRetrieveResponseData] = None diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py deleted file mode 100644 index 9286176..0000000 --- a/tests/api_resources/test_stop.py +++ /dev/null @@ -1,98 +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 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 - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - stop = client.stop.retrieve( - "stopID", - ) - 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" - stop = response.parse() - 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: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stop = response.parse() - 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"]) - - @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"]) - - @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" - stop = await response.parse() - 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: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stop = await response.parse() - 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( - "", - ) From 50081fdb5216a4f9cd7274ba00cf1a7c00346ae6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:18:18 +0000 Subject: [PATCH 010/376] chore(internal): version bump (#9) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ba6c348..f14b480 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.1" + ".": "0.1.0-alpha.2" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 78310a4..96ab13a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.1" +version = "0.1.0-alpha.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 4bb7461..ad08670 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.1" # x-release-please-version +__version__ = "0.1.0-alpha.2" # x-release-please-version From a822d2a32d6467ef5db108249498a46ac3e02df6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 05:13:27 +0000 Subject: [PATCH 011/376] feat(api): OpenAPI spec update via Stainless API (#10) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/stop.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../types/stop_retrieve_response.py | 45 ++++++ tests/api_resources/test_stop.py | 98 ++++++++++++ 8 files changed, 321 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/stop.py create mode 100644 src/onebusaway/types/stop_retrieve_response.py create mode 100644 tests/api_resources/test_stop.py diff --git a/.stats.yml b/.stats.yml index 74bfdc8..9a1a83d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 13 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml +configured_endpoints: 14 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml diff --git a/api.md b/api.md index 29c129c..4d50a2d 100644 --- a/api.md +++ b/api.md @@ -76,6 +76,18 @@ Methods: - client.stops_for_route.list(route_id, \*\*params) -> StopsForRouteListResponse +# Stop + +Types: + +```python +from onebusaway.types import StopRetrieveResponse +``` + +Methods: + +- client.stop.retrieve(stop_id) -> StopRetrieveResponse + # Route Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index f75c441..e8ea4d1 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -52,6 +52,7 @@ class OnebusawaySDK(SyncAPIClient): current_time: resources.CurrentTimeResource stops_for_location: resources.StopsForLocationResource stops_for_route: resources.StopsForRouteResource + stop: resources.StopResource route: resources.RouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource @@ -121,6 +122,7 @@ def __init__( self.current_time = resources.CurrentTimeResource(self) self.stops_for_location = resources.StopsForLocationResource(self) self.stops_for_route = resources.StopsForRouteResource(self) + self.stop = resources.StopResource(self) self.route = resources.RouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) @@ -249,6 +251,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): current_time: resources.AsyncCurrentTimeResource stops_for_location: resources.AsyncStopsForLocationResource stops_for_route: resources.AsyncStopsForRouteResource + stop: resources.AsyncStopResource route: resources.AsyncRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource @@ -318,6 +321,7 @@ def __init__( self.current_time = resources.AsyncCurrentTimeResource(self) self.stops_for_location = resources.AsyncStopsForLocationResource(self) self.stops_for_route = resources.AsyncStopsForRouteResource(self) + self.stop = resources.AsyncStopResource(self) self.route = resources.AsyncRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) @@ -449,6 +453,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.stop = resources.StopResourceWithRawResponse(client.stop) self.route = resources.RouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) @@ -467,6 +472,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.stop = resources.AsyncStopResourceWithRawResponse(client.stop) self.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure @@ -487,6 +493,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.stop = resources.StopResourceWithStreamingResponse(client.stop) self.route = resources.RouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure @@ -509,6 +516,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.stops_for_location ) self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) + self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.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 65b959b..9c3ef40 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,5 +1,13 @@ # 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, @@ -134,6 +142,12 @@ "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", + "StopResource", + "AsyncStopResource", + "StopResourceWithRawResponse", + "AsyncStopResourceWithRawResponse", + "StopResourceWithStreamingResponse", + "AsyncStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py new file mode 100644 index 0000000..5f5a1d5 --- /dev/null +++ b/src/onebusaway/resources/stop.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.stop_retrieve_response import StopRetrieveResponse + +__all__ = ["StopResource", "AsyncStopResource"] + + +class StopResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StopResourceWithRawResponse: + return StopResourceWithRawResponse(self) + + @cached_property + 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: + """ + Get details of a specific stop + + 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 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/stopID.json", + 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: + return AsyncStopResourceWithRawResponse(self) + + @cached_property + 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: + """ + Get details of a specific stop + + 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 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/stopID.json", + 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 + + self.retrieve = to_raw_response_wrapper( + stop.retrieve, + ) + + +class AsyncStopResourceWithRawResponse: + def __init__(self, stop: AsyncStopResource) -> None: + self._stop = stop + + self.retrieve = async_to_raw_response_wrapper( + stop.retrieve, + ) + + +class StopResourceWithStreamingResponse: + def __init__(self, stop: StopResource) -> None: + self._stop = stop + + self.retrieve = to_streamed_response_wrapper( + stop.retrieve, + ) + + +class AsyncStopResourceWithStreamingResponse: + def __init__(self, stop: AsyncStopResource) -> None: + self._stop = stop + + self.retrieve = async_to_streamed_response_wrapper( + stop.retrieve, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 3ea05d3..7a04693 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -3,6 +3,7 @@ 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 .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py new file mode 100644 index 0000000..8d71183 --- /dev/null +++ b/src/onebusaway/types/stop_retrieve_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__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] + + +class StopRetrieveResponseDataEntry(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 StopRetrieveResponseData(BaseModel): + entry: StopRetrieveResponseDataEntry + + references: References + + +class StopRetrieveResponse(ResponseWrapper): + data: Optional[StopRetrieveResponseData] = None diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py new file mode 100644 index 0000000..9286176 --- /dev/null +++ b/tests/api_resources/test_stop.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 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 + def test_method_retrieve(self, client: OnebusawaySDK) -> None: + stop = client.stop.retrieve( + "stopID", + ) + 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" + stop = response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stop = response.parse() + 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"]) + + @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"]) + + @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" + stop = await response.parse() + 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: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stop = await response.parse() + 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( + "", + ) From 60bed9546fcce6c5692125c1eab1ecf5b4d74c39 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 05:13:56 +0000 Subject: [PATCH 012/376] chore(internal): refactor release doctor script (#12) --- bin/check-release-environment | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/bin/check-release-environment b/bin/check-release-environment index bc4b301..7e1bf0e 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -1,20 +1,9 @@ #!/usr/bin/env bash -warnings=() errors=() if [ -z "${PYPI_TOKEN}" ]; then - warnings+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") -fi - -lenWarnings=${#warnings[@]} - -if [[ lenWarnings -gt 0 ]]; then - echo -e "Found the following warnings in the release environment:\n" - - for warning in "${warnings[@]}"; do - echo -e "- $warning\n" - done + errors+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenErrors=${#errors[@]} From 6ecb8ae60c0aa11af20ec6ca65aa45a6517a1019 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 05:14:48 +0000 Subject: [PATCH 013/376] chore(tests): update prism version (#13) --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index fe89a1d..f586157 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=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.4 -- 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=@stoplight/prism-cli@~5.8 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" fi From 07942ab23cbb93b07328528cd830df3ae231ca05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 06:02:16 +0000 Subject: [PATCH 014/376] chore(internal): version bump (#14) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f14b480..aaf968a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0-alpha.3" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 96ab13a..6af69cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.2" +version = "0.1.0-alpha.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 ad08670..75bdff5 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.2" # x-release-please-version +__version__ = "0.1.0-alpha.3" # x-release-please-version From fa58fd067fa9267572a0b90803363f5b4fff8b87 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 06:32:51 +0000 Subject: [PATCH 015/376] feat(api): OpenAPI spec update via Stainless API (#15) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 10 ++ src/onebusaway/resources/__init__.py | 14 ++ .../resources/stop_ids_for_agency.py | 141 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../stop_ids_for_agency_list_response.py | 23 +++ .../api_resources/test_stop_ids_for_agency.py | 98 ++++++++++++ 8 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/stop_ids_for_agency.py create mode 100644 src/onebusaway/types/stop_ids_for_agency_list_response.py create mode 100644 tests/api_resources/test_stop_ids_for_agency.py diff --git a/.stats.yml b/.stats.yml index 9a1a83d..441e696 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 14 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml +configured_endpoints: 15 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.yml diff --git a/api.md b/api.md index 4d50a2d..759705b 100644 --- a/api.md +++ b/api.md @@ -88,6 +88,18 @@ Methods: - client.stop.retrieve(stop_id) -> StopRetrieveResponse +# StopIDsForAgency + +Types: + +```python +from onebusaway.types import StopIDsForAgencyListResponse +``` + +Methods: + +- client.stop_ids_for_agency.list(agency_id) -> StopIDsForAgencyListResponse + # Route Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e8ea4d1..08f81db 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -53,6 +53,7 @@ class OnebusawaySDK(SyncAPIClient): stops_for_location: resources.StopsForLocationResource stops_for_route: resources.StopsForRouteResource stop: resources.StopResource + stop_ids_for_agency: resources.StopIDsForAgencyResource route: resources.RouteResource arrival_and_departure: resources.ArrivalAndDepartureResource trip: resources.TripResource @@ -123,6 +124,7 @@ def __init__( self.stops_for_location = resources.StopsForLocationResource(self) self.stops_for_route = resources.StopsForRouteResource(self) self.stop = resources.StopResource(self) + self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self) self.route = resources.RouteResource(self) self.arrival_and_departure = resources.ArrivalAndDepartureResource(self) self.trip = resources.TripResource(self) @@ -252,6 +254,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): stops_for_location: resources.AsyncStopsForLocationResource stops_for_route: resources.AsyncStopsForRouteResource stop: resources.AsyncStopResource + stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource route: resources.AsyncRouteResource arrival_and_departure: resources.AsyncArrivalAndDepartureResource trip: resources.AsyncTripResource @@ -322,6 +325,7 @@ def __init__( self.stops_for_location = resources.AsyncStopsForLocationResource(self) self.stops_for_route = resources.AsyncStopsForRouteResource(self) self.stop = resources.AsyncStopResource(self) + self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self) self.route = resources.AsyncRouteResource(self) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self) self.trip = resources.AsyncTripResource(self) @@ -454,6 +458,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location) 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.route = resources.RouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = resources.TripResourceWithRawResponse(client.trip) @@ -473,6 +478,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) 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.route = resources.AsyncRouteResourceWithRawResponse(client.route) self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse( client.arrival_and_departure @@ -494,6 +500,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) 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.route = resources.RouteResourceWithStreamingResponse(client.route) self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse( client.arrival_and_departure @@ -517,6 +524,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop) + self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse( + client.stop_ids_for_agency + ) self.route = resources.AsyncRouteResourceWithStreamingResponse(client.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 9c3ef40..a81c80e 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -88,6 +88,14 @@ TripsForLocationResourceWithStreamingResponse, AsyncTripsForLocationResourceWithStreamingResponse, ) +from .stop_ids_for_agency import ( + StopIDsForAgencyResource, + AsyncStopIDsForAgencyResource, + StopIDsForAgencyResourceWithRawResponse, + AsyncStopIDsForAgencyResourceWithRawResponse, + StopIDsForAgencyResourceWithStreamingResponse, + AsyncStopIDsForAgencyResourceWithStreamingResponse, +) from .arrival_and_departure import ( ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource, @@ -148,6 +156,12 @@ "AsyncStopResourceWithRawResponse", "StopResourceWithStreamingResponse", "AsyncStopResourceWithStreamingResponse", + "StopIDsForAgencyResource", + "AsyncStopIDsForAgencyResource", + "StopIDsForAgencyResourceWithRawResponse", + "AsyncStopIDsForAgencyResourceWithRawResponse", + "StopIDsForAgencyResourceWithStreamingResponse", + "AsyncStopIDsForAgencyResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py new file mode 100644 index 0000000..2b1dbee --- /dev/null +++ b/src/onebusaway/resources/stop_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.stop_ids_for_agency_list_response import StopIDsForAgencyListResponse + +__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] + + +class StopIDsForAgencyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: + return StopIDsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingResponse: + 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: + """ + Get stop 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/stop-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=StopIDsForAgencyListResponse, + ) + + +class AsyncStopIDsForAgencyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: + return AsyncStopIDsForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingResponse: + 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: + """ + Get stop 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/stop-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=StopIDsForAgencyListResponse, + ) + + +class StopIDsForAgencyResourceWithRawResponse: + def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: + self._stop_ids_for_agency = stop_ids_for_agency + + self.list = to_raw_response_wrapper( + 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 + + self.list = async_to_raw_response_wrapper( + 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 + + self.list = to_streamed_response_wrapper( + 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, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 7a04693..6bedc9c 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -15,6 +15,7 @@ from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse 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/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py new file mode 100644 index 0000000..bf3927c --- /dev/null +++ b/src/onebusaway/types/stop_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__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] + + +class StopIDsForAgencyListResponseData(BaseModel): + list: List[str] + + references: References + + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + + +class StopIDsForAgencyListResponse(ResponseWrapper): + data: Optional[StopIDsForAgencyListResponseData] = None diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py new file mode 100644 index 0000000..923a743 --- /dev/null +++ b/tests/api_resources/test_stop_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 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 + 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"]) + + @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" + stop_ids_for_agency = response.parse() + 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: + assert not response.is_closed + 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 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"]) + + @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"]) + + @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" + stop_ids_for_agency = await response.parse() + 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: + assert not response.is_closed + 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 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( + "", + ) From 286007b6a75d095b40a8c03fa85e349a8e40f1a3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 07:51:49 +0000 Subject: [PATCH 016/376] chore(internal): version bump (#17) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aaf968a..b56c3d0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.3" + ".": "0.1.0-alpha.4" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6af69cc..e73225d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.3" +version = "0.1.0-alpha.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 75bdff5..c6c89c3 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.3" # x-release-please-version +__version__ = "0.1.0-alpha.4" # x-release-please-version From 67f0a00150b08e3841b75c1673b5621bd5160435 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:10:12 +0000 Subject: [PATCH 017/376] feat(api): OpenAPI spec update via Stainless API (#18) --- .stats.yml | 2 +- src/onebusaway/types/stop_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/stop_retrieve_response.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 441e696..6b64c2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-ac10a054ead5e711bd033b417891c1769d631135029ca5bd91e6584420403ee2.yml 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..6120be8 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): - list: List[str] + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - references: References + list: Optional[List[str]] = None - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + references: Optional[References] = None class StopIDsForAgencyListResponse(ResponseWrapper): diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 8d71183..abb6779 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: StopRetrieveResponseDataEntry + entry: Optional[StopRetrieveResponseDataEntry] = None - references: References + references: Optional[References] = None class StopRetrieveResponse(ResponseWrapper): From 73c0db4fbf202a48213dd42192686c15a37addce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:24:25 +0000 Subject: [PATCH 018/376] chore(internal): version bump (#20) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b56c3d0..e8285b7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.4" + ".": "0.1.0-alpha.5" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e73225d..53c9986 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.4" +version = "0.1.0-alpha.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 c6c89c3..60af28d 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.4" # x-release-please-version +__version__ = "0.1.0-alpha.5" # x-release-please-version From 345cadc13c30d4f8e3894efd599ad3fdbe596108 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:48:21 +0000 Subject: [PATCH 019/376] feat(api): OpenAPI spec update via Stainless API (#22) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 10 ++ src/onebusaway/resources/__init__.py | 14 ++ .../resources/vehicles_for_agency.py | 162 +++++++++++++++++ src/onebusaway/types/__init__.py | 2 + .../types/vehicles_for_agency_list_params.py | 12 ++ .../vehicles_for_agency_list_response.py | 167 ++++++++++++++++++ .../api_resources/test_vehicles_for_agency.py | 114 ++++++++++++ 9 files changed, 495 insertions(+), 2 deletions(-) create mode 100644 src/onebusaway/resources/vehicles_for_agency.py create mode 100644 src/onebusaway/types/vehicles_for_agency_list_params.py create mode 100644 src/onebusaway/types/vehicles_for_agency_list_response.py create mode 100644 tests/api_resources/test_vehicles_for_agency.py diff --git a/.stats.yml b/.stats.yml index 6b64c2b..2ca4666 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-ac10a054ead5e711bd033b417891c1769d631135029ca5bd91e6584420403ee2.yml +configured_endpoints: 16 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-92606a4bcfb26210a95a7f86b55fb258977f97c375cd3b1f6035ed81a53f2e2c.yml diff --git a/api.md b/api.md index 759705b..ac324dd 100644 --- a/api.md +++ b/api.md @@ -28,6 +28,18 @@ Methods: - client.agency.retrieve(agency_id) -> AgencyRetrieveResponse +# VehiclesForAgency + +Types: + +```python +from onebusaway.types import VehiclesForAgencyListResponse +``` + +Methods: + +- client.vehicles_for_agency.list(agency_id, \*\*params) -> VehiclesForAgencyListResponse + # Config Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 08f81db..a75cc5b 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -48,6 +48,7 @@ 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 @@ -119,6 +120,7 @@ def __init__( 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) @@ -249,6 +251,7 @@ 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 @@ -320,6 +323,7 @@ def __init__( 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) @@ -453,6 +457,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) @@ -473,6 +478,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: 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) @@ -495,6 +501,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) @@ -517,6 +524,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: client.agencies_with_coverage ) self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) + self.vehicles_for_agency = resources.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( diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index a81c80e..041cf0a 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -96,6 +96,14 @@ StopIDsForAgencyResourceWithStreamingResponse, AsyncStopIDsForAgencyResourceWithStreamingResponse, ) +from .vehicles_for_agency import ( + VehiclesForAgencyResource, + AsyncVehiclesForAgencyResource, + VehiclesForAgencyResourceWithRawResponse, + AsyncVehiclesForAgencyResourceWithRawResponse, + VehiclesForAgencyResourceWithStreamingResponse, + AsyncVehiclesForAgencyResourceWithStreamingResponse, +) from .arrival_and_departure import ( ArrivalAndDepartureResource, AsyncArrivalAndDepartureResource, @@ -126,6 +134,12 @@ "AsyncAgencyResourceWithRawResponse", "AgencyResourceWithStreamingResponse", "AsyncAgencyResourceWithStreamingResponse", + "VehiclesForAgencyResource", + "AsyncVehiclesForAgencyResource", + "VehiclesForAgencyResourceWithRawResponse", + "AsyncVehiclesForAgencyResourceWithRawResponse", + "VehiclesForAgencyResourceWithStreamingResponse", + "AsyncVehiclesForAgencyResourceWithStreamingResponse", "ConfigResource", "AsyncConfigResource", "ConfigResourceWithRawResponse", diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py new file mode 100644 index 0000000..d2ff9c3 --- /dev/null +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -0,0 +1,162 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +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"] + + +class VehiclesForAgencyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: + return VehiclesForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingResponse: + 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: + """ + Get vehicles for a specific agency + + Args: + time: Specific time for querying the status (timestamp format) + + 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/vehicles-for-agency/agencyID.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), + ), + cast_to=VehiclesForAgencyListResponse, + ) + + +class AsyncVehiclesForAgencyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: + return AsyncVehiclesForAgencyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreamingResponse: + 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: + """ + Get vehicles for a specific agency + + Args: + time: Specific time for querying the status (timestamp format) + + 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/vehicles-for-agency/agencyID.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 + ), + ), + cast_to=VehiclesForAgencyListResponse, + ) + + +class VehiclesForAgencyResourceWithRawResponse: + def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: + self._vehicles_for_agency = vehicles_for_agency + + self.list = to_raw_response_wrapper( + vehicles_for_agency.list, + ) + + +class AsyncVehiclesForAgencyResourceWithRawResponse: + def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: + self._vehicles_for_agency = vehicles_for_agency + + self.list = async_to_raw_response_wrapper( + vehicles_for_agency.list, + ) + + +class VehiclesForAgencyResourceWithStreamingResponse: + def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: + self._vehicles_for_agency = vehicles_for_agency + + self.list = to_streamed_response_wrapper( + 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, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 6bedc9c..e9da12e 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -13,9 +13,11 @@ 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 .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 .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 diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py new file mode 100644 index 0000000..ebf92d1 --- /dev/null +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["VehiclesForAgencyListParams"] + + +class VehiclesForAgencyListParams(TypedDict, total=False): + time: str + """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 new file mode 100644 index 0000000..2536066 --- /dev/null +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -0,0 +1,167 @@ +# 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__ = [ + "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.""" + + 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.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): + active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + """ID of the closest stop to the current location of the transit vehicle.""" + + 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 + ) + """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.""" + + 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.""" + + 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). + """ + + 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.""" + + +class VehiclesForAgencyListResponseDataList(BaseModel): + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + + 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") + + +class VehiclesForAgencyListResponseData(BaseModel): + list: List[VehiclesForAgencyListResponseDataList] + + references: References + + limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + + +class VehiclesForAgencyListResponse(ResponseWrapper): + data: Optional[VehiclesForAgencyListResponseData] = None diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py new file mode 100644 index 0000000..5f201f2 --- /dev/null +++ b/tests/api_resources/test_vehicles_for_agency.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 VehiclesForAgencyListResponse + +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 + 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"]) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + vehicles_for_agency = client.vehicles_for_agency.list( + agency_id="agencyID", + time="time", + ) + 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" + vehicles_for_agency = response.parse() + 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: + assert not response.is_closed + 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 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"]) + + @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"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + vehicles_for_agency = await async_client.vehicles_for_agency.list( + agency_id="agencyID", + time="time", + ) + 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" + vehicles_for_agency = await response.parse() + 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: + assert not response.is_closed + 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 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="", + ) From c52768a161e72009277a59a4c1edab0a829b31f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:48:58 +0000 Subject: [PATCH 020/376] chore(internal): add type construction helper (#24) --- src/onebusaway/_models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index eb7ce3b..5148d5a 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -406,6 +406,15 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. From 363d6aef24804e99cff20323720aa1d5ee9250a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:49:02 +0000 Subject: [PATCH 021/376] feat(api): OpenAPI spec update via Stainless API (#25) --- .stats.yml | 2 +- src/onebusaway/_models.py | 9 --------- .../types/vehicles_for_agency_list_response.py | 10 ++++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2ca4666..fa549e7 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-92606a4bcfb26210a95a7f86b55fb258977f97c375cd3b1f6035ed81a53f2e2c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-7a71bec90a568b0dbefc3d81206069d9759259460cffa0543b162f6835be1e9a.yml diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 5148d5a..eb7ce3b 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -406,15 +406,6 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) -def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: - """Loose coercion to the expected type with construction of nested values. - - Note: the returned value from this function is not guaranteed to match the - given type. - """ - return cast(_T, construct_type(value=value, type_=type_)) - - def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 2536066..f61596d 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -154,6 +154,16 @@ class VehiclesForAgencyListResponseDataList(BaseModel): vehicle_id: str = FieldInfo(alias="vehicleId") + occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) + + occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) + + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + + phase: Optional[str] = None + + status: Optional[str] = None + class VehiclesForAgencyListResponseData(BaseModel): list: List[VehiclesForAgencyListResponseDataList] From bf9abd536807fd06640a66db6d0db73fc75a24d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:40:32 +0000 Subject: [PATCH 022/376] chore(internal): version bump (#26) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8285b7..4f9005e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.5" + ".": "0.1.0-alpha.6" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 53c9986..499eff2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.5" +version = "0.1.0-alpha.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 60af28d..2738c65 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.5" # x-release-please-version +__version__ = "0.1.0-alpha.6" # x-release-please-version From ec2d9042b554a231cebcd171e0611659edce8aea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:40:49 +0000 Subject: [PATCH 023/376] chore(internal): add type construction helper (#27) --- src/onebusaway/_models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index eb7ce3b..5148d5a 100644 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -406,6 +406,15 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. From 4122e6a98f6d2fef497285fd69f3f8ea0558d578 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:19:07 +0000 Subject: [PATCH 024/376] chore(internal): version bump (#29) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4f9005e..b5db7ce 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.6" + ".": "0.1.0-alpha.7" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 499eff2..63a507b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.6" +version = "0.1.0-alpha.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 2738c65..faf8c10 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.6" # x-release-please-version +__version__ = "0.1.0-alpha.7" # x-release-please-version From 7738125492ce5621f575c377d464a8dc724889e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:04:50 +0000 Subject: [PATCH 025/376] feat(api): OpenAPI spec update via Stainless API (#31) --- .stats.yml | 4 +- api.md | 12 ++ src/onebusaway/_client.py | 8 + src/onebusaway/resources/__init__.py | 14 ++ src/onebusaway/resources/schedule_for_stop.py | 167 ++++++++++++++++++ src/onebusaway/types/__init__.py | 2 + .../schedule_for_stop_retrieve_params.py | 19 ++ .../schedule_for_stop_retrieve_response.py | 89 ++++++++++ tests/api_resources/test_schedule_for_stop.py | 115 ++++++++++++ 9 files changed, 428 insertions(+), 2 deletions(-) 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/.stats.yml b/.stats.yml index fa549e7..85cf09d 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-160e2615de51b1febaeb9f4a2fbbb7e70939e1ebec74946e7ec1e026868fed7e.yml 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/src/onebusaway/_client.py b/src/onebusaway/_client.py index a75cc5b..4717551 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) @@ -258,6 +260,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 @@ -330,6 +333,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) @@ -464,6 +468,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) @@ -485,6 +490,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 @@ -508,6 +514,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 @@ -537,6 +544,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/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..8d1e52c --- /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/stopID.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/stopID.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/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/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/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="", + ) From fe51677a014e6423951b09df944b389eada24a59 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 16:00:04 +0000 Subject: [PATCH 026/376] chore(internal): version bump (#33) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b5db7ce..c373724 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.7" + ".": "0.1.0-alpha.8" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 63a507b..e7d967d 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.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 faf8c10..dbfddcc 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.8" # x-release-please-version From db974f754cc6457cdcd906ea239538c2d33f2c70 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 05:47:15 +0000 Subject: [PATCH 027/376] feat(api): OpenAPI spec update via Stainless API (#34) --- .stats.yml | 2 +- .../resources/stops_for_location.py | 4 --- .../stops_for_location_retrieve_params.py | 4 +-- .../api_resources/test_stops_for_location.py | 26 +++++-------------- 4 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.stats.yml b/.stats.yml index 85cf09d..7b31779 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-160e2615de51b1febaeb9f4a2fbbb7e70939e1ebec74946e7ec1e026868fed7e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-912f1aea248013c509e8c8dc1021bbe3d421d4ff8f46773c4a93a48995146eba.yml 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/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/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 608d388f2ffabd7771004a8e86b204556ca7b354 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 06:29:44 +0000 Subject: [PATCH 028/376] chore(internal): version bump (#36) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c373724..46b9b6b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.8" + ".": "0.1.0-alpha.9" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e7d967d..5d71855 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.8" +version = "0.1.0-alpha.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 dbfddcc..3785dd7 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.8" # x-release-please-version +__version__ = "0.1.0-alpha.9" # x-release-please-version From 74f8c0e2d37dbcabd1ace0d598ea52ec0bb0e04b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:14:12 +0000 Subject: [PATCH 029/376] feat(api): OpenAPI spec update via Stainless API (#37) --- .stats.yml | 2 +- .../types/arrival_and_departure_list_response.py | 8 ++++---- .../types/arrival_and_departure_retrieve_response.py | 4 ++-- src/onebusaway/types/route_retrieve_response.py | 4 ++-- src/onebusaway/types/stop_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/stop_retrieve_response.py | 4 ++-- .../types/stops_for_location_retrieve_response.py | 6 +++--- src/onebusaway/types/stops_for_route_list_response.py | 2 +- src/onebusaway/types/trip_detail_retrieve_response.py | 4 ++-- .../types/trip_for_vehicle_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_retrieve_response.py | 4 ++-- .../types/trips_for_location_retrieve_response.py | 8 ++++---- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7b31779..998bae4 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-912f1aea248013c509e8c8dc1021bbe3d421d4ff8f46773c4a93a48995146eba.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a76aaa28b1ff275676373d305278b77b1b022f153cf3c9866e322ba253828099.yml 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/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/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_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 From e18aa26e3ac01163bd572643404f3eb644c2c3c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:17:14 +0000 Subject: [PATCH 030/376] feat(api): OpenAPI spec update via Stainless API (#39) --- .stats.yml | 2 +- .../types/agencies_with_coverage_retrieve_response.py | 6 +++--- src/onebusaway/types/agency_retrieve_response.py | 6 +++--- src/onebusaway/types/config_retrieve_response.py | 4 ++-- src/onebusaway/types/current_time_retrieve_response.py | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 998bae4..cce1cfa 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-a76aaa28b1ff275676373d305278b77b1b022f153cf3c9866e322ba253828099.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-261df351536029839245955df4df7341de315fe2b1d1d6aeb063eaef62bcddc9.yml 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/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): From 7090ff6acac9430d1d3ccf4b66e226fbffa8da65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:41:36 +0000 Subject: [PATCH 031/376] chore(internal): version bump (#40) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 46b9b6b..3b005e5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.9" + ".": "0.1.0-alpha.10" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 5d71855..6db0b9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.9" +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/_version.py b/src/onebusaway/_version.py index 3785dd7..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.9" # x-release-please-version +__version__ = "0.1.0-alpha.10" # x-release-please-version From e7d7b9a38f674078facb3e921e01ab00b6f314e1 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 032/376] 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 b553dd556114565ac3cfa9ba79574c472d84d737 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 033/376] 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 f730c5eeec125a7f2a0de649b15bdba6e58cf223 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 034/376] 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 6bcbcde4d4c2b0b5b1024e463948010a992ee6cb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:52:41 +0000 Subject: [PATCH 035/376] feat(api): update via SDK Studio (#46) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 07257af901bbaa811a8c98985898ed0ceb31a06a 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 036/376] 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 4717551..50f97d1 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) @@ -262,6 +264,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 @@ -335,6 +338,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) @@ -470,6 +474,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) @@ -492,6 +497,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 ) @@ -516,6 +522,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 ) @@ -546,6 +555,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 ab4042043abc354a4c57e85d8f1bb0057e4ffd06 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 037/376] 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 7beb2f6..9253d55 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -70,7 +70,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 0291de52b545ab1d24dfc267d5c83f9ce6499d11 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 038/376] 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 1eebb8a..9b24ad1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -730,6 +730,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) @@ -1415,3 +1436,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 adf2520115b7c9bedf42f2534a4513963fe513b1 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 039/376] 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 181e337b7fb5a2ff0452d8b6d53d3836114e930f 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 040/376] 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 9253d55..8784976 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -80,7 +80,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 274b4590c1e7ea1767e01dc1b2cc72bdcecff70f 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 041/376] 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 c7d23ca8fac94c3240d8f80610524770b69903d2 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 042/376] 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 9d85f77131cb5f01626d0b5bc486fe1d4821e240 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 043/376] 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 50f97d1..5d59925 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) @@ -265,6 +267,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 @@ -339,6 +342,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) @@ -475,6 +479,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) @@ -498,6 +503,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 ) @@ -525,6 +531,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 ) @@ -558,6 +565,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 361497d4f332e65fbebaef9d9530b107ff05c749 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 044/376] 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 5d59925..bd00c96 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) @@ -268,6 +270,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 @@ -343,6 +346,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) @@ -480,6 +484,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) @@ -504,6 +509,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 ) @@ -532,6 +538,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 ) @@ -566,6 +573,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 2496b02838f1a404139b2142382f25cb809032d6 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 045/376] 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 bd00c96..a72f749 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) @@ -269,6 +271,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 @@ -345,6 +348,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) @@ -483,6 +487,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) @@ -508,6 +513,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( @@ -537,6 +543,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( @@ -572,6 +579,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 ec251415a9dc67e04b379f26d578992a40acffe0 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 046/376] 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 c1bcf065d916eefabd94bba4b11ec6909c95451a 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:23 +0000 Subject: [PATCH 047/376] wip (#60) --- src/onebusaway/resources/agency.py | 4 ++-- src/onebusaway/resources/arrival_and_departure.py | 8 ++++---- 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/schedule_for_route.py | 4 ++-- src/onebusaway/resources/schedule_for_stop.py | 4 ++-- src/onebusaway/resources/stop.py | 4 ++-- src/onebusaway/resources/stop_ids_for_agency.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/vehicles_for_agency.py | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 891cd4e..0a9c46b 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -54,7 +54,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/agencyID.json", + 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 ), @@ -97,7 +97,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/agencyID.json", + 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 ), diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index cab33b8..349e9af 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -68,7 +68,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/stopID.json", + f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -123,7 +123,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/stopID.json", + f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -182,7 +182,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/stopID.json", + f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -237,7 +237,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/stopID.json", + f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", 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 a91762c..7cf9b32 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -54,7 +54,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/routeID.json", + 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 ), @@ -97,7 +97,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/routeID.json", + 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 ), 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 ), 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 ), 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, diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 8d1e52c..9b44909 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -66,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/schedule-for-stop/stopID.json", + f"/api/where/schedule-for-stop/{stop_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -117,7 +117,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/stopID.json", + f"/api/where/schedule-for-stop/{stop_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 5f5a1d5..10b95ec 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -54,7 +54,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/stopID.json", + 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 ), @@ -97,7 +97,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/stopID.json", + 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 ), diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 2b1dbee..a611a6e 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_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/stop-ids-for-agency/agencyID.json", + 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 ), @@ -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/stop-ids-for-agency/agencyID.json", + 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 ), diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 1dc9ca7..2a8e5b8 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -65,7 +65,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/routeID.json", + f"/api/where/stops-for-route/{route_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,7 +124,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/routeID.json", + f"/api/where/stops-for-route/{route_id}.json", 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 02f13f6..d4965a6 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -54,7 +54,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/tripID.json", + 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 ), @@ -97,7 +97,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/tripID.json", + 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 ), diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 56c983e..7245d2b 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -77,7 +77,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/tripID.json", + f"/api/where/trip-details/{trip_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,7 +151,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/tripID.json", + f"/api/where/trip-details/{trip_id}.json", 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 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/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index d2ff9c3..800559b 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -62,7 +62,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/agencyID.json", + f"/api/where/vehicles-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -112,7 +112,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/agencyID.json", + f"/api/where/vehicles-for-agency/{agency_id}.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, From 81659abb4688b1273ab65441c6fedd32159f7b31 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:39:14 +0000 Subject: [PATCH 048/376] chore(internal): version bump (#61) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ee49ac2..fd0ccba 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" } \ No newline at end of file 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 e7b493cdbbdf1643316f53001c625f93468fecc3 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:56:41 +0000 Subject: [PATCH 049/376] chore(internal): version bump (#64) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e3bdb41232469afef8a4ab35496d9e8400485fc0 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 050/376] 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 a72f749..505ab89 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) @@ -279,6 +281,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 @@ -356,6 +359,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) @@ -495,6 +499,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: @@ -523,6 +530,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: @@ -553,6 +563,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: @@ -595,6 +608,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 65e0045d11757747e18843cdffcda0221c9be39a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:27:11 +0000 Subject: [PATCH 051/376] chore(internal): version bump (#67) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e6dee13ab540e35358d335c6d4ccc6cda9f98f3a 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 052/376] 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 505ab89..a763651 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) @@ -282,6 +286,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 @@ -360,6 +366,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) @@ -502,6 +510,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: @@ -533,6 +543,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: @@ -566,6 +578,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: @@ -611,6 +625,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 932eec3679132913178225bd9ddbbeb29714d81a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:31:11 +0000 Subject: [PATCH 053/376] chore(internal): version bump (#70) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 48cebd6ed48053372e809918f59b613c32374c2e 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 054/376] 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 a763651..9a58cdc 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) @@ -286,6 +288,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 @@ -366,6 +369,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) @@ -510,6 +514,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) @@ -543,6 +550,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) @@ -578,6 +588,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) @@ -625,6 +638,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 9347bb30c4c53f280a05ff60a3fe0fa5976fa72e 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 055/376] 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 f99f17ca6f6cd330ea0276fe67a112265ddd4315 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 056/376] 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 5afd167e1d7dbc47c0e68a4f4d93c06ed152933d 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 057/376] 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 434d258937b744c2898958499faca6865b9bdbf3 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:30:20 +0000 Subject: [PATCH 058/376] chore(internal): version bump (#76) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 35a5fc873481bf3b6c3a30932676afcd6167e72e 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 059/376] 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 9a58cdc..1862174 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) @@ -291,6 +293,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 @@ -372,6 +375,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) @@ -519,6 +523,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: @@ -555,6 +560,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: @@ -593,6 +599,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: @@ -643,6 +650,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 a442600f77423ea9db92c0d917d468a36b3f6f7d 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 060/376] 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 1862174..d7652ab 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) @@ -294,6 +296,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 @@ -376,6 +379,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) @@ -524,6 +528,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: @@ -561,6 +566,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: @@ -600,6 +606,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: @@ -651,6 +658,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 a7969868c6bbf430dc9dace513e04fc194bb3890 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:27:36 +0000 Subject: [PATCH 061/376] chore(internal): version bump (#80) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a2ff5e0937ed581f9f38201135be18e5afb782fa 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 062/376] 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 d7652ab..eda5594 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) @@ -271,7 +271,6 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): - agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -291,6 +290,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 @@ -354,7 +354,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) @@ -374,6 +373,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) @@ -497,9 +497,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) @@ -519,6 +516,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 ) @@ -533,9 +531,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) @@ -557,6 +552,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 ) @@ -571,9 +567,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) @@ -597,6 +590,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 ) @@ -611,9 +605,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 @@ -649,6 +640,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 ebb25f9fd4bb25e7a2769b214576412ee3ce1efc 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 063/376] 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 eda5594..97c8a8a 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) @@ -271,6 +273,7 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): + agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -354,6 +357,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) @@ -497,6 +501,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) @@ -531,6 +538,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) @@ -567,6 +577,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) @@ -605,6 +618,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 987877c7ec6eb01c799d1fe998e2075e02f4c288 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 064/376] 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 6eacbdeb0690d287bdad2e8e6949e3e4a378904b 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 065/376] 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 06577bfe194b5cd64480c85c26d6753e4355fd40 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 066/376] 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 dc58700d8574ded9fc848dffd992fc8d45995b92 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 067/376] 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 910097cdf84d2fc22548e7ca2d7ed6c6e3716d77 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 068/376] 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 f194b88fc97a2278a8ef68d490d9aa8847b5fa38 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:17:06 +0000 Subject: [PATCH 069/376] 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 examples/agency.py | 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 170 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 examples/agency.py 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/examples/agency.py b/examples/agency.py 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 87e8e29bb35506841b40ff8823805998eb0035ed 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 070/376] 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 bafc510c7e4602313e86be5fdec82a22a6b01401 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 071/376] 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 a13d9ef87ea4481fb2af063d03dbd4caccbdc46a 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 072/376] 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 65becec201bd93f94bd5f7aa50043cf15cfe3238 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 073/376] 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 dde530877f158e680a595d9c511bb8eecf2c186d 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 074/376] 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 cf5436eb004b6df727149d075d15f7d5f6aecc36 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 075/376] 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 bcead6233d171835625aaa18a06bc4e795da5868 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 076/376] 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 5e3203b790a31ef56843e218fb977783905b67ae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:07:39 +0000 Subject: [PATCH 077/376] chore(internal): version bump (#98) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a87ee9fa8d8fcb0b4bdf3a9c018526172aa50221 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 078/376] 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 13e6d0c8869435ddd4f5c21ae2b53e5406e389f3 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:50:26 +0000 Subject: [PATCH 079/376] chore(internal): version bump (#101) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 b86b5e90bfdfe48550e886cf53e3e2ccd08ce2fe 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:21:55 +0000 Subject: [PATCH 080/376] chore(internal): version bump (#103) --- .release-please-manifest.json | 2 +- README.md | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- .../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 ------------------- 8 files changed, 4 insertions(+), 142 deletions(-) delete mode 100755 src/onebusaway/types/search_for_route_retrieve_params.py delete mode 100755 src/onebusaway/types/search_for_route_retrieve_response.py delete mode 100755 src/onebusaway/types/search_for_stop_retrieve_params.py delete mode 100755 src/onebusaway/types/search_for_stop_retrieve_response.py 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/README.md b/README.md index 22f2108..f4dc5f6 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 diff --git a/src/onebusaway/types/search_for_route_retrieve_params.py b/src/onebusaway/types/search_for_route_retrieve_params.py deleted file mode 100755 index 08e8086..0000000 --- a/src/onebusaway/types/search_for_route_retrieve_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 deleted file mode 100755 index 0ed8dc3..0000000 --- a/src/onebusaway/types/search_for_route_retrieve_response.py +++ /dev/null @@ -1,51 +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__ = [ - "SearchForRouteRetrieveResponse", - "SearchForRouteRetrieveResponseData", - "SearchForRouteRetrieveResponseDataList", -] - - -class SearchForRouteRetrieveResponseDataList(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 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 deleted file mode 100755 index 2f47894..0000000 --- a/src/onebusaway/types/search_for_stop_retrieve_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# 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 deleted file mode 100755 index 5ac10ca..0000000 --- a/src/onebusaway/types/search_for_stop_retrieve_response.py +++ /dev/null @@ -1,53 +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__ = [ - "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 From d831a2eaabcfbe5148e540ceb5376a416ec956d4 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 6 Sep 2024 12:34:22 -0400 Subject: [PATCH 081/376] 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 examples/agency.py | 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 166 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 examples/agency.py 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/examples/agency.py b/examples/agency.py 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 368869b4e09a6c02182c3d6f9a4381a12c8f9e55 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 082/376] 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 ca26dc34da93bff32dbecdd15844132f4114b586 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 083/376] 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 67c9fe0d49c9620499db927f6f7eccf69ca74c64 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 084/376] 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 f4dc5f6..7148ff0 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 966619f1bd45e4df28aadb072f0d4e72f2166c02 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 085/376] 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 7148ff0..81cd2c1 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 572c9755855568de10d2fdf783bf0757dcebb13c 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 086/376] 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 3ea31eb465851f28ec390a5a5cee9896b52319c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:51:33 +0000 Subject: [PATCH 087/376] chore(internal): version bump (#111) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 1b01e1fe9de413f81cbbe0806e2cf6e7a9f6bf96 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 088/376] 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 8784976..a13b129 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.10.1 +mypy==1.11.2 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 @@ -70,7 +70,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 @@ -80,7 +80,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 9b24ad1..11b8c71 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 @@ -750,6 +751,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: @@ -1460,3 +1508,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 24efdca9b2af0d6d37ca956fef5600c0320e8ca3 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:36:16 +0000 Subject: [PATCH 089/376] chore(internal): codegen related update (#114) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 d727655cfef5e12ac14e012f8e08f8a490cf0fbf 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 090/376] 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 81cd2c1..174d159 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 22fc2e6b4c473a866b01c365b7b1c9c0f829348f 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 091/376] 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 97aca6fa6580bb677af37fe7e8bc81d062d5b693 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 092/376] chore(internal): codegen related update (#118) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 f386d1984f2f12e0184d4b60fc32a05e0e685aa0 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:22:01 +0000 Subject: [PATCH 093/376] chore(internal): codegen related update (#120) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 18035540ca178d3ab114b9cd13414cd59e87bae0 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 094/376] 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 100ad5537ddd36ff443ed74cd4a913a72d11704e 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:29 +0000 Subject: [PATCH 095/376] chore(internal): codegen related update (#123) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 ab8f7fb10854d960967e55bfc8ca79c81761e502 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 096/376] 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 11b8c71..1583c08 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -692,6 +692,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)) @@ -1445,6 +1446,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 10990fbbe015fbcef20d89e3aa9d6ab44c28a9a1 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 097/376] chore: add repr to PageInfo class (#126) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_base_client.py | 6 ++++++ src/onebusaway/_version.py | 2 +- 4 files changed, 9 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/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/_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]): """ 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 0b7d8faaf21fdd57035214e87d87679e524f075a 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:43:01 +0000 Subject: [PATCH 098/376] chore: update SDK settings (#128) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e555a03cac825e51f3faddc1684ca6c851f3b1e7 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 099/376] 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 a13b129..400c42b 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -80,7 +80,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 1583c08..479f233 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 @@ -735,7 +736,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 @@ -744,6 +752,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) @@ -1491,8 +1501,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) @@ -1502,6 +1517,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 260ce743211306aefc1e962b2545aa662dc62cef 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:51:38 +0000 Subject: [PATCH 100/376] feat(api): api update (#131) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 00836270b469ba47d2cba6c79323e60c00711be1 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 101/376] 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 400c42b..3276aa2 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -16,8 +16,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 @@ -28,8 +26,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 @@ -60,20 +59,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 @@ -90,10 +87,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 b7ce65e..266d2c1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -19,7 +19,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 @@ -30,15 +30,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 825f835c3a81afe810c68a39ebed5d7b4ece2873 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:43 +0000 Subject: [PATCH 102/376] chore(internal): version bump (#134) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 3893bea4a21a8ec3e890d28630bb6c2537deb929 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 103/376] 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 3276aa2..9e3648e 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,7 +48,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 4923b53613786f596cd516578d850005c1004396 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:00:13 +0000 Subject: [PATCH 104/376] chore(internal): version bump (#137) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 8a7ddfbba39842424042cc2bce3211d0db1efda0 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 105/376] 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 9ec4b5c911c64de023af823e6d2093ba5ebb0348 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:19:07 +0000 Subject: [PATCH 106/376] chore(internal): version bump (#140) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e4564f531ef23f57ef53342951b50685f88841fb 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 107/376] 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 7e93338d2291a1bb4128087dc749abede9177523 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:01:48 +0000 Subject: [PATCH 108/376] chore: rebuild project due to codegen change (#143) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 0c08098bd22bc0a68480085b6890a14bad1eb8d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:43:50 +0000 Subject: [PATCH 109/376] chore: rebuild project due to codegen change (#144) --- README.md | 4 ++-- pyproject.toml | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 174d159..c751b4a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![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 +312,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 d4fc9abcbc8931aaa570fd06bf79aacae015ff8f 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 110/376] 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 479f233..4f4585c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -693,7 +693,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)) @@ -1456,7 +1456,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 ae73f7fd582ee0be515246082b4edbfe295e8ae2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:49:15 +0000 Subject: [PATCH 111/376] chore(internal): version bump (#148) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 88c7d7c49bb72241e371d9f3a4d8e4b522298b1c 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 112/376] 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 c751b4a..8b5bc92 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,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() @@ -50,8 +49,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 1a77c00d134bee212ea270bd17cdcdace365fc48 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:59:30 +0000 Subject: [PATCH 113/376] chore(internal): version bump (#151) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a5df66e18b2ec4864ce501cd84cf91c821a956a5 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 114/376] 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 8cdefe01da2522df847339e04c3808e8c84f1fa3 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:47 +0000 Subject: [PATCH 115/376] chore(internal): version bump (#154) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 55b27a529df89e5e84c402a9932aa0604dc9c09d 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 116/376] 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 9e3648e..73cc1bd 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -51,6 +51,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 4f4585c..db48238 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 @@ -1578,3 +1581,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 3909d0f3a15e7f8cd826a3163be11b8fe7b670c5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 01:32:51 +0000 Subject: [PATCH 117/376] chore(internal): codegen related update (#157) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 52556a421f7e5856c7480cb0e656a2965c3d1a37 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 118/376] 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 2dea003b32641cbd3431af54769611f5f188903a 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:52 +0000 Subject: [PATCH 119/376] chore(internal): codegen related update (#160) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 cdd8f20f288399ca49f865064ab9b2d45d0b90f0 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 120/376] 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 8b5bc92..4443657 100644 --- a/README.md +++ b/README.md @@ -166,12 +166,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 b2ccc75d2eb18c0e2782e42bd0760fe879c731bc 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:39 +0000 Subject: [PATCH 121/376] chore(internal): version bump (#163) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9048e8fdade928d968697a79f479ab24b23e2152 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 122/376] 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 9d81ca1084e8662a83b5b02affda7b825b419c74 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:20:29 +0000 Subject: [PATCH 123/376] chore(internal): codegen related update (#166) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 b1c7ebc35ffac127600c061ded865fefcf63cbb2 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 124/376] 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 4d8a5b6a100fc031998c3d04b7991e54b102b8ca 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:45 +0000 Subject: [PATCH 125/376] chore(internal): version bump (#169) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 4b65a27abfb59c1e64dfd4ac5ce336da2befa910 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 126/376] 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 6383c81ad42f648e16dda05f494910e761f7a6b4 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:12:52 +0000 Subject: [PATCH 127/376] chore(internal): version bump (#172) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 253f9c3302c79c62007f4eaf121040f4264263f9 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 128/376] 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 431e99f1ccde54d7521f8d6a67ebdd1da8b34b87 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:28 +0000 Subject: [PATCH 129/376] chore(internal): version bump (#175) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 017da9d53ff90406d6a981b7f02a9f706f670e1d 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 130/376] 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 97c8a8a..2fc90f4 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) @@ -280,6 +282,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 @@ -364,6 +367,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) @@ -510,6 +514,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) @@ -547,6 +552,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) @@ -586,6 +592,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) @@ -631,6 +638,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 cfd92b83b8d84e8e4c87839165a2f89e28dc99e3 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:47 +0000 Subject: [PATCH 131/376] chore(internal): version bump (#178) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 4f507e9b536fd039c2825f48ca93f9b2b9cf5d2a 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 132/376] 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 73cc1bd..5a298c1 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -68,7 +68,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 @@ -97,6 +97,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 e7bf3caa536bbfec3af316a3ce17a0ef201744d4 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:45 +0000 Subject: [PATCH 133/376] chore(internal): version bump (#181) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a1b450933b97460ba62abc8fa45a5cc0393df510 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 134/376] 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 274283f1e7f47a2f317d04b7692fea254f2498d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 20:50:29 +0000 Subject: [PATCH 135/376] chore(internal): version bump (#184) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 b64d42da90a1fc8c095f9917bd81a9b4e08eed41 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 136/376] 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 5a298c1..31b40b6 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -62,9 +62,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 266d2c1..4135c8c 100644 --- a/requirements.lock +++ b/requirements.lock @@ -30,9 +30,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 d7e4cea98ca8947ce42fed52889d62e9dff3d215 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:17:32 +0000 Subject: [PATCH 137/376] chore(internal): codegen related update (#187) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 c3c219a1ef10925e3652bd3f011cf3ce66f43b3d 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 138/376] 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 4443657..b876279 100644 --- a/README.md +++ b/README.md @@ -260,18 +260,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 e4c04f4f2680e7a2d9e6f8db89da2dff72df1470 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:19:04 +0000 Subject: [PATCH 139/376] chore(internal): version bump (#190) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 4765c20746886a7a2e6a30967485e4f5d30638af 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 140/376] 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 31b40b6..de0c583 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -68,7 +68,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 c53edf0a9cdec43b341af05cbfbe52e092b740f5 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:48 +0000 Subject: [PATCH 141/376] chore(internal): version bump (#193) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9af31101facd465d7e7ef9a8cdf8a4d27ac97e38 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 142/376] 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 2fc90f4..59973d5 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) @@ -275,34 +304,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 @@ -360,34 +389,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) @@ -505,176 +534,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 11716d4541816c025d0692067f6747daae6efa74 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:10:29 +0000 Subject: [PATCH 143/376] chore(internal): version bump (#196) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 3a165d7d38663496575e1ada04ea9e3a749b9e5f 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 144/376] chore(internal): codegen related update (#197) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b876279..84022b9 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,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 7f0b3b2daef7db0c01cf6a1775a29e76c932158f 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 145/376] chore(internal): codegen related update (#198) --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 84022b9..b876279 100644 --- a/README.md +++ b/README.md @@ -288,16 +288,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 b466a4f58e4ee6eccf363767711080530a3ce682 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 146/376] chore(internal): codegen related update (#201) --- .release-please-manifest.json | 2 +- README.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 6bbc0bb..ae48f1a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.4.6" + ".": "1.4.8" } \ No newline at end of file diff --git a/README.md b/README.md index b876279..84022b9 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,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: diff --git a/pyproject.toml b/pyproject.toml index 79ca5a5..37c2c42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.4.6" +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 950c434..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.6" # x-release-please-version +__version__ = "1.4.8" # x-release-please-version From 524a6b0ce3641b20d57e48619bbb95554937fdbc 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:21 +0000 Subject: [PATCH 147/376] chore(internal): codegen related update (#203) --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 84022b9..b876279 100644 --- a/README.md +++ b/README.md @@ -288,16 +288,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 b733316a4cab5f7760d9d8c93b29c0b3a0c694d5 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:53 +0000 Subject: [PATCH 148/376] chore(internal): version bump (#204) --- .release-please-manifest.json | 2 +- README.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 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/README.md b/README.md index b876279..84022b9 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,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: 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 0356d79189229726caa3cd5bb9aed3ab6ea350df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 07:09:22 +0000 Subject: [PATCH 149/376] chore(internal): fix some typos (#205) --- tests/test_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index db48238..7d69c5c 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"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1105,11 +1105,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"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( From 80889e6e610a16bc6d7d75eba6e1e9b3ec706c36 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:47 +0000 Subject: [PATCH 150/376] chore(internal): version bump (#208) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 b374b53b30a534f804d7d425f474e2b2d5ecc17c 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 151/376] 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 9a17598dd41f3621e05a662702430067abd30641 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:43 +0000 Subject: [PATCH 152/376] chore: small refactors (#211) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 29af3934b0f57c7887d0e0fbf678f5cbd10bb532 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 153/376] 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 b75a50118f6909fbdb47f9b14c41c3323a5328ef 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:01:52 +0000 Subject: [PATCH 154/376] chore(internal): codegen related update (#214) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 26b93fd4dfce850ac113bb97407776a7b984f31a 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 155/376] 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 de0c583..ab3a39a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -35,7 +35,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 @@ -76,7 +76,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 @@ -85,7 +85,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 4135c8c..6005366 100644 --- a/requirements.lock +++ b/requirements.lock @@ -25,7 +25,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 @@ -36,7 +36,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 e42913edd51c37b6a84d32261c62bbaa733a53ac 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:55 +0000 Subject: [PATCH 156/376] chore(internal): version bump (#217) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 cd437d5e9152ea0b18856606fa2508eea0beb3cc 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 157/376] docs: fix typos (#218) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 84022b9..720b40a 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ except onebusaway.APIStatusError as e: print(e.response) ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | @@ -230,8 +230,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 e61da18be4bb14819cb7de19615d43e9562b1672 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 158/376] chore(internal): codegen related update (#220) --- .release-please-manifest.json | 2 +- README.md | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 4 insertions(+), 4 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/README.md b/README.md index 720b40a..a3f42c3 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,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. 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 18b792dc724a1b1196a471f1fe42ae8896ef3429 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 07:00:21 +0000 Subject: [PATCH 159/376] chore(internal): codegen related update (#222) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 2d0ab9619ac49cfe845a954a74cd715fceab8b4a 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 160/376] 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 f8246203a2175772289c41b3add9aa6030ba9697 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:02:16 +0000 Subject: [PATCH 161/376] chore(internal): codegen related update (#225) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 152f6f4987459c603cd89e59c8b3ef25cca09d5d 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 162/376] 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 ab3a39a..e08169b 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,7 +48,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 @@ -68,7 +68,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 1d39907517355472783c7d30a5b62786e2639ead 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:52 +0000 Subject: [PATCH 163/376] chore(internal): codegen related update (#228) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 bf5234cd2fc6e134806f9bb99587a7184b6679d1 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 164/376] 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 c7424d2660951fabd0eccfd39167daa378980b7a 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:27 +0000 Subject: [PATCH 165/376] fix(tests): make test_get_platform less flaky (#231) --- tests/test_client.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 7d69c5c..e010f9f 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 @@ -1609,10 +1610,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 9fa7275dd7ecc233af68bb248285213bc2ecf86d 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:55 +0000 Subject: [PATCH 166/376] chore(internal): version bump (#232) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- tests/test_client.py | 25 +++++++------------------ 4 files changed, 10 insertions(+), 21 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/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 diff --git a/tests/test_client.py b/tests/test_client.py index e010f9f..7d69c5c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,7 +6,6 @@ import os import sys import json -import time import asyncio import inspect import subprocess @@ -1610,20 +1609,10 @@ async def test_main() -> None: [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) + 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 ffa04a548152312c0547c98bee63c76578926e20 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 167/376] 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 7d69c5c..e010f9f 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 @@ -1609,10 +1610,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 25ecd810b2f653f7ab730dde26e10201a04048d2 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:55:19 +0000 Subject: [PATCH 168/376] chore(internal): codegen related update (#235) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 404316003b5ebb37bba8e93b4c90726b0421929e 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 169/376] 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 b71981397baed7675923f194b1234413cb0c8b90 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:53:27 +0000 Subject: [PATCH 170/376] chore(internal): codegen related update (#238) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 313cde855d5365d5f4bfcbbe948dc6964fc2b1f0 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 171/376] 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 341de0df54a2b3282bbbfdf0d28c7b282c62f01d 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:53 +0000 Subject: [PATCH 172/376] chore(internal): codegen related update (#241) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 6381b06e94339ce9cf0e1388400ade888cbd1b4c 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 173/376] 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 8f7807f27ef2db8816299c53b62542001f1ebb03 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:21:14 +0000 Subject: [PATCH 174/376] chore(internal): codegen related update (#244) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 8da12ce340e98cb5894bbd58136b100f793bbdeb 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 175/376] 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 e08169b..77952af 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -78,7 +78,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 0c4d0f7a23ad39bb02249f6ef48c4d92fb9d1974 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:23:32 +0000 Subject: [PATCH 176/376] chore(internal): version bump (#247) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a46ff956ab68238b4cc8c5189e9d96823c07821a 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 177/376] 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 62e6189d3aac207d91e01201288c2a93292494e9 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:44:00 +0000 Subject: [PATCH 178/376] chore(internal): codegen related update (#250) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 60a8031005a6f5a5f743ac8ba6d36be3bc3d290d 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 179/376] 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 b54389eb1788bc971e425afd194078be3eed5e77 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:48 +0000 Subject: [PATCH 180/376] chore(internal): version bump (#253) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 6d7c79f675ca41a624840e64fd6cf8c9bdd8a9ab 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 181/376] 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 40efa869ea0cef32503d1074071f035e66f054cf 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:33:31 +0000 Subject: [PATCH 182/376] chore(internal): version bump (#256) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 537db1551094524a626a3c02fc5011764995a92b 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:53:27 +0000 Subject: [PATCH 183/376] chore(internal): version bump (#258) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 cc26c01c5db1224e691e89fc696e1f7b1317f816 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:33 +0000 Subject: [PATCH 184/376] chore(internal): version bump (#260) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 2d886e8694f428e01ab5a4f924a461cd439fa0bb 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 185/376] 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 c7ad080eaaf63498a2ff806c8c223c27e820e296 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:36:14 +0000 Subject: [PATCH 186/376] chore(internal): version bump (#263) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 5806883bdce7eba8378dae3ab232083a9d41a6bc 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 187/376] 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 f044ae22363abdbd9139702739534565ab4280ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 09:58:54 +0000 Subject: [PATCH 188/376] chore(internal): version bump (#266) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 4563e2bbade15530c5f20f58dc1aaf32393ccea3 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 189/376] 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 206f95422f13fd89a1075b7b7904b5fd9f071a88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 12:35:50 +0000 Subject: [PATCH 190/376] chore(internal): version bump (#269) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 25cb724adb6a2b902e330a17380398bf33b65be5 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 191/376] 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 4a362bdf5fbfee4ee27b0615ce30f4c9e410b31b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:56:08 +0000 Subject: [PATCH 192/376] chore(internal): version bump (#272) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 522f4a5501d52537e0ebe31db51185e20d3e70db 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 193/376] 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 a3f42c3..fdf835f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,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 59925bd7720d199a68819137cb06060840b5308f 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 194/376] 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 59973d5..603a340 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. """ @@ -361,7 +361,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 7eb479da4a0facdbfbc5f498012944f14ea81d8e 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 195/376] 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 6694143a241ccd1eda74edf2fe8f3688c20ce52c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 23:25:49 +0000 Subject: [PATCH 196/376] chore(internal): version bump (#277) --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9b7aec82416c2ca44eaf441ca8841978c2cfcaf8 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 197/376] 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 e3e9adb10e8338ac29e77e92d3e7335578ffa2db 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 198/376] 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 e19814db3f2c3da050c3f1a8e97708a85fc2791b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 04:59:29 +0000 Subject: [PATCH 199/376] chore(internal): codegen related update (#281) --- requirements-dev.lock | 1 + requirements.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/requirements-dev.lock b/requirements-dev.lock index 77952af..e00b078 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 diff --git a/requirements.lock b/requirements.lock index 6005366..cf5c8e0 100644 --- a/requirements.lock +++ b/requirements.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 From 5b0fb03af990ade294c99b43a0176d2c5eb83ed2 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 200/376] 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 5e58a5d60dcc37abdb8fe8965402b280c7d07319 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 201/376] 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 bf7e7c6b441bfc70fa72f81933e33780c27d6aea 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 202/376] 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 dc02f64341c70f3325c6b9aa456a50dae9de03fc 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 203/376] 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 ab7ab15f300234593815cf38711a39a986c00e78 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 204/376] 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 1522513904c36e5c506d175129450ef86e4632d2 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 205/376] 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 62d24686cd4cf3ecf3d90006e4eb5fcde44c3101 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 11:47:38 +0000 Subject: [PATCH 206/376] chore(internal): remove trailing character (#287) --- tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index e010f9f..3adc176 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1595,7 +1595,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 cd8737291c4c206e85d3ee405f661632bc040d4f 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:15:59 +0000 Subject: [PATCH 207/376] 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/_version.py | 2 +- 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 | 715 +++++++----------- tests/test_models.py | 11 +- tests/test_streaming.py | 20 +- tests/test_transform.py | 16 +- 126 files changed, 3807 insertions(+), 5043 deletions(-) diff --git a/README.md b/README.md index fdf835f..cdb4041 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,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()) ``` @@ -90,7 +88,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 +128,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 +151,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 +210,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,10 +268,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 603a340..deee8f1 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) @@ -204,42 +157,33 @@ def auth_headers(self) -> httpx.Auth: @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: @@ -254,29 +198,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) @@ -302,7 +231,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 @@ -338,56 +266,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) @@ -433,42 +343,33 @@ def auth_headers(self) -> httpx.Auth: @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: @@ -483,29 +384,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) @@ -531,235 +417,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/_version.py b/src/onebusaway/_version.py index af5f659..0812d58 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.3" # x-release-please-version \ No newline at end of file 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 3adc176..77fac66 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,53 +2,59 @@ 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 -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) @@ -56,7 +62,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) @@ -71,9 +76,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 @@ -105,58 +108,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 @@ -164,21 +167,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {} - 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"} @@ -264,9 +267,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 @@ -275,70 +276,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"} @@ -350,7 +335,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -433,7 +418,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2"} + assert params == {'bar': '1', 'foo': '2'} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -447,7 +432,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2"} + assert params == {'foo': '2'} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -486,29 +471,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) @@ -519,7 +502,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 @@ -536,9 +518,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] @@ -546,25 +526,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( @@ -575,21 +541,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -600,21 +552,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -639,9 +577,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) @@ -658,9 +596,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: @@ -672,7 +608,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) @@ -680,26 +616,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) @@ -707,7 +643,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) @@ -715,11 +651,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 @@ -729,11 +661,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 @@ -746,7 +674,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) @@ -757,7 +685,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) @@ -772,7 +700,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) @@ -787,15 +718,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) @@ -810,11 +744,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) @@ -831,9 +763,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 @@ -865,58 +795,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 @@ -924,21 +854,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {} - 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"} @@ -1024,9 +954,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 @@ -1035,70 +963,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) assert dict(url.params) == {"query_param": "bar"} @@ -1110,7 +1022,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1193,7 +1105,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2"} + assert params == {'bar': '1', 'foo': '2'} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -1207,7 +1119,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2"} + assert params == {'foo': '2'} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1246,29 +1158,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) @@ -1279,7 +1189,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 @@ -1296,9 +1205,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] @@ -1306,25 +1213,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( @@ -1335,21 +1228,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -1360,21 +1239,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -1400,9 +1265,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) @@ -1420,9 +1285,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 @@ -1435,7 +1298,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) @@ -1443,26 +1306,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: @@ -1471,7 +1334,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) @@ -1479,11 +1342,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 @@ -1493,11 +1352,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 @@ -1511,7 +1366,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) @@ -1522,7 +1377,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) @@ -1538,7 +1393,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) @@ -1553,18 +1411,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) @@ -1579,9 +1438,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 @@ -1617,13 +1476,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) + time.sleep(0.1) \ No newline at end of file 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 16341e726017d6bc1e5b73b0c2804649e730b369 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 208/376] 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 | 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/_version.py | 2 +- 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 | 715 +++++++++++------- tests/test_models.py | 11 +- tests/test_streaming.py | 20 +- tests/test_transform.py | 16 +- 126 files changed, 5043 insertions(+), 3807 deletions(-) diff --git a/README.md b/README.md index cdb4041..fdf835f 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,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()) ``` @@ -88,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: @@ -128,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 @@ -151,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. @@ -210,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. @@ -268,7 +270,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 e2acc95..2e0349f 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -1,18 +1,82 @@ # 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"] +__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() @@ -24,7 +88,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 + pass diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 26cbf6c..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 @@ -84,7 +83,6 @@ APIConnectionError, APIResponseValidationError, ) -from ._legacy_response import LegacyAPIResponse log: logging.Logger = logging.getLogger(__name__) @@ -205,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 @@ -293,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 @@ -610,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, } @@ -996,7 +994,6 @@ def _request( response.reason_phrase, response.headers, ) - try: response.raise_for_status() @@ -1072,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): @@ -1597,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 deee8f1..603a340 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -2,48 +2,77 @@ 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"] +__all__ = [ + "Timeout", + "Transport", + "ProxiesTypes", + "RequestOptions", + "OnebusawaySDK", + "AsyncOnebusawaySDK", + "Client", + "AsyncClient", +] + class OnebusawaySDK(SyncAPIClient): agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource @@ -80,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) @@ -157,33 +204,42 @@ def auth_headers(self) -> httpx.Auth: @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: @@ -198,14 +254,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) @@ -231,6 +302,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 @@ -266,38 +338,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) @@ -343,33 +433,42 @@ def auth_headers(self) -> httpx.Auth: @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: @@ -384,14 +483,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) @@ -417,130 +531,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 af310bb..c76aabb 100644 --- a/src/onebusaway/_exceptions.py +++ b/src/onebusaway/_exceptions.py @@ -2,15 +2,26 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from typing_extensions import Literal +__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 cda700b..153115b 100644 --- a/src/onebusaway/_resource.py +++ b/src/onebusaway/_resource.py @@ -3,12 +3,13 @@ from __future__ import annotations import time -import anyio - from typing import TYPE_CHECKING +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 02db195..16b6f2b 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 @@ -140,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): @@ -201,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`") @@ -275,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: ... @@ -379,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 9b91d7e..957b8da 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 @@ -55,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: ... @@ -119,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/_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/_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/_version.py b/src/onebusaway/_version.py index 0812d58..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.3" # x-release-please-version \ No newline at end of file +__version__ = "1.8.3" # x-release-please-version diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 3482e97..0a958d2 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -1,60 +1,397 @@ # 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 +__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 2fa6042..f543a88 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -4,23 +4,21 @@ 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"] + class AgenciesWithCoverageResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: @@ -41,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: @@ -79,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 @@ -105,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 @@ -113,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 @@ -121,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 2d8da26..9141792 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -4,23 +4,21 @@ 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"] + class AgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgencyResourceWithRawResponse: @@ -41,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. @@ -63,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: @@ -92,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. @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) + class AsyncAgencyResourceWithRawResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency @@ -139,6 +144,7 @@ def __init__(self, agency: AsyncAgencyResource) -> None: agency.retrieve, ) + class AgencyResourceWithStreamingResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -147,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 7bba1a2..8323a51 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -2,35 +2,32 @@ 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"] + class ArrivalAndDepartureResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ArrivalAndDepartureResourceWithRawResponse: @@ -51,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 @@ -78,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 @@ -124,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: @@ -157,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 @@ -184,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 @@ -230,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 @@ -254,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 @@ -265,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 @@ -276,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 @@ -285,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 ec955eb..cbee583 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -4,23 +4,21 @@ 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"] + class BlockResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BlockResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) + class AsyncBlockResourceWithRawResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block @@ -139,6 +144,7 @@ def __init__(self, block: AsyncBlockResource) -> None: block.retrieve, ) + class BlockResourceWithStreamingResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -147,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 29269b8..4b3de23 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -4,23 +4,21 @@ 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"] + class ConfigResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigResourceWithRawResponse: @@ -41,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: @@ -76,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 @@ -99,6 +107,7 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) + class AsyncConfigResourceWithRawResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config @@ -107,6 +116,7 @@ def __init__(self, config: AsyncConfigResource) -> None: config.retrieve, ) + class ConfigResourceWithStreamingResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -115,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 5dfc9bc..1dcc9a8 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -4,23 +4,21 @@ 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"] + class CurrentTimeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CurrentTimeResourceWithRawResponse: @@ -41,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: @@ -76,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 @@ -99,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 @@ -107,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 @@ -115,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 34f4c72..d1614f6 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -2,30 +2,30 @@ 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"] + class ReportProblemWithStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: @@ -46,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 @@ -83,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: @@ -118,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 @@ -155,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 @@ -178,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 @@ -186,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 @@ -194,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 668f903..d0f9733 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -2,30 +2,30 @@ 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"] + class ReportProblemWithTripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: @@ -46,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. @@ -98,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: @@ -138,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. @@ -190,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 @@ -218,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 @@ -226,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 @@ -234,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 5b420e8..62ae14a 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -4,23 +4,21 @@ 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"] + class RouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteResourceWithRawResponse: @@ -41,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. @@ -63,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: @@ -92,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. @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) + class AsyncRouteResourceWithRawResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route @@ -139,6 +144,7 @@ def __init__(self, route: AsyncRouteResource) -> None: route.retrieve, ) + class RouteResourceWithStreamingResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -147,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 6f21ee9..e5ddfa3 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -4,23 +4,21 @@ 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"] + class RouteIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,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 @@ -139,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 @@ -147,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 dd9306e..ff7a8cd 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -4,23 +4,21 @@ 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"] + class RoutesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,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 @@ -139,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 @@ -147,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 7743b84..d315909 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,26 +4,26 @@ 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"] + class RoutesForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: @@ -44,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 @@ -72,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: @@ -103,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 @@ -131,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 @@ -150,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 @@ -158,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 @@ -166,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 66c6a54..3d5509d 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -2,32 +2,31 @@ 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"] + class ScheduleForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: @@ -48,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 @@ -74,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: @@ -105,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 @@ -131,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 @@ -150,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 @@ -158,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 @@ -166,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 5c71e9c..78b4d36 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -2,32 +2,31 @@ 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"] + class ScheduleForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: @@ -48,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 @@ -74,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: @@ -105,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 @@ -131,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 @@ -150,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 @@ -158,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 @@ -166,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 37f7cb4..fe1d9a2 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -4,26 +4,26 @@ 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"] + class SearchForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: @@ -44,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. @@ -72,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: @@ -99,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. @@ -127,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 @@ -142,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 @@ -150,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 @@ -158,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 a0320a3..8efb8ad 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -4,26 +4,26 @@ 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"] + class SearchForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForStopResourceWithRawResponse: @@ -44,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. @@ -72,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: @@ -99,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. @@ -127,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 @@ -142,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 @@ -150,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 @@ -158,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 ddc989f..0b4c291 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -4,23 +4,21 @@ 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"] + class ShapeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ShapeResourceWithRawResponse: @@ -41,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. @@ -63,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: @@ -92,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. @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) + class AsyncShapeResourceWithRawResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape @@ -139,6 +144,7 @@ def __init__(self, shape: AsyncShapeResource) -> None: shape.retrieve, ) + class ShapeResourceWithStreamingResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -147,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 ba53226..502f8ce 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -4,23 +4,21 @@ 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"] + class StopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) + class AsyncStopResourceWithRawResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop @@ -139,6 +144,7 @@ def __init__(self, stop: AsyncStopResource) -> None: stop.retrieve, ) + class StopResourceWithStreamingResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -147,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 55a39cd..3850d16 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -4,23 +4,21 @@ 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"] + class StopIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,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 @@ -139,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 @@ -147,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 9e09796..834ab5c 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -4,23 +4,21 @@ 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"] + class StopsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForAgencyResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,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 @@ -139,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 @@ -147,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 b589d59..80322e3 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,26 +4,26 @@ 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"] + class StopsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: @@ -44,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 @@ -80,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: @@ -111,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 @@ -147,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 @@ -166,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 @@ -174,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 @@ -182,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 454b725..36f7514 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -4,26 +4,26 @@ 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"] + class StopsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForRouteResourceWithRawResponse: @@ -44,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 @@ -72,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: @@ -104,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 @@ -132,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 @@ -152,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 @@ -160,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 @@ -168,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 e5a9bb5..9b7e137 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -4,23 +4,21 @@ 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"] + class TripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripResourceWithRawResponse: @@ -41,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 @@ -63,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: @@ -92,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 @@ -114,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 @@ -131,6 +135,7 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) + class AsyncTripResourceWithRawResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip @@ -139,6 +144,7 @@ def __init__(self, trip: AsyncTripResource) -> None: trip.retrieve, ) + class TripResourceWithStreamingResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -147,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 cbbb057..71092c9 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -4,26 +4,26 @@ 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"] + class TripDetailsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripDetailsResourceWithRawResponse: @@ -44,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 @@ -84,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: @@ -119,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 @@ -159,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 @@ -182,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 @@ -190,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 @@ -198,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 4327fc7..4417b48 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -4,26 +4,26 @@ 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"] + class TripForVehicleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: @@ -44,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 @@ -81,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: @@ -115,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 @@ -152,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 @@ -174,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 @@ -182,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 @@ -190,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 ab7ba23..84958f9 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,26 +4,26 @@ 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"] + class TripsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: @@ -44,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 @@ -89,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: @@ -121,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 @@ -166,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 @@ -186,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 @@ -194,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 @@ -202,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 690ea60..a5ca21d 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -4,26 +4,26 @@ 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"] + class TripsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: @@ -44,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. @@ -76,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: @@ -109,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. @@ -141,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 @@ -162,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 @@ -170,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 @@ -178,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 4126bb6..3f8697d 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -4,26 +4,26 @@ 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"] + class VehiclesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: @@ -44,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 @@ -69,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: @@ -100,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 @@ -125,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 @@ -144,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 @@ -152,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 @@ -160,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/__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..13f182b 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -1,35 +1,39 @@ # 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", +] -__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 037963c..61d8e79 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -1,18 +1,16 @@ # 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): id: str @@ -26,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 8205ce6..fd1f0c0 100644 --- a/src/onebusaway/types/arrival_and_departure_list_params.py +++ b/src/onebusaway/types/arrival_and_departure_list_params.py @@ -2,20 +2,15 @@ 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.""" @@ -23,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 87f8287..cbabf18 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -1,17 +1,23 @@ # 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", +] -__all__ = ["ArrivalAndDepartureListResponse", "ArrivalAndDepartureListResponseData", "ArrivalAndDepartureListResponseDataEntry", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition"] class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -20,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.""" @@ -27,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 @@ -67,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. @@ -79,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). @@ -91,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). @@ -112,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 1bddc55..3451b73 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_params.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_params.py @@ -2,16 +2,13 @@ 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): service_date: Required[Annotated[int, PropertyInfo(alias="serviceDate")]] @@ -21,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 78120ae..a0bc771 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -1,17 +1,22 @@ # 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", +] -__all__ = ["ArrivalAndDepartureRetrieveResponse", "ArrivalAndDepartureRetrieveResponseData", "ArrivalAndDepartureRetrieveResponseDataEntry", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition"] class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -20,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.""" @@ -27,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 @@ -67,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. @@ -79,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). @@ -91,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). @@ -112,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 ceb636d..aecb822 100644 --- a/src/onebusaway/types/block_retrieve_response.py +++ b/src/onebusaway/types/block_retrieve_response.py @@ -1,63 +1,77 @@ # 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", +] -__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 ace5e26..eaa7cf9 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -1,74 +1,82 @@ # 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", +] -__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 80fc92a..20fddb2 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 .._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): - 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 6889773..609f03f 100644 --- a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -2,16 +2,13 @@ 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): 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""" @@ -26,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 94dc84e..f55386d 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -2,18 +2,22 @@ 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): - 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")] @@ -41,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 33d3468..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,24 +1,23 @@ # 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): - 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 f5ca95a..a0dfa1e 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -1,22 +1,20 @@ # 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): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -24,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 949b1ff..672141d 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -1,22 +1,20 @@ # 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): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -24,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 cfabb8c..033ec2a 100644 --- a/src/onebusaway/types/routes_for_location_list_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -2,16 +2,13 @@ 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): lat: Required[float] @@ -23,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 b91a72c..0393f01 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -1,22 +1,24 @@ # 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", +] -__all__ = ["RoutesForLocationListResponse", "RoutesForLocationListResponseData", "RoutesForLocationListResponseDataList"] class RoutesForLocationListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -24,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 6b5fa6b..6d4d029 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -3,22 +3,17 @@ 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): - 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 31d487b..8266786 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -1,15 +1,23 @@ # 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 .._models import BaseModel from .shared.response_wrapper import ResponseWrapper -from typing_extensions import Literal -from pydantic import Field as FieldInfo +__all__ = [ + "ScheduleForRouteRetrieveResponse", + "ScheduleForRouteRetrieveResponseData", + "ScheduleForRouteRetrieveResponseDataEntry", + "ScheduleForRouteRetrieveResponseDataEntryStop", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", + "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", + "ScheduleForRouteRetrieveResponseDataEntryTrip", +] -__all__ = ["ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", "ScheduleForRouteRetrieveResponseDataEntryTrip"] class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): id: str @@ -22,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 2fe81c7..99b89f7 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -3,22 +3,17 @@ 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): - 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 afc6eb7..83d1985 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -1,69 +1,89 @@ # 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", +] -__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 979587c..76f767b 100755 --- a/src/onebusaway/types/search_for_route_list_params.py +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -2,19 +2,16 @@ 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): 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 6c8e481..e54153a 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -1,22 +1,20 @@ # 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): id: str - agency_id: str = FieldInfo(alias = "agencyId") + agency_id: str = FieldInfo(alias="agencyId") type: int @@ -24,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 9cf8c67..012f802 100755 --- a/src/onebusaway/types/search_for_stop_list_params.py +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -2,19 +2,16 @@ 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): 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 1b643cb..502455c 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -1,18 +1,16 @@ # 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): id: str @@ -24,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 d4e9b0d..07a3b6a 100644 --- a/src/onebusaway/types/shape_retrieve_response.py +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -1,18 +1,14 @@ # 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): length: int @@ -21,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 bed6854..8c6deab 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -1,16 +1,31 @@ # 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 -__all__ = ["References", "Agency", "Route", "Situation", "SituationActiveWindow", "SituationAllAffect", "SituationConsequence", "SituationConsequenceConditionDetails", "SituationConsequenceConditionDetailsDiversionPath", "SituationDescription", "SituationPublicationWindow", "SituationSummary", "SituationURL", "Stop", "StopTime", "Trip"] +from ..._models import BaseModel + +__all__ = [ + "References", + "Agency", + "Route", + "Situation", + "SituationActiveWindow", + "SituationAllAffect", + "SituationConsequence", + "SituationConsequenceConditionDetails", + "SituationConsequenceConditionDetailsDiversionPath", + "SituationDescription", + "SituationPublicationWindow", + "SituationSummary", + "SituationURL", + "Stop", + "StopTime", + "Trip", +] + class Agency(BaseModel): id: str @@ -25,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 @@ -44,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.""" @@ -90,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 @@ -108,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.""" @@ -122,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.""" @@ -129,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 @@ -159,6 +193,7 @@ class Situation(BaseModel): url: Optional[SituationURL] = None + class Stop(BaseModel): id: str @@ -170,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] @@ -227,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 fcaf06c..72ecc38 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 typing_extensions import Literal from pydantic import Field as FieldInfo +from ..._models import BaseModel + __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 48489cd..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,24 +1,23 @@ # 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): - 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 eb259c5..6a69553 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -1,18 +1,16 @@ # 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): id: str @@ -24,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 bf131b5..422c5ee 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -1,18 +1,16 @@ # 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"] + class StopsForAgencyListResponseList(BaseModel): id: str @@ -24,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 6137ce8..3174257 100644 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -2,16 +2,13 @@ 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): lat: Required[float] @@ -27,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 f9d4fca..e075eb1 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -1,18 +1,16 @@ # 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): id: str @@ -24,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 cad8058..ddf40d0 100644 --- a/src/onebusaway/types/stops_for_route_list_params.py +++ b/src/onebusaway/types/stops_for_route_list_params.py @@ -2,19 +2,16 @@ 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): 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 cd346b6..53cff4e 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -1,17 +1,23 @@ # 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", +] -__all__ = ["StopsForRouteListResponse", "StopsForRouteListResponseData", "StopsForRouteListResponseDataEntry", "StopsForRouteListResponseDataEntryPolyline", "StopsForRouteListResponseDataEntryStopGrouping", "StopsForRouteListResponseDataEntryStopGroupingName", "StopsForRouteListResponseDataEntryStopGroupingPolyline"] class StopsForRouteListResponseDataEntryPolyline(BaseModel): length: Optional[int] = None @@ -20,6 +26,7 @@ class StopsForRouteListResponseDataEntryPolyline(BaseModel): points: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): name: Optional[str] = None @@ -27,6 +34,7 @@ class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): type: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None @@ -34,6 +42,7 @@ class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None + class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): id: Optional[str] = None @@ -41,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 658d0a6..a8529bf 100644 --- a/src/onebusaway/types/trip_detail_retrieve_params.py +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -2,16 +2,13 @@ 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): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -35,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 1846d1e..4b76689 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -1,42 +1,51 @@ # 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", +] -__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.""" @@ -44,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.""" @@ -51,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 @@ -91,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. @@ -103,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). @@ -115,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). @@ -136,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 325521b..3e8240c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -2,16 +2,13 @@ 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): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -33,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 fab9984..136b96c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -1,42 +1,51 @@ # 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", +] -__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.""" @@ -44,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.""" @@ -51,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 @@ -91,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. @@ -103,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). @@ -115,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). @@ -136,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 37fbab7..152bfa2 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 .._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): 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 6962798..69a9186 100644 --- a/src/onebusaway/types/trips_for_location_list_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -2,16 +2,13 @@ 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): lat: Required[float] """The latitude coordinate of the search center""" @@ -38,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 5e3c087..68ae881 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -1,42 +1,51 @@ # 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", +] -__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.""" @@ -44,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.""" @@ -51,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 @@ -91,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. @@ -103,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). @@ -115,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). @@ -136,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 d3bf43f..c2f7ec0 100644 --- a/src/onebusaway/types/trips_for_route_list_params.py +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -2,16 +2,13 @@ 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): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """Determine whether full schedule elements are included. Defaults to false.""" @@ -23,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 efb7b6e..f9bc2d8 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -1,42 +1,51 @@ # 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", +] -__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.""" @@ -44,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.""" @@ -51,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 @@ -91,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. @@ -103,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). @@ -115,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). @@ -136,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 05937c8..ebf92d1 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_params.py +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -4,12 +4,9 @@ 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): 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 cd8ac35..34601dd 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -1,23 +1,30 @@ # 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", +] -__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.""" @@ -25,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.""" @@ -32,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 @@ -72,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. @@ -84,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). @@ -96,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). @@ -117,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 5b49882..fad1087 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -2,77 +2,71 @@ 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") -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 bdfd649..05b83a8 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -2,103 +2,97 @@ 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") -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 f371046..0ba8109 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -2,29 +2,24 @@ 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") -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: @@ -33,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: @@ -45,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, @@ -57,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: @@ -67,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: @@ -100,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( @@ -144,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: @@ -156,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, @@ -168,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: @@ -178,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: @@ -211,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 0adb879..a07a29b 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -2,103 +2,97 @@ 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") -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 5692c29..62bdd91 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -2,77 +2,71 @@ 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") -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 a43fb0c..1a05528 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -2,77 +2,71 @@ 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") -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 f7a4f54..0b15883 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -2,33 +2,27 @@ 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") -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: @@ -40,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: @@ -94,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 8b23611..0bc9cf2 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -2,33 +2,27 @@ 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") -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: @@ -45,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: @@ -104,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 b27ce01..8b773cf 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -2,103 +2,97 @@ 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") -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 f8ded3c..867c19a 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -2,103 +2,97 @@ 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") -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 225d1f2..1fe2d56 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -2,103 +2,97 @@ 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") -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 35716ba..55fbc31 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -2,26 +2,20 @@ 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") -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: @@ -29,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: @@ -41,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: @@ -91,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 4dd1a1d..6973a7e 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -2,35 +2,28 @@ 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") -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: @@ -38,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: @@ -88,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 ad705cf..0154e44 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -2,35 +2,28 @@ 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") -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: @@ -38,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: @@ -88,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 220353c..76114f6 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -2,33 +2,27 @@ 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") -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: @@ -36,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: @@ -79,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 aa138a1..bed17ea 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -2,33 +2,27 @@ 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") -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: @@ -36,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: @@ -79,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 4ef8019..369da7d 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -2,103 +2,97 @@ 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") -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 eacc5ad..9286176 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -2,103 +2,97 @@ 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") -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 56c9414..923a743 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -2,103 +2,97 @@ 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") -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 71230d1..7c6538e 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -2,103 +2,97 @@ 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") -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 520184f..fcb2f07 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -2,26 +2,20 @@ 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") -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: @@ -29,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: @@ -41,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: @@ -91,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 4e6787a..e062f7d 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -2,33 +2,27 @@ 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") -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: @@ -37,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: @@ -88,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 7c39766..ef2bd7f 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -2,103 +2,97 @@ 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") -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 0db299e..82d00d9 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -2,33 +2,27 @@ 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") -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: @@ -40,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: @@ -94,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 0a2d84f..be96fa6 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -2,33 +2,27 @@ 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") -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: @@ -39,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: @@ -92,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 c3dbfa3..050d552 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -2,26 +2,20 @@ 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") -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: @@ -31,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: @@ -44,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, @@ -57,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: @@ -68,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( @@ -88,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: @@ -101,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, @@ -114,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: @@ -125,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 b301f38..0ef4092 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -2,33 +2,27 @@ 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") -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: @@ -38,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: @@ -90,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 4d2e659..5f201f2 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -2,33 +2,27 @@ 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") -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: @@ -36,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: @@ -86,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 763d201..d166173 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,18 +1,16 @@ 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: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") @@ -32,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 77fac66..3adc176 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,59 +2,53 @@ 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 +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") 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) @@ -62,6 +56,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) @@ -76,7 +71,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 @@ -108,58 +105,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 @@ -167,21 +164,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {} - 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"} @@ -267,7 +264,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 @@ -276,54 +275,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"} @@ -335,7 +350,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {'foo': 'baz', "query_param": "overridden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -418,7 +433,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'bar': '1', 'foo': '2'} + assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -432,7 +447,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'foo': '2'} + assert params == {"foo": "2"} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -471,27 +486,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) @@ -502,6 +519,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 @@ -518,7 +536,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] @@ -526,11 +546,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( @@ -541,7 +575,21 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -552,7 +600,21 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -577,9 +639,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) @@ -596,7 +658,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: @@ -608,7 +672,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) @@ -616,26 +680,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) @@ -643,7 +707,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) @@ -651,7 +715,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 @@ -661,7 +729,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 @@ -674,7 +746,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) @@ -685,7 +757,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) @@ -700,10 +772,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) @@ -718,18 +787,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) @@ -744,9 +810,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) @@ -763,7 +831,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 @@ -795,58 +865,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 @@ -854,21 +924,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {} - 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"} @@ -954,7 +1024,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 @@ -963,54 +1035,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) assert dict(url.params) == {"query_param": "bar"} @@ -1022,7 +1110,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {'foo': 'baz', "query_param": "overridden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1105,7 +1193,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'bar': '1', 'foo': '2'} + assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -1119,7 +1207,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {'foo': '2'} + assert params == {"foo": "2"} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1158,27 +1246,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) @@ -1189,6 +1279,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 @@ -1205,7 +1296,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] @@ -1213,11 +1306,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( @@ -1228,7 +1335,21 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -1239,7 +1360,21 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ) assert request.url == "http://localhost:5000/custom/path/foo" - @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( @@ -1265,9 +1400,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) @@ -1285,7 +1420,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 @@ -1298,7 +1435,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) @@ -1306,26 +1443,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: @@ -1334,7 +1471,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) @@ -1342,7 +1479,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 @@ -1352,7 +1493,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 @@ -1366,7 +1511,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) @@ -1377,7 +1522,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) @@ -1393,10 +1538,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) @@ -1411,19 +1553,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) @@ -1438,9 +1579,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 @@ -1476,17 +1617,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) \ No newline at end of file + 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 bf935ac8d9a26d5edda67ad6baa3f3f47d29a190 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 209/376] 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 24b92a9fde8039b56efaca37a3c73eaaa8f8728c 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 210/376] 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 b4580cd050631db064d84eb18c1b26871d2589ba 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 211/376] 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 fdfb395f7dc4eb1b72fbc7d6d3fc2ae23b3e3fce 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 212/376] 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 9e85c2f9abd1011d339c078555687e435200d53e 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 213/376] 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 cae551a42c0ac040fbd0c51d2e3315ffc8a60452 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:57:51 +0000 Subject: [PATCH 214/376] feat(client): support digest authentication --- src/onebusaway/_client.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 603a340..2847299 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -196,10 +196,6 @@ def __init__( def qs(self) -> Querystring: return Querystring(array_format="repeat") - @property - def auth_headers(self) -> httpx.Auth: - raise NotImplementedError("This auth method has not been implemented yet.") - @property @override def default_headers(self) -> dict[str, str | Omit]: @@ -425,10 +421,6 @@ def __init__( def qs(self) -> Querystring: return Querystring(array_format="repeat") - @property - def auth_headers(self) -> httpx.Auth: - raise NotImplementedError("This auth method has not been implemented yet.") - @property @override def default_headers(self) -> dict[str, str | Omit]: From 832a5dd349a620c1aa739f0071cbd882f256ca88 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 215/376] chore(internal): update pyright settings --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 0051400..6892228 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,6 +147,7 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false From cf38011e404bb70fc2e754f176b09eaa54e0c724 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 216/376] 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 d9f6219f1d5bedbaf375b1ff64718667df0eb5d8 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 217/376] 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 6892228..a277a0d 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 701c84a7ce2aca71896de2302b59a5ce0abc1a43 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 218/376] 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 0443eed8a79c2c267897c03eb8bfe460a1ee4add 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 219/376] 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 94f8b9f78ec07d75e11bae504ca45d9b5fe1136f 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 220/376] 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 ddf91dc355b06312b20e59e6a993aa55094e6fe6 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 221/376] 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 2847299..03ce03c 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 71a68ab12029086d165a8eda55ee29d6af0ff3c8 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 222/376] 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 4c64558bdaa91398e1607104da42db1c56694161 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 223/376] 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 fab4b696b094ee4e385c8a74710192b9b3852b70 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 224/376] 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 49dad90a83d9d45871bee3e7d02b75093ec5fac6 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 225/376] 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 53f92967f69f20c1af359371ebcc58d0372513d2 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 226/376] 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 8bf6d88d869028b0c5208525ec8b9905164375e4 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 227/376] 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 12ef784fd5bba368006b1e432c00cba8d9e9a301 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 228/376] 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 82a2e3fe9c276eeae47ba9d259338e63dd90c20c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 15:29:07 +0000 Subject: [PATCH 229/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/pyproject.toml b/pyproject.toml index a277a0d..25daf6c 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 86f2c8bb116adce0fc0f31e67ffe5fb8888dddb7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 17:22:46 +0000 Subject: [PATCH 230/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/pyproject.toml b/pyproject.toml index 25daf6c..f288fa5 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 6d4e6e936aa585b34f81623c09f628cdb98dab06 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 19:07:54 +0000 Subject: [PATCH 231/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/pyproject.toml b/pyproject.toml index f288fa5..aaa6710 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 b3ae378093a33aacb73e6c0c4562f85b01991399 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:50:25 +0000 Subject: [PATCH 232/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 0f02bfba9c7cf5ad5bb72679fc134913404d0104 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 233/376] 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 1c3c700219b7f8a2cfcade65db4cd49e9e541285 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:22:18 +0000 Subject: [PATCH 234/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a59232b39bb761648659ac6af86521f525b462d5 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 235/376] 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 c517e1ea540130fde2d526dc69c91fa207a92dad 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:51:23 +0000 Subject: [PATCH 236/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 75b380775b412945e239b5e49a274b058fbcc133 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 237/376] 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 5d17e888ea475c932760a7fa9ef3d050758ee797 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 238/376] 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 fa9a8fcbdff16adc129981d29cb968942593521a 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 239/376] 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 35702006038e13a014ee4fb61c7eefa08ee9d0c9 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 240/376] 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 03ce03c..04724a3 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -262,6 +262,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, @@ -487,6 +490,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 c76d4c5f707aa86dd93fd102f6d360dc8f89040e 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:33:13 +0000 Subject: [PATCH 241/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 885a73473697bfb60a8a1d06387580a48416dea9 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 242/376] 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 b36bba59b72191b49707f8a7682661bda2286395 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 21:50:32 +0000 Subject: [PATCH 243/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 717655f3e98ffe45b038f416405deaf9373f9691 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 244/376] 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 4936b15a74bde7488029c2f900d1916dcf220321 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 245/376] 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 3adc176..b0c6917 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -814,6 +814,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) @@ -1627,3 +1654,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 fc4ba64554815ce71a2a00b3b94f2be476b40499 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 15:13:13 +0000 Subject: [PATCH 246/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 eb2eac3c5bbbcbf076fd0ae28cc8dffd82d2bdd2 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 247/376] 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 2863934b7b7a21d2229faa27673e88c834b41f98 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 248/376] 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 4fd8bdbf947f4e8fbbb85f03d410c4341cec9fad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 17:26:50 +0000 Subject: [PATCH 249/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9bfa628b1a1709147f17cca4d7f1676a9f8f4b23 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 250/376] 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 b0c6917..c4d9f6b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -30,6 +30,8 @@ DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + DefaultHttpxClient, + DefaultAsyncHttpxClient, make_request_options, ) @@ -814,6 +816,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 @@ -1655,6 +1679,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 5c06217a972d6abcfc3771b53c4087b3a3850bce 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 251/376] 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 8b23131049daaeab4a1a0a112c02f49a69b1e3ed 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 252/376] 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 d97343cfca04e7b75a448a297cd0b0ed2e7c8def 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 253/376] chore(readme): update badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdf835f..c6b6c35 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+ application. The library includes type definitions for all request params and response fields, From f0929be016e65166fdb4c34dccfd98d414f1ded0 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 254/376] 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 c4d9f6b..6b0fe80 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -24,7 +24,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, @@ -713,30 +712,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]) @@ -1526,30 +1516,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 e76b1c515a7541a6b214e57c6445f03f98cd9f43 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 255/376] 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 c6b6c35..62a470b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,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 62043025b012bb312bc737d58ed299fd2c56e94b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 00:47:20 +0000 Subject: [PATCH 256/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 23ab05ebcb1ae236c864d7ace7906570a5ebf4a2 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 257/376] 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 62a470b..9b14be0 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,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 7a22abf525e82a16fc0e85c6ed22d2f5aadea326 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 258/376] 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 6b0fe80..0379571 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -191,6 +191,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") @@ -991,6 +992,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 e457dd9029bb1bbf49b63fd2bd0c7de49bfb3f1b 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 259/376] =?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 908145701b9c28b1ea29b226ad08ef06484c9249 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 19:54:54 +0000 Subject: [PATCH 260/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 cb59f729a2f5a993d1f9d03e6989aa9412ce9596 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 261/376] 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 7cf7aa5b1fe2fa44b299ff10148d022fe2c1fde7 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 262/376] 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 cf5954e557d8519225bb9715e6c757a10fc4092e 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 263/376] 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 6070e446ebb60e27540fc22605583378c8aa94ac 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 264/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- requirements-dev.lock | 2 +- requirements.lock | 2 +- src/onebusaway/_version.py | 2 +- 5 files changed, 5 insertions(+), 5 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/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/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 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 23fee824c10087a4260575537adc64a0184fdc98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 6 Jul 2025 15:08:43 +0000 Subject: [PATCH 265/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 ba7975d32473cc5251a7c74cce568acb7c4b67e9 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 266/376] 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 1f2040615ac2931276be76e34ce24285ac62fde7 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 267/376] 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 4493fd6eab730dcdbe413c1b6706db2db86f7b65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:31:21 +0000 Subject: [PATCH 268/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9fe6f502e0353b44d8bae11473150286f342320e 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 269/376] 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 5a0250828fb8a92e1d6ca20389e9a24ea4d41d93 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:17:47 +0000 Subject: [PATCH 270/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 622abbc05ac4e43734542367d77f602d91c2c477 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 271/376] 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 9b14be0..329227a 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+ application. The library includes type definitions for all request params and response fields, From 7c49fa066566aee97381ceec3b55c262b47253ec 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 272/376] 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 0379571..cbbed28 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -454,7 +454,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"]}, @@ -1255,7 +1255,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 378543e595fe80eabd7651179b4a22cf604d7da9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 15:03:57 +0000 Subject: [PATCH 273/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 f3fe8bb3e1d711bde41854d8cb588eb24b51e581 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 274/376] 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 329227a..22aaf94 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,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 @@ -85,7 +84,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 684266755b4aaacd778290256f3e4fec3073bffc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 21:15:54 +0000 Subject: [PATCH 275/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a90a5d575a931c14b701286d75eab6b1156b0680 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 276/376] 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 ce897ff0e78c8b0aea9a796ef869c83a0dfeb8ae 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 277/376] 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 597e1c48e237dae2abc78fc8a79bc5623015345e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 13:03:10 +0000 Subject: [PATCH 278/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 11a594c8055ea3aae46ab69cd7ad3ea2ebdc4b99 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 279/376] 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 610fc6069adf97ed0f313d93f9626f6096450936 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 11:07:00 +0000 Subject: [PATCH 280/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9495112a03dc7e61210b2ecf20c479e70e58d82f 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 281/376] 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 59e887cdebbdb3d964e0a8590dbbed1bc09183ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 19:27:46 +0000 Subject: [PATCH 282/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 9daba38268c6ec8ecc51b68b659c21356767f481 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 283/376] 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 aa935d418b9a4bae6d8955927d7b54e893b7e679 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 20:51:20 +0000 Subject: [PATCH 284/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 110c724e5e4d5b2661edd31d605e308c9bdc8c39 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 285/376] 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 54b9942fd73dbf448d5177f6173421779e8cb2af 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 286/376] 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 dfb739b6c6df8868bdad206d70046f12feb90f31 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 287/376] 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 b98a97cbaba8944a8cc1bda2c7f3506aa1672978 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 288/376] 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 e593fdc1e0e92e05cf514ac3aa4e8104e519430d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 19:16:36 +0000 Subject: [PATCH 289/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index daf6a33..9e39cab 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.1" + ".": "1.15.3" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f8573c9..8c71cd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.15.1" +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 08dc048..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.1" # x-release-please-version +__version__ = "1.15.3" # x-release-please-version From 5040272a53fb380abc71b4e4637932f51bc44e90 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 290/376] 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 a371e264d2820cbf89b958ee6c09b1c583e665f1 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 291/376] 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 d9576f3edfbc9f33fd18317e462ce82c8a09a0e6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:45:26 +0000 Subject: [PATCH 292/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a302a4ca09133cfab5a415b10794171307113aa1 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 293/376] 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 764db1ae1b1c848a71f6d3f685a6e30e94c1a693 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 00:11:55 +0000 Subject: [PATCH 294/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a0c9d57b749b5c039cb44013ddce0a326fc5a8fb 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 295/376] 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 096ab01507858af4eabed40886ef26271f8e117f 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:09:06 +0000 Subject: [PATCH 296/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 53b69c479912bcc72683933a308feb1d597e5bfe 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 297/376] 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 6faeb6499eb694e9f9c31e20dd1f7b8defa3ef39 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 12:26:24 +0000 Subject: [PATCH 298/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 d0536104a334d430b7c5cdb7ec534d8f78971d99 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 299/376] 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 42b14c6fae0418732f0000719b4526d1bafc7d77 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 300/376] 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 cbbed28..f32d15a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,13 +6,10 @@ import os import sys import json -import time 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 @@ -23,14 +20,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, ) @@ -1621,50 +1621,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 3ca0069f9dd84537ebf4a76d570520de084cbb57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 20:33:05 +0000 Subject: [PATCH 301/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 f0e5aac9a134c844ac7fabd4373dddff2a861bca 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 302/376] 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 7d4e5eca99ef84341420e1f8b1558f60e096a3f3 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 303/376] 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 04724a3..d78330c 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, @@ -216,9 +216,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, @@ -339,7 +339,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, @@ -444,9 +444,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 21d936040542ccc7c8d87aced4145e1807a8d8f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 23:02:47 +0000 Subject: [PATCH 304/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 34892db8c0f851cc6834ea6c021db6f618547c4d 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 305/376] 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 d25f52ef0638e789e540e309b21d0806c778e34d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 20:22:46 +0000 Subject: [PATCH 306/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 eb676a2b45f5e3c1284b22998b0f0ba6e98b529b 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 307/376] 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 4451ecaf52550050393e45ea29dfd73ba4670d07 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 20:50:14 +0000 Subject: [PATCH 308/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 1c6ed39c6fbc89eaf9f39d4da4c12180b92febb1 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 309/376] 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 c8446af65490c6267094348f570d55021e5ee137 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Oct 2025 21:56:01 +0000 Subject: [PATCH 310/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 472c09a597bc9dee058c3d3228a2e1bf08c17ff7 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 311/376] 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 4be43a653d952692f06fc0973f8b8eda9210a5b1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 16:33:47 +0000 Subject: [PATCH 312/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 48c639b1c339b5526f3f469303033773b2afc34c 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 313/376] 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 5cca55b829bfe2abd48147cffadd24c9364fa973 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 04:13:55 +0000 Subject: [PATCH 314/376] chore(internal/tests): avoid race condition with implicit client cleanup --- tests/test_client.py | 368 ++++++++++++++++++++++++------------------- 1 file changed, 204 insertions(+), 164 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index f32d15a..a341782 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -59,51 +59,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( @@ -138,6 +136,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( @@ -175,13 +174,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - 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(): @@ -192,12 +193,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) @@ -254,14 +255,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) @@ -274,6 +273,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: @@ -285,6 +286,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( @@ -295,6 +298,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( @@ -305,6 +310,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: @@ -316,14 +323,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, @@ -332,10 +339,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"} @@ -354,8 +364,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - 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", @@ -366,7 +378,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", @@ -377,7 +389,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", @@ -388,8 +400,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", @@ -399,7 +411,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", @@ -410,8 +422,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", @@ -424,7 +436,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # 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", @@ -438,7 +450,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -481,7 +493,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 @@ -490,12 +502,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): @@ -506,18 +518,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 """ @@ -533,7 +547,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 @@ -547,6 +561,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) @@ -576,6 +592,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -601,6 +618,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -626,35 +644,36 @@ def test_absolute_request_url(self, client: OnebusawaySDK) -> None: ), ) assert request.url == "https://myapi.com/foo" + 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) @@ -676,11 +695,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", [ @@ -703,9 +725,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) @@ -719,7 +741,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) @@ -728,7 +750,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) @@ -830,83 +852,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"} ) @@ -939,8 +955,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"} ) @@ -976,13 +993,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(): @@ -993,12 +1012,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) @@ -1055,12 +1074,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 @@ -1075,6 +1094,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: @@ -1086,6 +1107,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( @@ -1096,6 +1119,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( @@ -1106,6 +1131,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: @@ -1116,15 +1143,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, @@ -1133,11 +1160,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"} ) @@ -1155,8 +1185,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + await client.close() + + def test_request_extra_json(self, client: OnebusawaySDK) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1167,7 +1199,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", @@ -1178,7 +1210,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", @@ -1189,8 +1221,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", @@ -1200,7 +1232,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", @@ -1211,8 +1243,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", @@ -1225,7 +1257,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # 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", @@ -1239,7 +1271,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1282,7 +1314,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 @@ -1291,12 +1323,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): @@ -1307,18 +1341,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 """ @@ -1334,11 +1370,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 ) @@ -1348,7 +1384,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/" @@ -1368,7 +1406,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", @@ -1377,6 +1415,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1393,7 +1432,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", @@ -1402,6 +1441,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1418,7 +1458,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", @@ -1427,37 +1467,39 @@ def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: ), ) assert request.url == "https://myapi.com/foo" + 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) @@ -1468,7 +1510,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 @@ -1480,11 +1521,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", [ @@ -1507,13 +1551,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) @@ -1526,7 +1569,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) @@ -1537,12 +1580,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, @@ -1574,7 +1616,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: @@ -1600,7 +1641,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: @@ -1648,26 +1688,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 324019d6a9e52d477252d2344d1dd42cd3fe316d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 21:51:37 +0000 Subject: [PATCH 315/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e1d5e3cd3d90f0a9f1e35bddcdf12bc30b235990 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 316/376] 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 5597e54d4d8e35a8fff2128ee9b0d845ee26578e 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:03:22 +0000 Subject: [PATCH 317/376] 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 22aaf94..09e5bc1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,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). @@ -353,7 +353,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 09e80b535d5b6fbf76b2dd741fa053aa450d5271 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 318/376] 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 50f3a4c917722c63e5615bfff46a115021a23d4b 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 319/376] 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 8d3eb01c9f5a27475cafea5d08634f7152a03b5e 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 320/376] 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 081390a8bee0992d2f52a7fba4f0f17122568628 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 321/376] 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 ef53c4cfe52afe072b935a6a5e70195190ae9b42 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 322/376] 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 32d46ed42d7ba83201030cba3ade3d87354e5f09 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 323/376] 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 853d72206f3f18d406b6499ed09863d66db9c423 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 324/376] 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 09e5bc1..6012f3b 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,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 @@ -84,7 +85,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 a71f49969aa91e8ccc52bb3f07366e95374a92cd 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 325/376] 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 82bef0562d9468cbf0a77cecbc681123a939a34f 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 326/376] 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 1706f329f5ca47984f82ad325ec8b5b40ece1d56 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 327/376] 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 ccb2d61755a1956cd9849b0ec339297168257451 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 328/376] 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 d78330c..a9e8905 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 @@ -300,37 +445,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 @@ -385,36 +499,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 @@ -528,231 +787,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 c1843405af4d3391a5de42aca7bb1e0c4d29d55a 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 329/376] 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 0df95b59c0829e52adb674ae3ec19fba580cba79 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 330/376] 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 7e6b18eaf280819339c23b18d25a8a01be716a78 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 331/376] 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 c6e082fbcd3d5c3e4bf3ba7a489cca6c38b3acdf 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:13:34 +0000 Subject: [PATCH 332/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a234fe3a7fc384117fa79b272a1476a0e4c68e97 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 333/376] 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 a341782..2230e8c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -8,10 +8,11 @@ import json import asyncio import inspect +import dataclasses import tracemalloc -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 @@ -36,6 +37,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" @@ -50,6 +52,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) @@ -492,6 +545,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): @@ -1313,6 +1430,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 a0680345af54b48b6df3ff037f8a23894a162376 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 05:18:23 +0000 Subject: [PATCH 334/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 ee6c48d7fe4dbd85c6c239e6df66ead836c3303b 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 335/376] 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 fcded54505870b9a729c267691eeda2dac91e039 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:32:54 +0000 Subject: [PATCH 336/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 01ba228a530663149b08b788bded4bcb553eb122 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 337/376] 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 b59aeaa4158ded9e552512aa42f0d0d8b440e9df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 21:03:24 +0000 Subject: [PATCH 338/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 6d3602f14b06591aadcf2ff173c90888d812b99a 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 339/376] 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 f3808e6c2d93e22d058330534c1d026d212c7883 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 17:44:16 +0000 Subject: [PATCH 340/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 6a740dcd2f968c7b942b0b07813e8c07d1cdc293 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 341/376] 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 7c7cbe17c096d1adf581b0b3b27fd5bcde2bade8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 01:05:16 +0000 Subject: [PATCH 342/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 25df8b1e7d898e25e95215e047ba226ea2b96bb5 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 343/376] 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 e9633194076e191a17a1e21eabd5840a8ad566a8 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 344/376] 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 afa5030e5e7ca9ceee5512d00dc5e0724598b59f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:56:10 +0000 Subject: [PATCH 345/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 b9ae02bd5b0ae43268f0956a5ab38f8df3f15f4d 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 346/376] 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 816c35739a89be548ca92c6a0e7f1e2395b7eecd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 17:17:32 +0000 Subject: [PATCH 347/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 7be594709ce90595f35f7d9e801c58cdaef632fe 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 348/376] 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 e1f7e73829cadfa74edf572f39c7c31292d5f57a 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 349/376] 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 2230e8c..21cc3d8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -949,6 +949,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() @@ -1851,6 +1853,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 3ce7f02260c4619ae3c897398e1d10541f3fc8f0 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 350/376] 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 21cc3d8..6767766 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -949,8 +949,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() @@ -1853,8 +1859,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 ee3d9dca205c426c46516ab78ebf0a7ec7c6faa9 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:04 +0000 Subject: [PATCH 351/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 6e61dc57aa6299094d87b71f9e8f6661d430328c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 07:47:53 +0000 Subject: [PATCH 352/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 09af8b95bd0057ca3303c3ba85c9350388f2c657 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 353/376] 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 f5325f207ca72c029717843ac6eb8a227cd44b8f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 02:56:58 +0000 Subject: [PATCH 354/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 c0891de0d3618d31dfca99ea2354a4777d699e40 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 355/376] 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 55d96042d65fb932057b68c60594fc55d7c37d53 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 02:11:24 +0000 Subject: [PATCH 356/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 53be9fbd2410bc6ef2f8fb0e57f34d14b03a4bfe 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 357/376] 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 3eb9a7c1d5da9f45ffb64974cf0dfc3f6264f6ca 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 358/376] 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 434dda1ba5dafcea472250e27d70f8a7a990db34 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:51:11 +0000 Subject: [PATCH 359/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 e0fffb4b1acb2c2678a2c453d2332f146bb0ef39 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 360/376] 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 ac8e41af1e72e6e8924237fb1787618f0ef6ae9a 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:37:09 +0000 Subject: [PATCH 361/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 bf57970a34a7c34b5145c0f7dbfd8d56c03b8ea8 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 362/376] 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 1d6027279017fbfae6eb33559dec07bd734a9528 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2026 04:37:30 +0000 Subject: [PATCH 363/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 bd383376784a5e5f0a896b485abf6e06dabfc56e 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 364/376] 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 4cc4db5c146156cdedbdc19f3d354542c2917a6f 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 365/376] 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 b54cd1f98301f7d760053c59553289a83f74db48 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 366/376] 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 565de94f00371246c3d75d3568713ce17d64a0d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 22:03:53 +0000 Subject: [PATCH 367/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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 a12790d3dade85c0ba10b2a0f5f6a5cf4961455b 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 368/376] 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 36019bb3cf54422c1837bbf23365602317ec8fa4 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 369/376] 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 5fd4e3adef992b60c0e3e7b2689d9fa5eaa8e606 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 370/376] 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 cb1f9f89d720529e44adb0f59ccdcda724811719 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 371/376] 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 69a9b02744981d8e78b4d96e6d58834c9425da9d 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 372/376] 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 3c80755c5ea80f84e75ee047bb1a37ff7ba63f62 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 373/376] 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 13b0f101f07c874be0ded36ed9bed35684f65917 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 374/376] 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 7d52d48167fac00e51fb622a101879fa9737026d 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 375/376] 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 b8474b8906a7277acd56b736798f289547fa54b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 06:53:50 +0000 Subject: [PATCH 376/376] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 3 files changed, 3 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/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