From 71f8ac8808bc984dc772435e3dd25fb851a27156 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:05:13 +0000 Subject: [PATCH 01/23] feat(api): OpenAPI spec update via Stainless API (#81) --- .stats.yml | 2 +- api.md | 24 +-- src/onebusaway/_client.py | 24 +-- src/onebusaway/resources/__init__.py | 28 +-- .../resources/agencies_with_coverage.py | 113 ----------- src/onebusaway/resources/trips_for_route.py | 188 +++++++++++++++++ src/onebusaway/types/__init__.py | 5 +- ...gencies_with_coverage_retrieve_response.py | 39 ---- .../types/agency_retrieve_response.py | 4 +- .../arrival_and_departure_list_response.py | 96 ++++----- ...arrival_and_departure_retrieve_response.py | 96 ++++----- .../types/trip_detail_retrieve_response.py | 96 ++++----- .../trip_for_vehicle_retrieve_response.py | 96 ++++----- .../trips_for_location_retrieve_response.py | 153 ++++++++++++++ .../types/trips_for_route_list_params.py | 23 +++ .../types/trips_for_route_list_response.py | 190 ++++++++++++++++++ .../vehicles_for_agency_list_response.py | 100 ++++----- .../test_agencies_with_coverage.py | 72 ------- tests/api_resources/test_trips_for_route.py | 118 +++++++++++ 19 files changed, 953 insertions(+), 514 deletions(-) delete mode 100644 src/onebusaway/resources/agencies_with_coverage.py create mode 100644 src/onebusaway/resources/trips_for_route.py delete mode 100644 src/onebusaway/types/agencies_with_coverage_retrieve_response.py create mode 100644 src/onebusaway/types/trips_for_route_list_params.py create mode 100644 src/onebusaway/types/trips_for_route_list_response.py delete mode 100644 tests/api_resources/test_agencies_with_coverage.py create mode 100644 tests/api_resources/test_trips_for_route.py diff --git a/.stats.yml b/.stats.yml index c040587..91dcce8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml diff --git a/api.md b/api.md index a0341c8..1fb8d95 100644 --- a/api.md +++ b/api.md @@ -4,18 +4,6 @@ from onebusaway.types import References, ResponseWrapper ``` -# AgenciesWithCoverage - -Types: - -```python -from onebusaway.types import AgenciesWithCoverageRetrieveResponse -``` - -Methods: - -- client.agencies_with_coverage.retrieve() -> AgenciesWithCoverageRetrieveResponse - # Agency Types: @@ -245,6 +233,18 @@ Methods: - client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse +# TripsForRoute + +Types: + +```python +from onebusaway.types import TripsForRouteListResponse +``` + +Methods: + +- client.trips_for_route.list(route_id, \*\*params) -> TripsForRouteListResponse + # ReportProblemWithStop Methods: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e981b14..21660e9 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -46,7 +46,6 @@ class OnebusawaySDK(SyncAPIClient): - agencies_with_coverage: resources.AgenciesWithCoverageResource agency: resources.AgencyResource vehicles_for_agency: resources.VehiclesForAgencyResource config: resources.ConfigResource @@ -66,6 +65,7 @@ class OnebusawaySDK(SyncAPIClient): trips_for_location: resources.TripsForLocationResource trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource + trips_for_route: resources.TripsForRouteResource report_problem_with_stop: resources.ReportProblemWithStopResource report_problem_with_trip: resources.ReportProblemWithTripResource search_for_stop: resources.SearchForStopResource @@ -129,7 +129,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self) self.agency = resources.AgencyResource(self) self.vehicles_for_agency = resources.VehiclesForAgencyResource(self) self.config = resources.ConfigResource(self) @@ -149,6 +148,7 @@ def __init__( self.trips_for_location = resources.TripsForLocationResource(self) self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) + self.trips_for_route = resources.TripsForRouteResource(self) self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) self.search_for_stop = resources.SearchForStopResource(self) @@ -272,7 +272,6 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): - agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -292,6 +291,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trips_for_location: resources.AsyncTripsForLocationResource trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource + trips_for_route: resources.AsyncTripsForRouteResource report_problem_with_stop: resources.AsyncReportProblemWithStopResource report_problem_with_trip: resources.AsyncReportProblemWithTripResource search_for_stop: resources.AsyncSearchForStopResource @@ -355,7 +355,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self) self.agency = resources.AsyncAgencyResource(self) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self) self.config = resources.AsyncConfigResource(self) @@ -375,6 +374,7 @@ def __init__( self.trips_for_location = resources.AsyncTripsForLocationResource(self) self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) + self.trips_for_route = resources.AsyncTripsForRouteResource(self) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) self.search_for_stop = resources.AsyncSearchForStopResource(self) @@ -499,9 +499,6 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) self.agency = resources.AgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithRawResponse(client.config) @@ -521,6 +518,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = resources.TripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -535,9 +533,6 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.AsyncConfigResourceWithRawResponse(client.config) @@ -559,6 +554,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -573,9 +569,6 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) self.agency = resources.AgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithStreamingResponse(client.config) @@ -599,6 +592,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = resources.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) @@ -613,9 +607,6 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse( client.vehicles_for_agency @@ -651,6 +642,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index ddb6e30..1778a99 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -88,6 +88,14 @@ StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse, ) +from .trips_for_route import ( + TripsForRouteResource, + AsyncTripsForRouteResource, + TripsForRouteResourceWithRawResponse, + AsyncTripsForRouteResourceWithRawResponse, + TripsForRouteResourceWithStreamingResponse, + AsyncTripsForRouteResourceWithStreamingResponse, +) from .search_for_route import ( SearchForRouteResource, AsyncSearchForRouteResource, @@ -184,14 +192,6 @@ ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse, ) -from .agencies_with_coverage import ( - AgenciesWithCoverageResource, - AsyncAgenciesWithCoverageResource, - AgenciesWithCoverageResourceWithRawResponse, - AsyncAgenciesWithCoverageResourceWithRawResponse, - AgenciesWithCoverageResourceWithStreamingResponse, - AsyncAgenciesWithCoverageResourceWithStreamingResponse, -) from .report_problem_with_stop import ( ReportProblemWithStopResource, AsyncReportProblemWithStopResource, @@ -210,12 +210,6 @@ ) __all__ = [ - "AgenciesWithCoverageResource", - "AsyncAgenciesWithCoverageResource", - "AgenciesWithCoverageResourceWithRawResponse", - "AsyncAgenciesWithCoverageResourceWithRawResponse", - "AgenciesWithCoverageResourceWithStreamingResponse", - "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", @@ -330,6 +324,12 @@ "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", + "TripsForRouteResource", + "AsyncTripsForRouteResource", + "TripsForRouteResourceWithRawResponse", + "AsyncTripsForRouteResourceWithRawResponse", + "TripsForRouteResourceWithStreamingResponse", + "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py deleted file mode 100644 index 60fa85e..0000000 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ /dev/null @@ -1,113 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.agencies_with_coverage_retrieve_response import AgenciesWithCoverageRetrieveResponse - -__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] - - -class AgenciesWithCoverageResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: - return AgenciesWithCoverageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: - return AgenciesWithCoverageResourceWithStreamingResponse(self) - - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" - return self._get( - "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgenciesWithCoverageRetrieveResponse, - ) - - -class AsyncAgenciesWithCoverageResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: - return AsyncAgenciesWithCoverageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: - return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" - return await self._get( - "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgenciesWithCoverageRetrieveResponse, - ) - - -class AgenciesWithCoverageResourceWithRawResponse: - def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = to_raw_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AsyncAgenciesWithCoverageResourceWithRawResponse: - def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = async_to_raw_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AgenciesWithCoverageResourceWithStreamingResponse: - def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = to_streamed_response_wrapper( - agencies_with_coverage.retrieve, - ) - - -class AsyncAgenciesWithCoverageResourceWithStreamingResponse: - def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: - self._agencies_with_coverage = agencies_with_coverage - - self.retrieve = async_to_streamed_response_wrapper( - agencies_with_coverage.retrieve, - ) diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py new file mode 100644 index 0000000..10364f1 --- /dev/null +++ b/src/onebusaway/resources/trips_for_route.py @@ -0,0 +1,188 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import trips_for_route_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.trips_for_route_list_response import TripsForRouteListResponse + +__all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] + + +class TripsForRouteResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: + return TripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: + return TripsForRouteResourceWithStreamingResponse(self) + + def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/api/where/trips-for-route/{route_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class AsyncTripsForRouteResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: + return AsyncTripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResponse: + return AsyncTripsForRouteResourceWithStreamingResponse(self) + + async def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful for testing. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/api/where/trips-for-route/{route_id}.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class TripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_raw_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_raw_response_wrapper( + trips_for_route.list, + ) + + +class TripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_streamed_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_streamed_response_wrapper( + trips_for_route.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 125bec1..ea300f0 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -12,8 +12,10 @@ from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams +from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse +from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams @@ -46,9 +48,6 @@ from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) -from .agencies_with_coverage_retrieve_response import ( - AgenciesWithCoverageRetrieveResponse as AgenciesWithCoverageRetrieveResponse, -) from .report_problem_with_stop_retrieve_params import ( ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, ) diff --git a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py deleted file mode 100644 index d4db507..0000000 --- a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from .._models import BaseModel -from .shared.references import References -from .shared.response_wrapper import ResponseWrapper - -__all__ = [ - "AgenciesWithCoverageRetrieveResponse", - "AgenciesWithCoverageRetrieveResponseData", - "AgenciesWithCoverageRetrieveResponseDataList", -] - - -class AgenciesWithCoverageRetrieveResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias="agencyId") - - lat: float - - lat_span: float = FieldInfo(alias="latSpan") - - lon: float - - lon_span: float = FieldInfo(alias="lonSpan") - - -class AgenciesWithCoverageRetrieveResponseData(BaseModel): - list: List[AgenciesWithCoverageRetrieveResponseDataList] - - references: References - - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - - -class AgenciesWithCoverageRetrieveResponse(ResponseWrapper): - data: AgenciesWithCoverageRetrieveResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 06000e6..61d8e79 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -36,9 +36,9 @@ class AgencyRetrieveResponseDataEntry(BaseModel): class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - references: References + limit_exceeded: bool = FieldInfo(alias="limitExceeded") - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + references: References class AgencyRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 362df0d..0f40a34 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -36,33 +36,69 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[ ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation ] = FieldInfo(alias="lastKnownLocation", default=None) @@ -71,12 +107,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -86,51 +116,21 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index b9a7507..e3b7d27 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -35,33 +35,69 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -70,12 +106,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -85,51 +115,21 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index d750fe0..f6b5c88 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -65,33 +65,69 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -100,12 +136,6 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -115,51 +145,21 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[TripDetailRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 42fa05e..9e42fbc 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -65,33 +65,69 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -100,12 +136,6 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -115,51 +145,21 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 0864e6d..433dd1d 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -12,16 +12,169 @@ "TripsForLocationRetrieveResponse", "TripsForLocationRetrieveResponseData", "TripsForLocationRetrieveResponseDataList", + "TripsForLocationRetrieveResponseDataListSchedule", + "TripsForLocationRetrieveResponseDataListScheduleStopTime", + "TripsForLocationRetrieveResponseDataListStatus", + "TripsForLocationRetrieveResponseDataListStatusLastKnownLocation", + "TripsForLocationRetrieveResponseDataListStatusPosition", ] +class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): + frequency: Optional[str] = None + + next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + + previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + + stop_times: Optional[List[TripsForLocationRetrieveResponseDataListScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class TripsForLocationRetrieveResponseDataListStatus(BaseModel): + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[TripsForLocationRetrieveResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) + """Last known location of the transit vehicle.""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[TripsForLocationRetrieveResponseDataListStatusPosition] = None + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + class TripsForLocationRetrieveResponseDataList(BaseModel): frequency: Optional[str] = None + schedule: Optional[TripsForLocationRetrieveResponseDataListSchedule] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + status: Optional[TripsForLocationRetrieveResponseDataListStatus] = None + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py new file mode 100644 index 0000000..c2f7ec0 --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["TripsForRouteListParams"] + + +class TripsForRouteListParams(TypedDict, total=False): + include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] + """Determine whether full schedule elements are included. Defaults to false.""" + + include_status: Annotated[bool, PropertyInfo(alias="includeStatus")] + """ + Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + """ + + time: int + """Query the system at a specific time. Useful for testing.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py new file mode 100644 index 0000000..2a3ec1f --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "TripsForRouteListResponse", + "TripsForRouteListResponseData", + "TripsForRouteListResponseDataList", + "TripsForRouteListResponseDataListSchedule", + "TripsForRouteListResponseDataListScheduleStopTime", + "TripsForRouteListResponseDataListStatus", + "TripsForRouteListResponseDataListStatusLastKnownLocation", + "TripsForRouteListResponseDataListStatusPosition", +] + + +class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): + arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + + departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + + distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + + stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class TripsForRouteListResponseDataListSchedule(BaseModel): + frequency: Optional[str] = None + + next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + + previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + + stop_times: Optional[List[TripsForRouteListResponseDataListScheduleStopTime]] = FieldInfo( + alias="stopTimes", default=None + ) + + time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + + +class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class TripsForRouteListResponseDataListStatusPosition(BaseModel): + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class TripsForRouteListResponseDataListStatus(BaseModel): + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( + alias="lastKnownLocation", default=None + ) + """Last known location of the transit vehicle.""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[TripsForRouteListResponseDataListStatusPosition] = None + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + +class TripsForRouteListResponseDataList(BaseModel): + frequency: Optional[str] = None + + schedule: Optional[TripsForRouteListResponseDataListSchedule] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + status: Optional[TripsForRouteListResponseDataListStatus] = None + + trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + + +class TripsForRouteListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[TripsForRouteListResponseDataList] + + references: References + + +class TripsForRouteListResponse(ResponseWrapper): + data: TripsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 8675eda..34601dd 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -42,33 +42,69 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + closest_stop: str = FieldInfo(alias="closestStop") """ID of the closest stop to the current location of the transit vehicle.""" + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). """ - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) - """Distance, in meters, the transit vehicle has progressed along the active trip.""" - frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None) - """ - Last known distance along the trip received in real-time from the transit - vehicle. - """ - last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -77,12 +113,6 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) """Last known orientation value received in real-time from the transit vehicle.""" - last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None) - """Timestamp of the last known real-time location update from the transit vehicle.""" - - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) - """Timestamp of the last known real-time update from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" @@ -92,51 +122,21 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): (in seconds). """ - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) - """Capacity of the transit vehicle in terms of occupancy.""" - - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) - """Current count of occupants in the transit vehicle.""" - - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) - """Current occupancy status of the transit vehicle.""" - orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - phase: Optional[str] = None - """Current journey phase of the trip.""" - position: Optional[VehiclesForAgencyListResponseDataListTripStatusPosition] = None """Current position of the transit vehicle.""" - predicted: Optional[bool] = None - """Indicates if real-time arrival info is available for this trip.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None) - """Deviation from the schedule in seconds (positive for late, negative for early).""" - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this trip.""" - status: Optional[str] = None - """Current status modifiers for the trip.""" - - total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None) - """Total length of the trip, in meters.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) """ID of the transit vehicle currently serving the trip.""" @@ -166,12 +166,12 @@ class VehiclesForAgencyListResponseDataList(BaseModel): class VehiclesForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[VehiclesForAgencyListResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class VehiclesForAgencyListResponse(ResponseWrapper): data: VehiclesForAgencyListResponseData diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py deleted file mode 100644 index fd96982..0000000 --- a/tests/api_resources/test_agencies_with_coverage.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK -from tests.utils import assert_matches_type -from onebusaway.types import AgenciesWithCoverageRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - agencies_with_coverage = client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.agencies_with_coverage.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - agencies_with_coverage = await async_client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.agencies_with_coverage.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py new file mode 100644 index 0000000..0ef4092 --- /dev/null +++ b/tests/api_resources/test_trips_for_route.py @@ -0,0 +1,118 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import TripsForRouteListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTripsForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: OnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + client.trips_for_route.with_raw_response.list( + route_id="", + ) + + +class TestAsyncTripsForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) From bb398472831ec5623b587568acfd99ecd44be886 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:11:19 +0000 Subject: [PATCH 02/23] chore(internal): codegen related update (#83) --- .stats.yml | 2 +- api.md | 12 ++ src/onebusaway/_client.py | 16 +++ src/onebusaway/resources/__init__.py | 14 +++ .../resources/agencies_with_coverage.py | 119 ++++++++++++++++++ src/onebusaway/types/__init__.py | 1 + .../agencies_with_coverage_list_response.py | 39 ++++++ .../test_agencies_with_coverage.py | 72 +++++++++++ 8 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/onebusaway/resources/agencies_with_coverage.py create mode 100644 src/onebusaway/types/agencies_with_coverage_list_response.py create mode 100644 tests/api_resources/test_agencies_with_coverage.py diff --git a/.stats.yml b/.stats.yml index 91dcce8..1572fae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 27 +configured_endpoints: 28 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml diff --git a/api.md b/api.md index 1fb8d95..8998bc7 100644 --- a/api.md +++ b/api.md @@ -4,6 +4,18 @@ from onebusaway.types import References, ResponseWrapper ``` +# AgenciesWithCoverage + +Types: + +```python +from onebusaway.types import AgenciesWithCoverageListResponse +``` + +Methods: + +- client.agencies_with_coverage.list() -> AgenciesWithCoverageListResponse + # Agency Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 21660e9..9907b34 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -46,6 +46,7 @@ class OnebusawaySDK(SyncAPIClient): + agencies_with_coverage: resources.AgenciesWithCoverageResource agency: resources.AgencyResource vehicles_for_agency: resources.VehiclesForAgencyResource config: resources.ConfigResource @@ -129,6 +130,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self) self.agency = resources.AgencyResource(self) self.vehicles_for_agency = resources.VehiclesForAgencyResource(self) self.config = resources.ConfigResource(self) @@ -272,6 +274,7 @@ def _make_status_error( class AsyncOnebusawaySDK(AsyncAPIClient): + agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource agency: resources.AsyncAgencyResource vehicles_for_agency: resources.AsyncVehiclesForAgencyResource config: resources.AsyncConfigResource @@ -355,6 +358,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self) self.agency = resources.AsyncAgencyResource(self) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self) self.config = resources.AsyncConfigResource(self) @@ -499,6 +503,9 @@ def _make_status_error( class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = resources.AgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithRawResponse(client.config) @@ -533,6 +540,9 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse( + client.agencies_with_coverage + ) self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = resources.AsyncConfigResourceWithRawResponse(client.config) @@ -569,6 +579,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = resources.AgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = resources.ConfigResourceWithStreamingResponse(client.config) @@ -607,6 +620,9 @@ def __init__(self, client: OnebusawaySDK) -> None: class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: + self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse( + client.agencies_with_coverage + ) self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency) self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse( client.vehicles_for_agency diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 1778a99..d72f3d6 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -192,6 +192,14 @@ ArrivalAndDepartureResourceWithStreamingResponse, AsyncArrivalAndDepartureResourceWithStreamingResponse, ) +from .agencies_with_coverage import ( + AgenciesWithCoverageResource, + AsyncAgenciesWithCoverageResource, + AgenciesWithCoverageResourceWithRawResponse, + AsyncAgenciesWithCoverageResourceWithRawResponse, + AgenciesWithCoverageResourceWithStreamingResponse, + AsyncAgenciesWithCoverageResourceWithStreamingResponse, +) from .report_problem_with_stop import ( ReportProblemWithStopResource, AsyncReportProblemWithStopResource, @@ -210,6 +218,12 @@ ) __all__ = [ + "AgenciesWithCoverageResource", + "AsyncAgenciesWithCoverageResource", + "AgenciesWithCoverageResourceWithRawResponse", + "AsyncAgenciesWithCoverageResourceWithRawResponse", + "AgenciesWithCoverageResourceWithStreamingResponse", + "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py new file mode 100644 index 0000000..edab37b --- /dev/null +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse + +__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] + + +class AgenciesWithCoverageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: + return AgenciesWithCoverageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: + return AgenciesWithCoverageResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ + return self._get( + "/api/where/agencies-with-coverage.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AgenciesWithCoverageListResponse, + ) + + +class AsyncAgenciesWithCoverageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: + return AsyncAgenciesWithCoverageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: + return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ + return await self._get( + "/api/where/agencies-with-coverage.json", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AgenciesWithCoverageListResponse, + ) + + +class AgenciesWithCoverageResourceWithRawResponse: + def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = to_raw_response_wrapper( + agencies_with_coverage.list, + ) + + +class AsyncAgenciesWithCoverageResourceWithRawResponse: + def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = async_to_raw_response_wrapper( + agencies_with_coverage.list, + ) + + +class AgenciesWithCoverageResourceWithStreamingResponse: + def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = to_streamed_response_wrapper( + agencies_with_coverage.list, + ) + + +class AsyncAgenciesWithCoverageResourceWithStreamingResponse: + def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: + self._agencies_with_coverage = agencies_with_coverage + + self.list = async_to_streamed_response_wrapper( + agencies_with_coverage.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index ea300f0..8cdc638 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -36,6 +36,7 @@ from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py new file mode 100644 index 0000000..13f182b --- /dev/null +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "AgenciesWithCoverageListResponse", + "AgenciesWithCoverageListResponseData", + "AgenciesWithCoverageListResponseDataList", +] + + +class AgenciesWithCoverageListResponseDataList(BaseModel): + agency_id: str = FieldInfo(alias="agencyId") + + lat: float + + lat_span: float = FieldInfo(alias="latSpan") + + lon: float + + lon_span: float = FieldInfo(alias="lonSpan") + + +class AgenciesWithCoverageListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[AgenciesWithCoverageListResponseDataList] + + references: References + + +class AgenciesWithCoverageListResponse(ResponseWrapper): + data: AgenciesWithCoverageListResponseData diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py new file mode 100644 index 0000000..fad1087 --- /dev/null +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK +from tests.utils import assert_matches_type +from onebusaway.types import AgenciesWithCoverageListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + agencies_with_coverage = client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.agencies_with_coverage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + agencies_with_coverage = response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.agencies_with_coverage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + agencies_with_coverage = response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAgenciesWithCoverage: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + agencies_with_coverage = await async_client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agencies_with_coverage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + agencies_with_coverage = await response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.agencies_with_coverage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + agencies_with_coverage = await response.parse() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + + assert cast(Any, response.is_closed) is True From 8dbeb49a6f799aaef5214d77cfa46ae0d45fd635 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:11:58 +0000 Subject: [PATCH 03/23] chore(internal): use different 32bit detection method (#84) --- src/onebusaway/_base_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 28c4797..30f5672 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import json import time import uuid @@ -1982,7 +1983,6 @@ def get_python_version() -> str: def get_architecture() -> Arch: try: - python_bitness, _ = platform.architecture() machine = platform.machine().lower() except Exception: return "unknown" @@ -1998,7 +1998,7 @@ def get_architecture() -> Arch: return "x64" # TODO: untested - if python_bitness == "32bit": + if sys.maxsize <= 2**32: return "x32" if machine: From 87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:30:41 +0000 Subject: [PATCH 04/23] feat(api): OpenAPI spec update via Stainless API (#85) --- .stats.yml | 2 +- .../types/trip_detail_retrieve_response.py | 12 ++++------ .../trip_for_vehicle_retrieve_response.py | 12 ++++------ .../trips_for_location_retrieve_response.py | 24 +++++++++---------- .../types/trips_for_route_list_response.py | 24 +++++++++---------- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1572fae..5cb9754 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5ea57ef7593fcb03a66448381178efc842002e4ba63aa97f238e8584c8b4a6ee.yml diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index f6b5c88..f7cf226 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -35,17 +35,15 @@ class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripDetailRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 9e42fbc..90abdd7 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -35,17 +35,15 @@ class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py index 433dd1d..522c204 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_retrieve_response.py @@ -35,17 +35,15 @@ class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripsForLocationRetrieveResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripsForLocationRetrieveResponseDataListScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): @@ -165,17 +163,17 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): class TripsForLocationRetrieveResponseDataList(BaseModel): - frequency: Optional[str] = None + schedule: TripsForLocationRetrieveResponseDataListSchedule - schedule: Optional[TripsForLocationRetrieveResponseDataListSchedule] = None + status: TripsForLocationRetrieveResponseDataListStatus - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + trip_id: str = FieldInfo(alias="tripId") - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + frequency: Optional[str] = None - status: Optional[TripsForLocationRetrieveResponseDataListStatus] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) class TripsForLocationRetrieveResponseData(BaseModel): diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index 2a3ec1f..f9bc2d8 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -35,17 +35,15 @@ class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): class TripsForRouteListResponseDataListSchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripsForRouteListResponseDataListScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): @@ -165,17 +163,17 @@ class TripsForRouteListResponseDataListStatus(BaseModel): class TripsForRouteListResponseDataList(BaseModel): - frequency: Optional[str] = None + schedule: TripsForRouteListResponseDataListSchedule - schedule: Optional[TripsForRouteListResponseDataListSchedule] = None + status: TripsForRouteListResponseDataListStatus - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + trip_id: str = FieldInfo(alias="tripId") - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + frequency: Optional[str] = None - status: Optional[TripsForRouteListResponseDataListStatus] = None + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) class TripsForRouteListResponseData(BaseModel): From d63524a8e1e7a3ab863e964f2f81069fdd4e5761 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:19:02 +0000 Subject: [PATCH 05/23] feat(api): OpenAPI spec update via Stainless API (#86) --- api.md | 12 ++--- .../resources/routes_for_location.py | 36 ++++++------- .../resources/stops_for_location.py | 36 ++++++------- .../resources/trips_for_location.py | 36 ++++++------- src/onebusaway/types/__init__.py | 14 +++--- ....py => routes_for_location_list_params.py} | 4 +- ...y => routes_for_location_list_response.py} | 16 +++--- ...s.py => stops_for_location_list_params.py} | 4 +- ...py => stops_for_location_list_response.py} | 16 +++--- ...s.py => trips_for_location_list_params.py} | 4 +- ...py => trips_for_location_list_response.py} | 46 ++++++++--------- .../api_resources/test_routes_for_location.py | 50 +++++++++---------- .../api_resources/test_stops_for_location.py | 50 +++++++++---------- .../api_resources/test_trips_for_location.py | 50 +++++++++---------- 14 files changed, 184 insertions(+), 190 deletions(-) rename src/onebusaway/types/{routes_for_location_retrieve_params.py => routes_for_location_list_params.py} (79%) rename src/onebusaway/types/{routes_for_location_retrieve_response.py => routes_for_location_list_response.py} (70%) rename src/onebusaway/types/{stops_for_location_retrieve_params.py => stops_for_location_list_params.py} (64%) rename src/onebusaway/types/{stops_for_location_retrieve_response.py => stops_for_location_list_response.py} (66%) rename src/onebusaway/types/{trips_for_location_retrieve_params.py => trips_for_location_list_params.py} (90%) rename src/onebusaway/types/{trips_for_location_retrieve_response.py => trips_for_location_list_response.py} (79%) diff --git a/api.md b/api.md index 8998bc7..408a5c9 100644 --- a/api.md +++ b/api.md @@ -69,12 +69,12 @@ Methods: Types: ```python -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse ``` Methods: -- client.stops_for_location.retrieve(\*\*params) -> StopsForLocationRetrieveResponse +- client.stops_for_location.list(\*\*params) -> StopsForLocationListResponse # StopsForRoute @@ -153,12 +153,12 @@ Methods: Types: ```python -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse ``` Methods: -- client.routes_for_location.retrieve(\*\*params) -> RoutesForLocationRetrieveResponse +- client.routes_for_location.list(\*\*params) -> RoutesForLocationListResponse # RoutesForAgency @@ -214,12 +214,12 @@ Methods: Types: ```python -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse ``` Methods: -- client.trips_for_location.retrieve(\*\*params) -> TripsForLocationRetrieveResponse +- client.trips_for_location.list(\*\*params) -> TripsForLocationListResponse # TripDetails diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index 2c4d4e9..ee3bd19 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import routes_for_location_retrieve_params +from ..types import routes_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.routes_for_location_retrieve_response import RoutesForLocationRetrieveResponse +from ..types.routes_for_location_list_response import RoutesForLocationListResponse __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingResponse: return RoutesForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -48,7 +48,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -77,10 +77,10 @@ def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -93,7 +93,7 @@ def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreamingResponse: return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -108,7 +108,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -137,10 +137,10 @@ async def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -148,8 +148,8 @@ class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = to_raw_response_wrapper( + routes_for_location.list, ) @@ -157,8 +157,8 @@ class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + routes_for_location.list, ) @@ -166,8 +166,8 @@ class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = to_streamed_response_wrapper( + routes_for_location.list, ) @@ -175,6 +175,6 @@ class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + routes_for_location.list, ) diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index dd64b27..c0a635b 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import stops_for_location_retrieve_params +from ..types import stops_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.stops_for_location_retrieve_response import StopsForLocationRetrieveResponse +from ..types.stops_for_location_list_response import StopsForLocationListResponse __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> StopsForLocationResourceWithStreamingResponse: return StopsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float | NotGiven = NOT_GIVEN, @@ -44,7 +44,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location @@ -69,10 +69,10 @@ def retrieve( "lat": lat, "lon": lon, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -85,7 +85,7 @@ def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingResponse: return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float | NotGiven = NOT_GIVEN, @@ -96,7 +96,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location @@ -121,10 +121,10 @@ async def retrieve( "lat": lat, "lon": lon, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -132,8 +132,8 @@ class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = to_raw_response_wrapper( + stops_for_location.list, ) @@ -141,8 +141,8 @@ class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + stops_for_location.list, ) @@ -150,8 +150,8 @@ class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = to_streamed_response_wrapper( + stops_for_location.list, ) @@ -159,6 +159,6 @@ class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + stops_for_location.list, ) diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 947283d..31acdc0 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import trips_for_location_retrieve_params +from ..types import trips_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.trips_for_location_retrieve_response import TripsForLocationRetrieveResponse +from ..types.trips_for_location_list_response import TripsForLocationListResponse __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> TripsForLocationResourceWithStreamingResponse: return TripsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -49,7 +49,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -95,10 +95,10 @@ def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -111,7 +111,7 @@ def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingResponse: return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -127,7 +127,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -173,10 +173,10 @@ async def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -184,8 +184,8 @@ class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = to_raw_response_wrapper( + trips_for_location.list, ) @@ -193,8 +193,8 @@ class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + trips_for_location.list, ) @@ -202,8 +202,8 @@ class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = to_streamed_response_wrapper( + trips_for_location.list, ) @@ -211,6 +211,6 @@ class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + trips_for_location.list, ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index 8cdc638..5f9bda3 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -17,12 +17,18 @@ from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams +from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .search_for_route_retrieve_params import SearchForRouteRetrieveParams as SearchForRouteRetrieveParams +from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams +from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams from .search_for_stop_retrieve_response import SearchForStopRetrieveResponse as SearchForStopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse @@ -30,22 +36,14 @@ from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams from .search_for_route_retrieve_response import SearchForRouteRetrieveResponse as SearchForRouteRetrieveResponse -from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse -from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse -from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse -from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse -from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse from .arrival_and_departure_retrieve_params import ( ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, ) -from .routes_for_location_retrieve_response import ( - RoutesForLocationRetrieveResponse as RoutesForLocationRetrieveResponse, -) from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) diff --git a/src/onebusaway/types/routes_for_location_retrieve_params.py b/src/onebusaway/types/routes_for_location_list_params.py similarity index 79% rename from src/onebusaway/types/routes_for_location_retrieve_params.py rename to src/onebusaway/types/routes_for_location_list_params.py index 9acd9ce..033ec2a 100644 --- a/src/onebusaway/types/routes_for_location_retrieve_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["RoutesForLocationRetrieveParams"] +__all__ = ["RoutesForLocationListParams"] -class RoutesForLocationRetrieveParams(TypedDict, total=False): +class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] lon: Required[float] diff --git a/src/onebusaway/types/routes_for_location_retrieve_response.py b/src/onebusaway/types/routes_for_location_list_response.py similarity index 70% rename from src/onebusaway/types/routes_for_location_retrieve_response.py rename to src/onebusaway/types/routes_for_location_list_response.py index a01a271..41fb72c 100644 --- a/src/onebusaway/types/routes_for_location_retrieve_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -9,13 +9,13 @@ from .shared.response_wrapper import ResponseWrapper __all__ = [ - "RoutesForLocationRetrieveResponse", - "RoutesForLocationRetrieveResponseData", - "RoutesForLocationRetrieveResponseDataList", + "RoutesForLocationListResponse", + "RoutesForLocationListResponseData", + "RoutesForLocationListResponseDataList", ] -class RoutesForLocationRetrieveResponseDataList(BaseModel): +class RoutesForLocationListResponseDataList(BaseModel): id: Optional[str] = None agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) @@ -37,15 +37,15 @@ class RoutesForLocationRetrieveResponseDataList(BaseModel): url: Optional[str] = None -class RoutesForLocationRetrieveResponseData(BaseModel): +class RoutesForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[RoutesForLocationRetrieveResponseDataList] + list: List[RoutesForLocationListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References -class RoutesForLocationRetrieveResponse(ResponseWrapper): - data: RoutesForLocationRetrieveResponseData +class RoutesForLocationListResponse(ResponseWrapper): + data: RoutesForLocationListResponseData diff --git a/src/onebusaway/types/stops_for_location_retrieve_params.py b/src/onebusaway/types/stops_for_location_list_params.py similarity index 64% rename from src/onebusaway/types/stops_for_location_retrieve_params.py rename to src/onebusaway/types/stops_for_location_list_params.py index b5c1ba6..e8d5496 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["StopsForLocationRetrieveParams"] +__all__ = ["StopsForLocationListParams"] -class StopsForLocationRetrieveParams(TypedDict, total=False): +class StopsForLocationListParams(TypedDict, total=False): lat: float lon: float diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_list_response.py similarity index 66% rename from src/onebusaway/types/stops_for_location_retrieve_response.py rename to src/onebusaway/types/stops_for_location_list_response.py index 628b246..a74aea4 100644 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -8,14 +8,10 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopsForLocationRetrieveResponse", - "StopsForLocationRetrieveResponseData", - "StopsForLocationRetrieveResponseDataList", -] +__all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] -class StopsForLocationRetrieveResponseDataList(BaseModel): +class StopsForLocationListResponseDataList(BaseModel): id: str lat: float @@ -39,13 +35,13 @@ class StopsForLocationRetrieveResponseDataList(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) -class StopsForLocationRetrieveResponseData(BaseModel): +class StopsForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForLocationRetrieveResponseDataList] + list: List[StopsForLocationListResponseDataList] references: References -class StopsForLocationRetrieveResponse(ResponseWrapper): - data: StopsForLocationRetrieveResponseData +class StopsForLocationListResponse(ResponseWrapper): + data: StopsForLocationListResponseData diff --git a/src/onebusaway/types/trips_for_location_retrieve_params.py b/src/onebusaway/types/trips_for_location_list_params.py similarity index 90% rename from src/onebusaway/types/trips_for_location_retrieve_params.py rename to src/onebusaway/types/trips_for_location_list_params.py index 341a0fd..69a9186 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["TripsForLocationRetrieveParams"] +__all__ = ["TripsForLocationListParams"] -class TripsForLocationRetrieveParams(TypedDict, total=False): +class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] """The latitude coordinate of the search center""" diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_list_response.py similarity index 79% rename from src/onebusaway/types/trips_for_location_retrieve_response.py rename to src/onebusaway/types/trips_for_location_list_response.py index 522c204..cbeafa0 100644 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -9,18 +9,18 @@ from .shared.response_wrapper import ResponseWrapper __all__ = [ - "TripsForLocationRetrieveResponse", - "TripsForLocationRetrieveResponseData", - "TripsForLocationRetrieveResponseDataList", - "TripsForLocationRetrieveResponseDataListSchedule", - "TripsForLocationRetrieveResponseDataListScheduleStopTime", - "TripsForLocationRetrieveResponseDataListStatus", - "TripsForLocationRetrieveResponseDataListStatusLastKnownLocation", - "TripsForLocationRetrieveResponseDataListStatusPosition", + "TripsForLocationListResponse", + "TripsForLocationListResponseData", + "TripsForLocationListResponseDataList", + "TripsForLocationListResponseDataListSchedule", + "TripsForLocationListResponseDataListScheduleStopTime", + "TripsForLocationListResponseDataListStatus", + "TripsForLocationListResponseDataListStatusLastKnownLocation", + "TripsForLocationListResponseDataListStatusPosition", ] -class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): +class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) @@ -34,19 +34,19 @@ class TripsForLocationRetrieveResponseDataListScheduleStopTime(BaseModel): stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) -class TripsForLocationRetrieveResponseDataListSchedule(BaseModel): +class TripsForLocationListResponseDataListSchedule(BaseModel): next_trip_id: str = FieldInfo(alias="nextTripId") previous_trip_id: str = FieldInfo(alias="previousTripId") - stop_times: List[TripsForLocationRetrieveResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") time_zone: str = FieldInfo(alias="timeZone") frequency: Optional[str] = None -class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel): +class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -54,7 +54,7 @@ class TripsForLocationRetrieveResponseDataListStatusLastKnownLocation(BaseModel) """Longitude of the last known location of the transit vehicle.""" -class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): +class TripsForLocationListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -62,7 +62,7 @@ class TripsForLocationRetrieveResponseDataListStatusPosition(BaseModel): """Longitude of the current position of the transit vehicle.""" -class TripsForLocationRetrieveResponseDataListStatus(BaseModel): +class TripsForLocationListResponseDataListStatus(BaseModel): active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" @@ -126,7 +126,7 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForLocationRetrieveResponseDataListStatusLastKnownLocation] = FieldInfo( + last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) """Last known location of the transit vehicle.""" @@ -146,7 +146,7 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): orientation: Optional[float] = None """Orientation of the transit vehicle, represented as an angle in degrees.""" - position: Optional[TripsForLocationRetrieveResponseDataListStatusPosition] = None + position: Optional[TripsForLocationListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) @@ -162,10 +162,10 @@ class TripsForLocationRetrieveResponseDataListStatus(BaseModel): """ID of the transit vehicle currently serving the trip.""" -class TripsForLocationRetrieveResponseDataList(BaseModel): - schedule: TripsForLocationRetrieveResponseDataListSchedule +class TripsForLocationListResponseDataList(BaseModel): + schedule: TripsForLocationListResponseDataListSchedule - status: TripsForLocationRetrieveResponseDataListStatus + status: TripsForLocationListResponseDataListStatus trip_id: str = FieldInfo(alias="tripId") @@ -176,8 +176,8 @@ class TripsForLocationRetrieveResponseDataList(BaseModel): situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) -class TripsForLocationRetrieveResponseData(BaseModel): - list: List[TripsForLocationRetrieveResponseDataList] +class TripsForLocationListResponseData(BaseModel): + list: List[TripsForLocationListResponseDataList] references: References @@ -188,5 +188,5 @@ class TripsForLocationRetrieveResponseData(BaseModel): """Indicates if the search location is out of range""" -class TripsForLocationRetrieveResponse(ResponseWrapper): - data: TripsForLocationRetrieveResponseData +class TripsForLocationListResponse(ResponseWrapper): + data: TripsForLocationListResponseData diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 2e091e6..55fbc31 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,16 +18,16 @@ class TestRoutesForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -35,11 +35,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.routes_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -47,11 +47,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.routes_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -59,7 +59,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,16 +68,16 @@ class TestAsyncRoutesForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -85,11 +85,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.routes_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -97,11 +97,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.routes_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -109,6 +109,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index d1abaeb..ebe72d8 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,35 +18,35 @@ class TestStopsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + def test_method_list(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list() + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list( lat=0, lon=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.retrieve() + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_location.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.retrieve() as response: + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.stops_for_location.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -55,34 +55,34 @@ class TestAsyncStopsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list() + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.retrieve() + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_location.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.retrieve() as response: + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.stops_for_location.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 439faca..050d552 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,18 +18,18 @@ class TestTripsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -38,11 +38,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trips_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -52,11 +52,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.trips_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -66,7 +66,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,18 +75,18 @@ class TestAsyncTripsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -95,11 +95,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trips_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -109,11 +109,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.trips_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -123,6 +123,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True From d4f2ca03ce7778c127e70a6f7db86e0fb667e157 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:23:07 +0000 Subject: [PATCH 06/23] feat(api): OpenAPI spec update via Stainless API (#87) --- .stats.yml | 2 +- src/onebusaway/types/route_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/stop_ids_for_agency_list_response.py | 6 +++--- src/onebusaway/types/trips_for_location_list_response.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5cb9754..40f1ffc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5ea57ef7593fcb03a66448381178efc842002e4ba63aa97f238e8584c8b4a6ee.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f162ca6ca596aea614dc8d4451e8fb35d4a6850870f5dcf087e83f61c2284276.yml diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index ffe9c32..193704e 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class RouteIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class RouteIDsForAgencyListResponse(ResponseWrapper): data: RouteIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index f36b63f..3ae9947 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class StopIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class StopIDsForAgencyListResponse(ResponseWrapper): data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index cbeafa0..68ae881 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -177,13 +177,13 @@ class TripsForLocationListResponseDataList(BaseModel): class TripsForLocationListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + """Indicates if the limit of trips has been exceeded""" + list: List[TripsForLocationListResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - """Indicates if the limit of trips has been exceeded""" - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) """Indicates if the search location is out of range""" From 3543b38cf9e4b8a4762c41f494c8f54a6451d091 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 18 Aug 2024 17:43:54 +0000 Subject: [PATCH 07/23] feat(api): OpenAPI spec update via Stainless API (#88) --- .stats.yml | 2 +- src/onebusaway/types/schedule_for_route_retrieve_response.py | 4 ++-- src/onebusaway/types/shared/references.py | 4 ++-- src/onebusaway/types/trip_detail_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_for_vehicle_retrieve_response.py | 4 ++-- src/onebusaway/types/trip_retrieve_response.py | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 40f1ffc..3c0b0ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f162ca6ca596aea614dc8d4451e8fb35d4a6850870f5dcf087e83f61c2284276.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-dc20a161fa6713b46e7406967f2d7bdf01e1e4ed6ce0d5a190b8ad54c0a189ae.yml diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 1c68056..17f04e0 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -88,6 +88,8 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -96,8 +98,6 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index cb39a86..6b8ecd6 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -237,6 +237,8 @@ class Trip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -245,8 +247,6 @@ class Trip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index f7cf226..4b76689 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -163,6 +163,8 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): class TripDetailRetrieveResponseDataEntry(BaseModel): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None @@ -173,8 +175,6 @@ class TripDetailRetrieveResponseDataEntry(BaseModel): status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 90abdd7..136b96c 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -163,6 +163,8 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): class TripForVehicleRetrieveResponseDataEntry(BaseModel): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None @@ -173,8 +175,6 @@ class TripForVehicleRetrieveResponseDataEntry(BaseModel): status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index e939f2f..152bfa2 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -16,6 +16,8 @@ class TripRetrieveResponseDataEntry(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -24,8 +26,6 @@ class TripRetrieveResponseDataEntry(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) From b56865a9f16ef4117ac278dec6174a3507b4b1dc Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 20 Aug 2024 19:37:09 +0000 Subject: [PATCH 08/23] feat(api): OpenAPI spec update via Stainless API (#89) --- .devcontainer/Dockerfile | 0 .devcontainer/devcontainer.json | 0 .github/workflows/ci.yml | 0 .github/workflows/publish-pypi.yml | 0 .github/workflows/release-doctor.yml | 0 .gitignore | 0 .python-version | 0 .release-please-manifest.json | 0 .stats.yml | 2 +- Brewfile | 0 CONTRIBUTING.md | 0 LICENSE | 0 README.md | 0 SECURITY.md | 0 api.md | 0 bin/check-release-environment | 0 bin/publish-pypi | 0 examples/.keep | 0 mypy.ini | 0 noxfile.py | 0 pyproject.toml | 0 release-please-config.json | 0 requirements-dev.lock | 0 requirements.lock | 0 scripts/utils/ruffen-docs.py | 0 src/onebusaway/__init__.py | 0 src/onebusaway/_base_client.py | 0 src/onebusaway/_client.py | 0 src/onebusaway/_compat.py | 0 src/onebusaway/_constants.py | 0 src/onebusaway/_exceptions.py | 0 src/onebusaway/_files.py | 0 src/onebusaway/_models.py | 0 src/onebusaway/_qs.py | 0 src/onebusaway/_resource.py | 0 src/onebusaway/_response.py | 0 src/onebusaway/_streaming.py | 0 src/onebusaway/_types.py | 0 src/onebusaway/_utils/__init__.py | 0 src/onebusaway/_utils/_logs.py | 0 src/onebusaway/_utils/_proxy.py | 0 src/onebusaway/_utils/_reflection.py | 0 src/onebusaway/_utils/_streams.py | 0 src/onebusaway/_utils/_sync.py | 0 src/onebusaway/_utils/_transform.py | 0 src/onebusaway/_utils/_typing.py | 0 src/onebusaway/_utils/_utils.py | 0 src/onebusaway/_version.py | 0 src/onebusaway/lib/.keep | 0 src/onebusaway/py.typed | 0 src/onebusaway/resources/__init__.py | 0 .../resources/agencies_with_coverage.py | 0 src/onebusaway/resources/agency.py | 0 .../resources/arrival_and_departure.py | 0 src/onebusaway/resources/block.py | 0 src/onebusaway/resources/config.py | 0 src/onebusaway/resources/current_time.py | 0 .../resources/report_problem_with_stop.py | 0 .../resources/report_problem_with_trip.py | 0 src/onebusaway/resources/route.py | 0 .../resources/route_ids_for_agency.py | 0 src/onebusaway/resources/routes_for_agency.py | 0 .../resources/routes_for_location.py | 0 .../resources/schedule_for_route.py | 0 src/onebusaway/resources/schedule_for_stop.py | 0 src/onebusaway/resources/search_for_route.py | 0 src/onebusaway/resources/search_for_stop.py | 0 src/onebusaway/resources/shape.py | 0 src/onebusaway/resources/stop.py | 0 .../resources/stop_ids_for_agency.py | 0 .../resources/stops_for_location.py | 40 +++++++++++++++++-- src/onebusaway/resources/stops_for_route.py | 0 src/onebusaway/resources/trip.py | 0 src/onebusaway/resources/trip_details.py | 0 src/onebusaway/resources/trip_for_vehicle.py | 0 .../resources/trips_for_location.py | 0 src/onebusaway/resources/trips_for_route.py | 0 .../resources/vehicles_for_agency.py | 0 src/onebusaway/types/__init__.py | 0 .../agencies_with_coverage_list_response.py | 0 .../types/agency_retrieve_response.py | 0 .../arrival_and_departure_list_params.py | 0 .../arrival_and_departure_list_response.py | 0 .../arrival_and_departure_retrieve_params.py | 0 ...arrival_and_departure_retrieve_response.py | 0 .../types/block_retrieve_response.py | 0 .../types/config_retrieve_response.py | 0 .../types/current_time_retrieve_response.py | 0 ...eport_problem_with_stop_retrieve_params.py | 0 ...eport_problem_with_trip_retrieve_params.py | 0 .../route_ids_for_agency_list_response.py | 0 .../types/route_retrieve_response.py | 0 .../types/routes_for_agency_list_response.py | 0 .../types/routes_for_location_list_params.py | 0 .../routes_for_location_list_response.py | 0 .../schedule_for_route_retrieve_params.py | 0 .../schedule_for_route_retrieve_response.py | 0 .../schedule_for_stop_retrieve_params.py | 0 .../schedule_for_stop_retrieve_response.py | 0 .../types/search_for_route_retrieve_params.py | 0 .../search_for_route_retrieve_response.py | 0 .../types/search_for_stop_retrieve_params.py | 0 .../search_for_stop_retrieve_response.py | 0 .../types/shape_retrieve_response.py | 0 src/onebusaway/types/shared/__init__.py | 0 src/onebusaway/types/shared/references.py | 0 .../types/shared/response_wrapper.py | 0 .../stop_ids_for_agency_list_response.py | 0 .../types/stop_retrieve_response.py | 0 .../types/stops_for_location_list_params.py | 20 ++++++++-- .../types/stops_for_location_list_response.py | 0 .../types/stops_for_route_list_params.py | 0 .../types/stops_for_route_list_response.py | 0 .../types/trip_detail_retrieve_params.py | 0 .../types/trip_detail_retrieve_response.py | 0 .../types/trip_for_vehicle_retrieve_params.py | 0 .../trip_for_vehicle_retrieve_response.py | 0 .../types/trip_retrieve_response.py | 0 .../types/trips_for_location_list_params.py | 0 .../types/trips_for_location_list_response.py | 0 .../types/trips_for_route_list_params.py | 0 .../types/trips_for_route_list_response.py | 0 .../types/vehicles_for_agency_list_params.py | 0 .../vehicles_for_agency_list_response.py | 0 src/open_transit/lib/.keep | 0 tests/__init__.py | 0 tests/api_resources/__init__.py | 0 .../test_agencies_with_coverage.py | 0 tests/api_resources/test_agency.py | 0 .../test_arrival_and_departure.py | 0 tests/api_resources/test_block.py | 0 tests/api_resources/test_config.py | 0 tests/api_resources/test_current_time.py | 0 .../test_report_problem_with_stop.py | 0 .../test_report_problem_with_trip.py | 0 tests/api_resources/test_route.py | 0 .../test_route_ids_for_agency.py | 0 tests/api_resources/test_routes_for_agency.py | 0 .../api_resources/test_routes_for_location.py | 0 .../api_resources/test_schedule_for_route.py | 0 tests/api_resources/test_schedule_for_stop.py | 0 tests/api_resources/test_search_for_route.py | 0 tests/api_resources/test_search_for_stop.py | 0 tests/api_resources/test_shape.py | 0 tests/api_resources/test_stop.py | 0 .../api_resources/test_stop_ids_for_agency.py | 0 .../api_resources/test_stops_for_location.py | 38 +++++++++++++++--- tests/api_resources/test_stops_for_route.py | 0 tests/api_resources/test_trip.py | 0 tests/api_resources/test_trip_details.py | 0 tests/api_resources/test_trip_for_vehicle.py | 0 .../api_resources/test_trips_for_location.py | 0 tests/api_resources/test_trips_for_route.py | 0 .../api_resources/test_vehicles_for_agency.py | 0 tests/conftest.py | 0 tests/sample_file.txt | 0 tests/test_client.py | 0 tests/test_deepcopy.py | 0 tests/test_extract_files.py | 0 tests/test_files.py | 0 tests/test_models.py | 0 tests/test_qs.py | 0 tests/test_required_args.py | 0 tests/test_response.py | 0 tests/test_streaming.py | 0 tests/test_transform.py | 0 tests/test_utils/test_proxy.py | 0 tests/test_utils/test_typing.py | 0 tests/utils.py | 0 169 files changed, 86 insertions(+), 14 deletions(-) mode change 100644 => 100755 .devcontainer/Dockerfile mode change 100644 => 100755 .devcontainer/devcontainer.json mode change 100644 => 100755 .github/workflows/ci.yml mode change 100644 => 100755 .github/workflows/publish-pypi.yml mode change 100644 => 100755 .github/workflows/release-doctor.yml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .python-version mode change 100644 => 100755 .release-please-manifest.json mode change 100644 => 100755 .stats.yml mode change 100644 => 100755 Brewfile mode change 100644 => 100755 CONTRIBUTING.md mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 SECURITY.md mode change 100644 => 100755 api.md mode change 100644 => 100755 bin/check-release-environment mode change 100644 => 100755 bin/publish-pypi mode change 100644 => 100755 examples/.keep mode change 100644 => 100755 mypy.ini mode change 100644 => 100755 noxfile.py mode change 100644 => 100755 pyproject.toml mode change 100644 => 100755 release-please-config.json mode change 100644 => 100755 requirements-dev.lock mode change 100644 => 100755 requirements.lock mode change 100644 => 100755 scripts/utils/ruffen-docs.py mode change 100644 => 100755 src/onebusaway/__init__.py mode change 100644 => 100755 src/onebusaway/_base_client.py mode change 100644 => 100755 src/onebusaway/_client.py mode change 100644 => 100755 src/onebusaway/_compat.py mode change 100644 => 100755 src/onebusaway/_constants.py mode change 100644 => 100755 src/onebusaway/_exceptions.py mode change 100644 => 100755 src/onebusaway/_files.py mode change 100644 => 100755 src/onebusaway/_models.py mode change 100644 => 100755 src/onebusaway/_qs.py mode change 100644 => 100755 src/onebusaway/_resource.py mode change 100644 => 100755 src/onebusaway/_response.py mode change 100644 => 100755 src/onebusaway/_streaming.py mode change 100644 => 100755 src/onebusaway/_types.py mode change 100644 => 100755 src/onebusaway/_utils/__init__.py mode change 100644 => 100755 src/onebusaway/_utils/_logs.py mode change 100644 => 100755 src/onebusaway/_utils/_proxy.py mode change 100644 => 100755 src/onebusaway/_utils/_reflection.py mode change 100644 => 100755 src/onebusaway/_utils/_streams.py mode change 100644 => 100755 src/onebusaway/_utils/_sync.py mode change 100644 => 100755 src/onebusaway/_utils/_transform.py mode change 100644 => 100755 src/onebusaway/_utils/_typing.py mode change 100644 => 100755 src/onebusaway/_utils/_utils.py mode change 100644 => 100755 src/onebusaway/_version.py mode change 100644 => 100755 src/onebusaway/lib/.keep mode change 100644 => 100755 src/onebusaway/py.typed mode change 100644 => 100755 src/onebusaway/resources/__init__.py mode change 100644 => 100755 src/onebusaway/resources/agencies_with_coverage.py mode change 100644 => 100755 src/onebusaway/resources/agency.py mode change 100644 => 100755 src/onebusaway/resources/arrival_and_departure.py mode change 100644 => 100755 src/onebusaway/resources/block.py mode change 100644 => 100755 src/onebusaway/resources/config.py mode change 100644 => 100755 src/onebusaway/resources/current_time.py mode change 100644 => 100755 src/onebusaway/resources/report_problem_with_stop.py mode change 100644 => 100755 src/onebusaway/resources/report_problem_with_trip.py mode change 100644 => 100755 src/onebusaway/resources/route.py mode change 100644 => 100755 src/onebusaway/resources/route_ids_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/routes_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/routes_for_location.py mode change 100644 => 100755 src/onebusaway/resources/schedule_for_route.py mode change 100644 => 100755 src/onebusaway/resources/schedule_for_stop.py mode change 100644 => 100755 src/onebusaway/resources/search_for_route.py mode change 100644 => 100755 src/onebusaway/resources/search_for_stop.py mode change 100644 => 100755 src/onebusaway/resources/shape.py mode change 100644 => 100755 src/onebusaway/resources/stop.py mode change 100644 => 100755 src/onebusaway/resources/stop_ids_for_agency.py mode change 100644 => 100755 src/onebusaway/resources/stops_for_location.py mode change 100644 => 100755 src/onebusaway/resources/stops_for_route.py mode change 100644 => 100755 src/onebusaway/resources/trip.py mode change 100644 => 100755 src/onebusaway/resources/trip_details.py mode change 100644 => 100755 src/onebusaway/resources/trip_for_vehicle.py mode change 100644 => 100755 src/onebusaway/resources/trips_for_location.py mode change 100644 => 100755 src/onebusaway/resources/trips_for_route.py mode change 100644 => 100755 src/onebusaway/resources/vehicles_for_agency.py mode change 100644 => 100755 src/onebusaway/types/__init__.py mode change 100644 => 100755 src/onebusaway/types/agencies_with_coverage_list_response.py mode change 100644 => 100755 src/onebusaway/types/agency_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_list_params.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_list_response.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/arrival_and_departure_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/block_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/config_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/current_time_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/report_problem_with_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/report_problem_with_trip_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/route_ids_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/routes_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/routes_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/routes_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_route_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/schedule_for_stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/search_for_route_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/search_for_route_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/search_for_stop_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/search_for_stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/shape_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/shared/__init__.py mode change 100644 => 100755 src/onebusaway/types/shared/references.py mode change 100644 => 100755 src/onebusaway/types/shared/response_wrapper.py mode change 100644 => 100755 src/onebusaway/types/stop_ids_for_agency_list_response.py mode change 100644 => 100755 src/onebusaway/types/stop_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/stops_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/stops_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/stops_for_route_list_params.py mode change 100644 => 100755 src/onebusaway/types/stops_for_route_list_response.py mode change 100644 => 100755 src/onebusaway/types/trip_detail_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/trip_detail_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trip_for_vehicle_retrieve_params.py mode change 100644 => 100755 src/onebusaway/types/trip_for_vehicle_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trip_retrieve_response.py mode change 100644 => 100755 src/onebusaway/types/trips_for_location_list_params.py mode change 100644 => 100755 src/onebusaway/types/trips_for_location_list_response.py mode change 100644 => 100755 src/onebusaway/types/trips_for_route_list_params.py mode change 100644 => 100755 src/onebusaway/types/trips_for_route_list_response.py mode change 100644 => 100755 src/onebusaway/types/vehicles_for_agency_list_params.py mode change 100644 => 100755 src/onebusaway/types/vehicles_for_agency_list_response.py mode change 100644 => 100755 src/open_transit/lib/.keep mode change 100644 => 100755 tests/__init__.py mode change 100644 => 100755 tests/api_resources/__init__.py mode change 100644 => 100755 tests/api_resources/test_agencies_with_coverage.py mode change 100644 => 100755 tests/api_resources/test_agency.py mode change 100644 => 100755 tests/api_resources/test_arrival_and_departure.py mode change 100644 => 100755 tests/api_resources/test_block.py mode change 100644 => 100755 tests/api_resources/test_config.py mode change 100644 => 100755 tests/api_resources/test_current_time.py mode change 100644 => 100755 tests/api_resources/test_report_problem_with_stop.py mode change 100644 => 100755 tests/api_resources/test_report_problem_with_trip.py mode change 100644 => 100755 tests/api_resources/test_route.py mode change 100644 => 100755 tests/api_resources/test_route_ids_for_agency.py mode change 100644 => 100755 tests/api_resources/test_routes_for_agency.py mode change 100644 => 100755 tests/api_resources/test_routes_for_location.py mode change 100644 => 100755 tests/api_resources/test_schedule_for_route.py mode change 100644 => 100755 tests/api_resources/test_schedule_for_stop.py mode change 100644 => 100755 tests/api_resources/test_search_for_route.py mode change 100644 => 100755 tests/api_resources/test_search_for_stop.py mode change 100644 => 100755 tests/api_resources/test_shape.py mode change 100644 => 100755 tests/api_resources/test_stop.py mode change 100644 => 100755 tests/api_resources/test_stop_ids_for_agency.py mode change 100644 => 100755 tests/api_resources/test_stops_for_location.py mode change 100644 => 100755 tests/api_resources/test_stops_for_route.py mode change 100644 => 100755 tests/api_resources/test_trip.py mode change 100644 => 100755 tests/api_resources/test_trip_details.py mode change 100644 => 100755 tests/api_resources/test_trip_for_vehicle.py mode change 100644 => 100755 tests/api_resources/test_trips_for_location.py mode change 100644 => 100755 tests/api_resources/test_trips_for_route.py mode change 100644 => 100755 tests/api_resources/test_vehicles_for_agency.py mode change 100644 => 100755 tests/conftest.py mode change 100644 => 100755 tests/sample_file.txt mode change 100644 => 100755 tests/test_client.py mode change 100644 => 100755 tests/test_deepcopy.py mode change 100644 => 100755 tests/test_extract_files.py mode change 100644 => 100755 tests/test_files.py mode change 100644 => 100755 tests/test_models.py mode change 100644 => 100755 tests/test_qs.py mode change 100644 => 100755 tests/test_required_args.py mode change 100644 => 100755 tests/test_response.py mode change 100644 => 100755 tests/test_streaming.py mode change 100644 => 100755 tests/test_transform.py mode change 100644 => 100755 tests/test_utils/test_proxy.py mode change 100644 => 100755 tests/test_utils/test_typing.py mode change 100644 => 100755 tests/utils.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile old mode 100644 new mode 100755 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json old mode 100644 new mode 100755 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.python-version b/.python-version old mode 100644 new mode 100755 diff --git a/.release-please-manifest.json b/.release-please-manifest.json old mode 100644 new mode 100755 diff --git a/.stats.yml b/.stats.yml old mode 100644 new mode 100755 index 3c0b0ee..aa31abd --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-dc20a161fa6713b46e7406967f2d7bdf01e1e4ed6ce0d5a190b8ad54c0a189ae.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-481b0f5d51c8b998b4f1939c96da73e5afcbe4e1fd9189a4cc3b00721c47a70b.yml diff --git a/Brewfile b/Brewfile old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SECURITY.md b/SECURITY.md old mode 100644 new mode 100755 diff --git a/api.md b/api.md old mode 100644 new mode 100755 diff --git a/bin/check-release-environment b/bin/check-release-environment old mode 100644 new mode 100755 diff --git a/bin/publish-pypi b/bin/publish-pypi old mode 100644 new mode 100755 diff --git a/examples/.keep b/examples/.keep old mode 100644 new mode 100755 diff --git a/mypy.ini b/mypy.ini old mode 100644 new mode 100755 diff --git a/noxfile.py b/noxfile.py old mode 100644 new mode 100755 diff --git a/pyproject.toml b/pyproject.toml old mode 100644 new mode 100755 diff --git a/release-please-config.json b/release-please-config.json old mode 100644 new mode 100755 diff --git a/requirements-dev.lock b/requirements-dev.lock old mode 100644 new mode 100755 diff --git a/requirements.lock b/requirements.lock old mode 100644 new mode 100755 diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_logs.py b/src/onebusaway/_utils/_logs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_reflection.py b/src/onebusaway/_utils/_reflection.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_streams.py b/src/onebusaway/_utils/_streams.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/lib/.keep b/src/onebusaway/lib/.keep old mode 100644 new mode 100755 diff --git a/src/onebusaway/py.typed b/src/onebusaway/py.typed old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py old mode 100644 new mode 100755 index c0a635b..43bdbcf --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -36,8 +36,12 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -49,6 +53,14 @@ def list( stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -68,6 +80,10 @@ def list( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, stops_for_location_list_params.StopsForLocationListParams, ), @@ -88,8 +104,12 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR async def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -101,6 +121,14 @@ async def list( stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -120,6 +148,10 @@ async def list( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, stops_for_location_list_params.StopsForLocationListParams, ), diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_params.py b/src/onebusaway/types/search_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_stop_retrieve_params.py b/src/onebusaway/types/search_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_stop_retrieve_response.py b/src/onebusaway/types/search_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py old mode 100644 new mode 100755 index e8d5496..3174257 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -2,12 +2,26 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = ["StopsForLocationListParams"] class StopsForLocationListParams(TypedDict, total=False): - lat: float + lat: Required[float] + + lon: Required[float] + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + query: str + """A search query string to filter the results""" - lon: float + radius: float + """The radius in meters to search within""" diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py old mode 100644 new mode 100755 diff --git a/src/open_transit/lib/.keep b/src/open_transit/lib/.keep old mode 100644 new mode 100755 diff --git a/tests/__init__.py b/tests/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py old mode 100644 new mode 100755 index ebe72d8..fcb2f07 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -19,7 +19,10 @@ class TestStopsForLocation: @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.list() + stops_for_location = client.stops_for_location.list( + lat=0, + lon=0, + ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize @@ -27,12 +30,19 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: stops_for_location = client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.list() + response = client.stops_for_location.with_raw_response.list( + lat=0, + lon=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -41,7 +51,10 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.list() as response: + with client.stops_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,7 +69,10 @@ class TestAsyncStopsForLocation: @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.list() + stops_for_location = await async_client.stops_for_location.list( + lat=0, + lon=0, + ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize @@ -64,12 +80,19 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.list() + response = await async_client.stops_for_location.with_raw_response.list( + lat=0, + lon=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -78,7 +101,10 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.list() as response: + async with async_client.stops_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100644 new mode 100755 diff --git a/tests/sample_file.txt b/tests/sample_file.txt old mode 100644 new mode 100755 diff --git a/tests/test_client.py b/tests/test_client.py old mode 100644 new mode 100755 diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py old mode 100644 new mode 100755 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py old mode 100644 new mode 100755 diff --git a/tests/test_files.py b/tests/test_files.py old mode 100644 new mode 100755 diff --git a/tests/test_models.py b/tests/test_models.py old mode 100644 new mode 100755 diff --git a/tests/test_qs.py b/tests/test_qs.py old mode 100644 new mode 100755 diff --git a/tests/test_required_args.py b/tests/test_required_args.py old mode 100644 new mode 100755 diff --git a/tests/test_response.py b/tests/test_response.py old mode 100644 new mode 100755 diff --git a/tests/test_streaming.py b/tests/test_streaming.py old mode 100644 new mode 100755 diff --git a/tests/test_transform.py b/tests/test_transform.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py old mode 100644 new mode 100755 diff --git a/tests/utils.py b/tests/utils.py old mode 100644 new mode 100755 From 38860c19de2e79ab7ca5054c2ec9357a1fd3690b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:25:06 +0000 Subject: [PATCH 09/23] chore(client): fix parsing union responses when non-json is returned (#91) --- src/onebusaway/_models.py | 2 ++ tests/test_response.py | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py index 5148d5a..d386eaa 100755 --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -380,6 +380,8 @@ def is_basemodel(type_: type) -> bool: def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) diff --git a/tests/test_response.py b/tests/test_response.py index df94f16..3d799b5 100755 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1,5 +1,5 @@ import json -from typing import List, cast +from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx @@ -188,3 +188,40 @@ async def test_async_response_parse_annotated_type(async_client: AsyncOnebusaway ) assert obj.foo == "hello!" assert obj.bar == 2 + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: OnebusawaySDK) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncOnebusawaySDK) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" From 19a03345944154c4db06c96304e2e9b5bb2cbc57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:27:54 +0000 Subject: [PATCH 10/23] chore(ci): also run pydantic v1 tests (#92) --- scripts/test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/test b/scripts/test index b3ace90..4fa5698 100755 --- a/scripts/test +++ b/scripts/test @@ -54,3 +54,6 @@ fi echo "==> Running tests" rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" From be44ac517f04b963fc27b68d07f94b7da9fb7380 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:55:52 +0000 Subject: [PATCH 11/23] feat(api): OpenAPI spec update via Stainless API (#93) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index aa31abd..495e5b8 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-481b0f5d51c8b998b4f1939c96da73e5afcbe4e1fd9189a4cc3b00721c47a70b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5d3578218e0a9a09a4a4b3ee87d01c3ff80bbb80a280f8e2c8e700daf814ad59.yml From 2ebd77c7d359fd48b7ed8104223db7abc0157de1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:11:35 +0000 Subject: [PATCH 12/23] feat(api): OpenAPI spec update via Stainless API (#94) --- .stats.yml | 2 +- src/onebusaway/types/stops_for_route_list_response.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 495e5b8..4cc10ee 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5d3578218e0a9a09a4a4b3ee87d01c3ff80bbb80a280f8e2c8e700daf814ad59.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a544d1ade5b8bb78126cb4b1c3d63d7e77da8ef302ad4a92e3eeb86964d90c4a.yml diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 2aa1644..53cff4e 100755 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -66,9 +66,9 @@ class StopsForRouteListResponseDataEntry(BaseModel): class StopsForRouteListResponseData(BaseModel): - entry: Optional[StopsForRouteListResponseDataEntry] = None + entry: StopsForRouteListResponseDataEntry - references: Optional[References] = None + references: References class StopsForRouteListResponse(ResponseWrapper): From e2d0f6611c6309c2ee176bcfd7b7d47a368ea85e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:38:08 +0000 Subject: [PATCH 13/23] release: 0.1.0-alpha.18 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e2f2c07..3cf71e6 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.17" + ".": "0.1.0-alpha.18" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5ed6e..40c47e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.1.0-alpha.18 (2024-08-20) + +Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/OneBusAway/python-sdk/issues/81)) ([71f8ac8](https://github.com/OneBusAway/python-sdk/commit/71f8ac8808bc984dc772435e3dd25fb851a27156)) +* **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/OneBusAway/python-sdk/issues/85)) ([87a9f3f](https://github.com/OneBusAway/python-sdk/commit/87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084)) +* **api:** OpenAPI spec update via Stainless API ([#86](https://github.com/OneBusAway/python-sdk/issues/86)) ([d63524a](https://github.com/OneBusAway/python-sdk/commit/d63524a8e1e7a3ab863e964f2f81069fdd4e5761)) +* **api:** OpenAPI spec update via Stainless API ([#87](https://github.com/OneBusAway/python-sdk/issues/87)) ([d4f2ca0](https://github.com/OneBusAway/python-sdk/commit/d4f2ca03ce7778c127e70a6f7db86e0fb667e157)) +* **api:** OpenAPI spec update via Stainless API ([#88](https://github.com/OneBusAway/python-sdk/issues/88)) ([3543b38](https://github.com/OneBusAway/python-sdk/commit/3543b38cf9e4b8a4762c41f494c8f54a6451d091)) +* **api:** OpenAPI spec update via Stainless API ([#89](https://github.com/OneBusAway/python-sdk/issues/89)) ([b56865a](https://github.com/OneBusAway/python-sdk/commit/b56865a9f16ef4117ac278dec6174a3507b4b1dc)) +* **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/OneBusAway/python-sdk/issues/93)) ([be44ac5](https://github.com/OneBusAway/python-sdk/commit/be44ac517f04b963fc27b68d07f94b7da9fb7380)) +* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/OneBusAway/python-sdk/issues/94)) ([2ebd77c](https://github.com/OneBusAway/python-sdk/commit/2ebd77c7d359fd48b7ed8104223db7abc0157de1)) + + +### Chores + +* **ci:** also run pydantic v1 tests ([#92](https://github.com/OneBusAway/python-sdk/issues/92)) ([19a0334](https://github.com/OneBusAway/python-sdk/commit/19a03345944154c4db06c96304e2e9b5bb2cbc57)) +* **client:** fix parsing union responses when non-json is returned ([#91](https://github.com/OneBusAway/python-sdk/issues/91)) ([38860c1](https://github.com/OneBusAway/python-sdk/commit/38860c19de2e79ab7ca5054c2ec9357a1fd3690b)) +* **internal:** codegen related update ([#83](https://github.com/OneBusAway/python-sdk/issues/83)) ([bb39847](https://github.com/OneBusAway/python-sdk/commit/bb398472831ec5623b587568acfd99ecd44be886)) +* **internal:** use different 32bit detection method ([#84](https://github.com/OneBusAway/python-sdk/issues/84)) ([8dbeb49](https://github.com/OneBusAway/python-sdk/commit/8dbeb49a6f799aaef5214d77cfa46ae0d45fd635)) + ## 0.1.0-alpha.17 (2024-08-12) Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) diff --git a/pyproject.toml b/pyproject.toml index 12eaef3..6482a9b 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.17" +version = "0.1.0-alpha.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f3b8c3d..64d65a3 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.17" # x-release-please-version +__version__ = "0.1.0-alpha.18" # x-release-please-version From fe7ffd4390455897635899ebfeb599bc915307b6 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:40:30 +0300 Subject: [PATCH 14/23] chore: Update shape_id in shape.py --- examples/shape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/shape.py b/examples/shape.py index df3ee0a..6a12f22 100644 --- a/examples/shape.py +++ b/examples/shape.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -shape_id = '1_10002005' +shape_id = "1_10002005" response = oba.shape.retrieve(shape_id) if response and response.data: print(response.data.entry) From d55df6be5317f3d0ac85197d13a314b2dac4f6fc Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:40:32 +0300 Subject: [PATCH 15/23] feat: Update block_id in block.py --- examples/block.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/block.py b/examples/block.py index 3388a5e..1d819bd 100644 --- a/examples/block.py +++ b/examples/block.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -block_id = '1_7310845' +block_id = "1_7310845" response = oba.block.retrieve(block_id) if response and response.data: print(response.data.entry) From 6e7f4706ebcb41defc4f083771e7f09e469ca983 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:43:16 +0300 Subject: [PATCH 16/23] refactor: Update method name in agencies_with_coverage.py --- examples/agencies_with_coverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/agencies_with_coverage.py b/examples/agencies_with_coverage.py index 0e239ed..87a5fb3 100644 --- a/examples/agencies_with_coverage.py +++ b/examples/agencies_with_coverage.py @@ -17,5 +17,5 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -response = oba.agencies_with_coverage.retrieve() +response = oba.agencies_with_coverage.list() pprint(response.data) From f51f17aa85e99327c48b772af6d686f7dce49a64 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Tue, 20 Aug 2024 22:43:19 +0300 Subject: [PATCH 17/23] refactor: Update stops_for_location method name in stops_for_location.py --- examples/stops_for_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index ea9b153..118d8f7 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -17,7 +17,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -space_needle_stops = oba.stops_for_location.retrieve( +space_needle_stops = oba.stops_for_location.list( lat=47.6205, lon=-122.3493, ) From 54d58cf81718aee18e852dda9ad260dfa9392404 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:21:42 +0000 Subject: [PATCH 18/23] feat(api): OpenAPI spec update via Stainless API (#95) --- .stats.yml | 2 +- src/onebusaway/types/routes_for_agency_list_response.py | 8 ++++---- src/onebusaway/types/routes_for_location_list_response.py | 8 ++++---- .../types/search_for_route_retrieve_response.py | 8 ++++---- src/onebusaway/types/shared/references.py | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4cc10ee..07ba8ae 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a544d1ade5b8bb78126cb4b1c3d63d7e77da8ef302ad4a92e3eeb86964d90c4a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-83d4377b09e39943094f0bda53346388c12f40aa4646da2344e99116b5717e21.yml diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 5ff3242..672141d 100755 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -12,9 +12,11 @@ class RoutesForAgencyListResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -28,8 +30,6 @@ class RoutesForAgencyListResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index 41fb72c..0393f01 100755 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -16,9 +16,11 @@ class RoutesForLocationListResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,8 +34,6 @@ class RoutesForLocationListResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py index 8eaa0d1..0ed8dc3 100755 --- a/src/onebusaway/types/search_for_route_retrieve_response.py +++ b/src/onebusaway/types/search_for_route_retrieve_response.py @@ -16,9 +16,11 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,8 +34,6 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 6b8ecd6..98e9026 100755 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -50,9 +50,11 @@ class Agency(BaseModel): class Route(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -66,8 +68,6 @@ class Route(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None From 7cc92e8d051f011599844cd9d3851521a94cc49b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:23:28 +0000 Subject: [PATCH 19/23] feat(api): OpenAPI spec update via Stainless API (#96) --- .stats.yml | 2 +- src/onebusaway/types/route_retrieve_response.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 07ba8ae..b826c0b 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-83d4377b09e39943094f0bda53346388c12f40aa4646da2344e99116b5717e21.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-cffcd7dbe7a6265368945b6f8fc3e8916930710bd0f34a49f914cdcf3da5f4f9.yml diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index 7a153e8..a0dfa1e 100755 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -12,9 +12,11 @@ class RouteRetrieveResponseDataEntry(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -22,12 +24,12 @@ class RouteRetrieveResponseDataEntry(BaseModel): long_name: Optional[str] = FieldInfo(alias="longName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None From c3ca610df71affbe1381fcfa5a85f22614098beb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:37:02 +0000 Subject: [PATCH 20/23] feat(api): OpenAPI spec update via Stainless API (#97) --- .stats.yml | 2 +- .../arrival_and_departure_list_response.py | 126 +++++++++--------- ...arrival_and_departure_retrieve_response.py | 126 +++++++++--------- 3 files changed, 127 insertions(+), 127 deletions(-) diff --git a/.stats.yml b/.stats.yml index b826c0b..e8d181d 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 28 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-cffcd7dbe7a6265368945b6f8fc3e8916930710bd0f34a49f914cdcf3da5f4f9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b2ed1f0adc6090a8bea561c2a33d10e568a72db450c59858ea8e41cf3127c398.yml diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index 0f40a34..cbabf18 100755 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -136,18 +136,75 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" @@ -160,12 +217,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -175,27 +226,12 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -211,59 +247,23 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureListResponseDataEntry(BaseModel): arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index e3b7d27..a0bc771 100755 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -135,18 +135,75 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + departure_enabled: bool = FieldInfo(alias="departureEnabled") """Indicates if riders can depart from this transit vehicle.""" + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) """Distance of the arriving transit vehicle from the stop, in meters.""" @@ -159,12 +216,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -174,27 +225,12 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -210,59 +246,23 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - """ - Time, in milliseconds since the Unix epoch, of midnight for the start of the - service date for the trip. - """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry From 5468907372bcac765dfab488d6ec8992752e6658 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:37:16 +0000 Subject: [PATCH 21/23] release: 0.1.0-alpha.18 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 26 ++++++++++++++++++++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e2f2c07..3cf71e6 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.17" + ".": "0.1.0-alpha.18" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5ed6e..d593bcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.1.0-alpha.18 (2024-08-20) + +Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/OneBusAway/python-sdk/issues/81)) ([71f8ac8](https://github.com/OneBusAway/python-sdk/commit/71f8ac8808bc984dc772435e3dd25fb851a27156)) +* **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/OneBusAway/python-sdk/issues/85)) ([87a9f3f](https://github.com/OneBusAway/python-sdk/commit/87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084)) +* **api:** OpenAPI spec update via Stainless API ([#86](https://github.com/OneBusAway/python-sdk/issues/86)) ([d63524a](https://github.com/OneBusAway/python-sdk/commit/d63524a8e1e7a3ab863e964f2f81069fdd4e5761)) +* **api:** OpenAPI spec update via Stainless API ([#87](https://github.com/OneBusAway/python-sdk/issues/87)) ([d4f2ca0](https://github.com/OneBusAway/python-sdk/commit/d4f2ca03ce7778c127e70a6f7db86e0fb667e157)) +* **api:** OpenAPI spec update via Stainless API ([#88](https://github.com/OneBusAway/python-sdk/issues/88)) ([3543b38](https://github.com/OneBusAway/python-sdk/commit/3543b38cf9e4b8a4762c41f494c8f54a6451d091)) +* **api:** OpenAPI spec update via Stainless API ([#89](https://github.com/OneBusAway/python-sdk/issues/89)) ([b56865a](https://github.com/OneBusAway/python-sdk/commit/b56865a9f16ef4117ac278dec6174a3507b4b1dc)) +* **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/OneBusAway/python-sdk/issues/93)) ([be44ac5](https://github.com/OneBusAway/python-sdk/commit/be44ac517f04b963fc27b68d07f94b7da9fb7380)) +* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/OneBusAway/python-sdk/issues/94)) ([2ebd77c](https://github.com/OneBusAway/python-sdk/commit/2ebd77c7d359fd48b7ed8104223db7abc0157de1)) +* **api:** OpenAPI spec update via Stainless API ([#95](https://github.com/OneBusAway/python-sdk/issues/95)) ([54d58cf](https://github.com/OneBusAway/python-sdk/commit/54d58cf81718aee18e852dda9ad260dfa9392404)) +* **api:** OpenAPI spec update via Stainless API ([#96](https://github.com/OneBusAway/python-sdk/issues/96)) ([7cc92e8](https://github.com/OneBusAway/python-sdk/commit/7cc92e8d051f011599844cd9d3851521a94cc49b)) +* **api:** OpenAPI spec update via Stainless API ([#97](https://github.com/OneBusAway/python-sdk/issues/97)) ([c3ca610](https://github.com/OneBusAway/python-sdk/commit/c3ca610df71affbe1381fcfa5a85f22614098beb)) + + +### Chores + +* **ci:** also run pydantic v1 tests ([#92](https://github.com/OneBusAway/python-sdk/issues/92)) ([19a0334](https://github.com/OneBusAway/python-sdk/commit/19a03345944154c4db06c96304e2e9b5bb2cbc57)) +* **client:** fix parsing union responses when non-json is returned ([#91](https://github.com/OneBusAway/python-sdk/issues/91)) ([38860c1](https://github.com/OneBusAway/python-sdk/commit/38860c19de2e79ab7ca5054c2ec9357a1fd3690b)) +* **internal:** codegen related update ([#83](https://github.com/OneBusAway/python-sdk/issues/83)) ([bb39847](https://github.com/OneBusAway/python-sdk/commit/bb398472831ec5623b587568acfd99ecd44be886)) +* **internal:** use different 32bit detection method ([#84](https://github.com/OneBusAway/python-sdk/issues/84)) ([8dbeb49](https://github.com/OneBusAway/python-sdk/commit/8dbeb49a6f799aaef5214d77cfa46ae0d45fd635)) + ## 0.1.0-alpha.17 (2024-08-12) Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) diff --git a/pyproject.toml b/pyproject.toml index 12eaef3..6482a9b 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.17" +version = "0.1.0-alpha.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index f3b8c3d..64d65a3 100755 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "0.1.0-alpha.17" # x-release-please-version +__version__ = "0.1.0-alpha.18" # x-release-please-version From 2b530418373d776a8d59c4e91b6ea028df7a1ecb Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Wed, 21 Aug 2024 01:59:15 +0300 Subject: [PATCH 22/23] refactor: update memory leaks tests --- tests/test_client.py | 248 +++++++++++++++++++++---------------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index a68fac1..06ae42b 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,13 +2,13 @@ from __future__ import annotations -# import gc +import gc import os import json import asyncio import inspect -# import tracemalloc +import tracemalloc from typing import Any, Union, cast from unittest import mock @@ -185,67 +185,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - # # - # # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -891,67 +891,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - - # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() async def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) From f83c6d18a8000cdb98a2e0244c127a08a427c1cc Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Wed, 21 Aug 2024 02:04:55 +0300 Subject: [PATCH 23/23] refactor: format test_client code --- tests/test_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 06ae42b..abc4d37 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -7,7 +7,6 @@ import json import asyncio import inspect - import tracemalloc from typing import Any, Union, cast from unittest import mock