diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dc8ed9b..2171c6e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.4" + ".": "1.8.5" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3934b2e..7545938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.8.5 (2025-05-15) + +Full Changelog: [v1.8.4...v1.8.5](https://github.com/OneBusAway/python-sdk/compare/v1.8.4...v1.8.5) + +### Chores + +* **internal:** codegen related update ([#288](https://github.com/OneBusAway/python-sdk/issues/288)) ([d301a0c](https://github.com/OneBusAway/python-sdk/commit/d301a0cf24104ff0d791046c99093f3c47365bf3)) + ## 1.8.4 (2025-03-27) Full Changelog: [v1.8.3...v1.8.4](https://github.com/OneBusAway/python-sdk/compare/v1.8.3...v1.8.4) diff --git a/README.md b/README.md index 8bc5b4e..fdae5e7 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,8 @@ client = AsyncOnebusawaySDK( api_key=os.environ.get("ONEBUSAWAY_API_KEY"), # This is the default and can be omitted ) - async def main() -> None: - current_time = await client.current_time.retrieve() - + current_time = await client.current_time.retrieve() asyncio.run(main()) ``` @@ -92,7 +90,7 @@ try: client.current_time.retrieve() except onebusaway.APIConnectionError as e: print("The server could not be reached") - print(e.__cause__) # an underlying Exception, likely raised within httpx. + print(e.__cause__) # an underlying Exception, likely raised within httpx. except onebusaway.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") except onebusaway.APIStatusError as e: @@ -132,7 +130,7 @@ client = OnebusawaySDK( ) # Or, configure per-request: -client.with_options(max_retries=5).current_time.retrieve() +client.with_options(max_retries = 5).current_time.retrieve() ``` ### Timeouts @@ -155,7 +153,7 @@ client = OnebusawaySDK( ) # Override per-request: -client.with_options(timeout=5.0).current_time.retrieve() +client.with_options(timeout = 5.0).current_time.retrieve() ``` On timeout, an `APITimeoutError` is thrown. @@ -214,11 +212,11 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.current_time.with_streaming_response.retrieve() as response: - print(response.headers.get("X-My-Header")) +with client.current_time.with_streaming_response.retrieve() as response : + print(response.headers.get('X-My-Header')) for line in response.iter_lines(): - print(line) + print(line) ``` The context manager is required so that the response will reliably be closed. @@ -272,10 +270,7 @@ from onebusaway import OnebusawaySDK, DefaultHttpxClient client = OnebusawaySDK( # Or use the `ONEBUSAWAY_SDK_BASE_URL` env var base_url="http://my.test.server.example.com:8083", - http_client=DefaultHttpxClient( - proxy="http://my.test.proxy.example.com", - transport=httpx.HTTPTransport(local_address="0.0.0.0"), - ), + http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")), ) ``` diff --git a/pyproject.toml b/pyproject.toml index 6b048b7..ee6e992 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.8.4" +version = "1.8.5" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/requirements-dev.lock b/requirements-dev.lock index e00b078..1f3d089 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -14,7 +14,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via sdk-pythonpackagename argcomplete==3.1.2 # via nox certifi==2023.7.22 @@ -26,7 +26,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via onebusaway + # via sdk-pythonpackagename exceptiongroup==1.2.2 # via anyio # via pytest @@ -37,8 +37,8 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 - # via onebusaway # via respx + # via sdk-pythonpackagename idna==3.4 # via anyio # via httpx @@ -64,7 +64,7 @@ platformdirs==3.11.0 pluggy==1.5.0 # via pytest pydantic==2.10.3 - # via onebusaway + # via sdk-pythonpackagename pydantic-core==2.27.1 # via pydantic pygments==2.18.0 @@ -86,7 +86,7 @@ six==1.16.0 # via python-dateutil sniffio==1.3.0 # via anyio - # via onebusaway + # via sdk-pythonpackagename time-machine==2.9.0 tomli==2.0.2 # via mypy @@ -94,10 +94,10 @@ tomli==2.0.2 typing-extensions==4.12.2 # via anyio # via mypy - # via onebusaway # via pydantic # via pydantic-core # via pyright + # via sdk-pythonpackagename virtualenv==20.24.5 # via nox zipp==3.17.0 diff --git a/requirements.lock b/requirements.lock index cf5c8e0..26eb37b 100644 --- a/requirements.lock +++ b/requirements.lock @@ -14,12 +14,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via httpx - # via onebusaway + # via sdk-pythonpackagename certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via onebusaway + # via sdk-pythonpackagename exceptiongroup==1.2.2 # via anyio h11==0.14.0 @@ -27,19 +27,19 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.28.1 - # via onebusaway + # via sdk-pythonpackagename idna==3.4 # via anyio # via httpx pydantic==2.10.3 - # via onebusaway + # via sdk-pythonpackagename pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 # via anyio - # via onebusaway + # via sdk-pythonpackagename typing-extensions==4.12.2 # via anyio - # via onebusaway # via pydantic # via pydantic-core + # via sdk-pythonpackagename diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py index 0cf2bd2..37b3d94 100644 --- a/scripts/utils/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f"{match['before']}{code}{match['after']}" + return f'{match["before"]}{code}{match["after"]}' def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f"{match['before']}{code}{match['after']}" + return f'{match["before"]}{code}{match["after"]}' src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py index 2e0349f..948ea95 100644 --- a/src/onebusaway/__init__.py +++ b/src/onebusaway/__init__.py @@ -37,46 +37,7 @@ from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging -__all__ = [ - "types", - "__version__", - "__title__", - "NoneType", - "Transport", - "ProxiesTypes", - "NotGiven", - "NOT_GIVEN", - "Omit", - "OnebusawaySDKError", - "APIError", - "APIStatusError", - "APITimeoutError", - "APIConnectionError", - "APIResponseValidationError", - "BadRequestError", - "AuthenticationError", - "PermissionDeniedError", - "NotFoundError", - "ConflictError", - "UnprocessableEntityError", - "RateLimitError", - "InternalServerError", - "Timeout", - "RequestOptions", - "Client", - "AsyncClient", - "Stream", - "AsyncStream", - "OnebusawaySDK", - "AsyncOnebusawaySDK", - "file_from_path", - "BaseModel", - "DEFAULT_TIMEOUT", - "DEFAULT_MAX_RETRIES", - "DEFAULT_CONNECTION_LIMITS", - "DefaultHttpxClient", - "DefaultAsyncHttpxClient", -] +__all__ = ["types", "__version__", "__title__", "NoneType", "Transport", "ProxiesTypes", "NotGiven", "NOT_GIVEN", "Omit", "OnebusawaySDKError", "APIError", "APIStatusError", "APITimeoutError", "APIConnectionError", "APIResponseValidationError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError", "Timeout", "RequestOptions", "Client", "AsyncClient", "Stream", "AsyncStream", "OnebusawaySDK", "AsyncOnebusawaySDK", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", "DEFAULT_MAX_RETRIES", "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient"] _setup_logging() @@ -88,7 +49,7 @@ for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "onebusaway" + __locals[__name].__module__ = "onebusaway" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. - pass + pass \ No newline at end of file diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py index 8ee4250..f99a333 100644 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -203,7 +203,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: self.__pydantic_private__ = {} self._model = model @@ -291,7 +291,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if PYDANTIC_V2 and getattr(self, '__pydantic_private__', None) is None: self.__pydantic_private__ = {} self._model = model @@ -608,7 +608,7 @@ def default_headers(self) -> dict[str, str | Omit]: "Accept": "application/json", "Content-Type": "application/json", "User-Agent": self.user_agent, - **self.platform_headers(), +**self.platform_headers(), **self.auth_headers, **self._custom_headers, } @@ -994,6 +994,7 @@ def _request( response.reason_phrase, response.headers, ) + try: response.raise_for_status() @@ -1069,6 +1070,8 @@ def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: + + origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): @@ -1592,6 +1595,8 @@ async def _process_response( stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, retries_taken: int = 0, ) -> ResponseT: + + origin = get_origin(cast_to) or cast_to if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index e14128b..e11449e 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -62,17 +62,7 @@ AsyncAPIClient, ) -__all__ = [ - "Timeout", - "Transport", - "ProxiesTypes", - "RequestOptions", - "OnebusawaySDK", - "AsyncOnebusawaySDK", - "Client", - "AsyncClient", -] - +__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "OnebusawaySDK", "AsyncOnebusawaySDK", "Client", "AsyncClient"] class OnebusawaySDK(SyncAPIClient): agencies_with_coverage: agencies_with_coverage.AgenciesWithCoverageResource @@ -109,56 +99,38 @@ class OnebusawaySDK(SyncAPIClient): # client options api_key: str - def __init__( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, - max_retries: int = DEFAULT_MAX_RETRIES, - default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. - http_client: httpx.Client | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False, - ) -> None: + def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + http_client: httpx.Client | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False) -> None: """Construct a new synchronous OnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__( - version=__version__, - base_url=base_url, - max_retries=max_retries, - timeout=timeout, - http_client=http_client, - custom_headers=default_headers, - custom_query=default_query, - _strict_response_validation=_strict_response_validation, - ) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResource(self) self.agency = agency.AgencyResource(self) @@ -205,42 +177,33 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": "false", - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": "false", + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, - default_headers: Mapping[str, str] | None = None, - set_default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - set_default_query: Mapping[str, object] | None = None, - _extra_kwargs: Mapping[str, Any] = {}, - ) -> Self: + def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + raise ValueError( + 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' + ) if default_query is not None and set_default_query is not None: - raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + raise ValueError( + 'The `default_query` and `set_default_query` arguments are mutually exclusive' + ) headers = self._custom_headers if default_headers is not None: @@ -255,29 +218,14 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( - api_key=api_key or self.api_key, - base_url=base_url or self.base_url, - timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, - http_client=http_client, - max_retries=max_retries if is_given(max_retries) else self.max_retries, - default_headers=headers, - default_query=params, - **_extra_kwargs, - ) + return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error( - self, - err_msg: str, - *, - body: object, - response: httpx.Response, - ) -> APIStatusError: + def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -303,7 +251,6 @@ def _make_status_error( return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) - class AsyncOnebusawaySDK(AsyncAPIClient): agencies_with_coverage: agencies_with_coverage.AsyncAgenciesWithCoverageResource agency: agency.AsyncAgencyResource @@ -339,56 +286,38 @@ class AsyncOnebusawaySDK(AsyncAPIClient): # client options api_key: str - def __init__( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, - max_retries: int = DEFAULT_MAX_RETRIES, - default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. - # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. - # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. - http_client: httpx.AsyncClient | None = None, - # Enable or disable schema validation for data returned by the API. - # When enabled an error APIResponseValidationError is raised - # if the API responds with invalid data for the expected schema. - # - # This parameter may be removed or changed in the future. - # If you rely on this feature, please open a GitHub issue - # outlining your use-case to help us decide if it should be - # part of our public interface in the future. - _strict_response_validation: bool = False, - ) -> None: + def __init__(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + http_client: httpx.AsyncClient | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False) -> None: """Construct a new async AsyncOnebusawaySDK client instance. This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided. """ if api_key is None: - api_key = os.environ.get("ONEBUSAWAY_API_KEY") + api_key = os.environ.get("ONEBUSAWAY_API_KEY") if api_key is None: - raise OnebusawaySDKError( - "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" - ) + raise OnebusawaySDKError( + "The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable" + ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") + base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL") if base_url is None: - base_url = f"https://api.pugetsound.onebusaway.org" - - super().__init__( - version=__version__, - base_url=base_url, - max_retries=max_retries, - timeout=timeout, - http_client=http_client, - custom_headers=default_headers, - custom_query=default_query, - _strict_response_validation=_strict_response_validation, - ) + base_url = f"https://api.pugetsound.onebusaway.org" + + super().__init__(version=__version__, base_url=base_url, max_retries=max_retries, timeout=timeout, http_client=http_client, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation) self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResource(self) self.agency = agency.AsyncAgencyResource(self) @@ -435,42 +364,33 @@ def auth_headers(self) -> dict[str, str]: @override def default_headers(self) -> dict[str, str | Omit]: return { - **super().default_headers, - "X-Stainless-Async": f"async:{get_async_library()}", - **self._custom_headers, + **super().default_headers, + "X-Stainless-Async": f'async:{get_async_library()}', + **self._custom_headers, } @property @override def default_query(self) -> dict[str, object]: return { - **super().default_query, - "key": self.api_key, - **self._custom_query, + **super().default_query, + "key": self.api_key, + **self._custom_query, } - def copy( - self, - *, - api_key: str | None = None, - base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, - default_headers: Mapping[str, str] | None = None, - set_default_headers: Mapping[str, str] | None = None, - default_query: Mapping[str, object] | None = None, - set_default_query: Mapping[str, object] | None = None, - _extra_kwargs: Mapping[str, Any] = {}, - ) -> Self: + def copy(self, *, api_key: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, max_retries: int | NotGiven = NOT_GIVEN, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, set_default_query: Mapping[str, object] | None = None, _extra_kwargs: Mapping[str, Any] = {}) -> Self: """ Create a new client instance re-using the same options given to the current client with optional overriding. """ if default_headers is not None and set_default_headers is not None: - raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + raise ValueError( + 'The `default_headers` and `set_default_headers` arguments are mutually exclusive' + ) if default_query is not None and set_default_query is not None: - raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + raise ValueError( + 'The `default_query` and `set_default_query` arguments are mutually exclusive' + ) headers = self._custom_headers if default_headers is not None: @@ -485,29 +405,14 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( - api_key=api_key or self.api_key, - base_url=base_url or self.base_url, - timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, - http_client=http_client, - max_retries=max_retries if is_given(max_retries) else self.max_retries, - default_headers=headers, - default_query=params, - **_extra_kwargs, - ) + return self.__class__(api_key = api_key or self.api_key, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, **_extra_kwargs) # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) with_options = copy @override - def _make_status_error( - self, - err_msg: str, - *, - body: object, - response: httpx.Response, - ) -> APIStatusError: + def _make_status_error(self, err_msg: str, *, body: object, response: httpx.Response,) -> APIStatusError: if response.status_code == 400: return _exceptions.BadRequestError(err_msg, response=response, body=body) @@ -533,235 +438,130 @@ def _make_status_error( return _exceptions.InternalServerError(err_msg, response=response, body=body) return APIStatusError(err_msg, response=response, body=body) - class OnebusawaySDKWithRawResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) self.agency = agency.AgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = config.ConfigResourceWithRawResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithRawResponse(client.current_time) self.stops_for_location = stops_for_location.StopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = stops_for_route.StopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.StopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.RouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency) self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithRawResponse(client.schedule_for_route) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = trip.TripResourceWithRawResponse(client.trip) self.trips_for_location = trips_for_location.TripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = trip_details.TripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.SearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.BlockResourceWithRawResponse(client.block) self.shape = shape.ShapeResourceWithRawResponse(client.shape) - class AsyncOnebusawaySDKWithRawResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithRawResponse(client.agencies_with_coverage) self.agency = agency.AsyncAgencyResourceWithRawResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency) self.config = config.AsyncConfigResourceWithRawResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithRawResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithRawResponse(client.stops_for_agency) self.stop = stop.AsyncStopResourceWithRawResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse( - client.stop_ids_for_agency - ) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency) self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop) self.route = route.AsyncRouteResourceWithRawResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse( - client.routes_for_location - ) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithRawResponse(client.routes_for_location) self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse( - client.arrival_and_departure - ) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithRawResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure) self.trip = trip.AsyncTripResourceWithRawResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location) self.trip_details = trip_details.AsyncTripDetailsResourceWithRawResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithRawResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithRawResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop) self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route) self.block = block.AsyncBlockResourceWithRawResponse(client.block) self.shape = shape.AsyncShapeResourceWithRawResponse(client.shape) - class OnebusawaySDKWithStreamedResponse: def __init__(self, client: OnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) self.agency = agency.AgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = config.ConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.CurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.StopsForLocationResourceWithStreamingResponse(client.stops_for_location) self.stops_for_route = stops_for_route.StopsForRouteResourceWithStreamingResponse(client.stops_for_route) self.stops_for_agency = stops_for_agency.StopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = stop.StopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) + self.stop_ids_for_agency = stop_ids_for_agency.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) + self.schedule_for_stop = schedule_for_stop.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = route.RouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) + self.route_ids_for_agency = route_ids_for_agency.RouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.RoutesForLocationResourceWithStreamingResponse(client.routes_for_location) + self.routes_for_agency = routes_for_agency.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.ScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) self.trip = trip.TripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.TripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = trip_details.TripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = trip_for_vehicle.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) + self.report_problem_with_stop = report_problem_with_stop.ReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.ReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.SearchForStopResourceWithStreamingResponse(client.search_for_stop) self.search_for_route = search_for_route.SearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = block.BlockResourceWithStreamingResponse(client.block) self.shape = shape.ShapeResourceWithStreamingResponse(client.shape) - class AsyncOnebusawaySDKWithStreamedResponse: def __init__(self, client: AsyncOnebusawaySDK) -> None: - self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse( - client.agencies_with_coverage - ) + self.agencies_with_coverage = agencies_with_coverage.AsyncAgenciesWithCoverageResourceWithStreamingResponse(client.agencies_with_coverage) self.agency = agency.AsyncAgencyResourceWithStreamingResponse(client.agency) - self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse( - client.vehicles_for_agency - ) + self.vehicles_for_agency = vehicles_for_agency.AsyncVehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency) self.config = config.AsyncConfigResourceWithStreamingResponse(client.config) self.current_time = current_time.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time) - self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse( - client.stops_for_location - ) + self.stops_for_location = stops_for_location.AsyncStopsForLocationResourceWithStreamingResponse(client.stops_for_location) self.stops_for_route = stops_for_route.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route) - self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse( - client.stops_for_agency - ) + self.stops_for_agency = stops_for_agency.AsyncStopsForAgencyResourceWithStreamingResponse(client.stops_for_agency) self.stop = stop.AsyncStopResourceWithStreamingResponse(client.stop) - self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse( - client.stop_ids_for_agency - ) - self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse( - client.schedule_for_stop - ) + self.stop_ids_for_agency = stop_ids_for_agency.AsyncStopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency) + self.schedule_for_stop = schedule_for_stop.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop) self.route = route.AsyncRouteResourceWithStreamingResponse(client.route) - self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse( - client.route_ids_for_agency - ) - self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse( - client.routes_for_location - ) - self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse( - client.routes_for_agency - ) - self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse( - client.schedule_for_route - ) - self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse( - client.arrival_and_departure - ) + self.route_ids_for_agency = route_ids_for_agency.AsyncRouteIDsForAgencyResourceWithStreamingResponse(client.route_ids_for_agency) + self.routes_for_location = routes_for_location.AsyncRoutesForLocationResourceWithStreamingResponse(client.routes_for_location) + self.routes_for_agency = routes_for_agency.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency) + self.schedule_for_route = schedule_for_route.AsyncScheduleForRouteResourceWithStreamingResponse(client.schedule_for_route) + self.arrival_and_departure = arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse(client.arrival_and_departure) self.trip = trip.AsyncTripResourceWithStreamingResponse(client.trip) - self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse( - client.trips_for_location - ) + self.trips_for_location = trips_for_location.AsyncTripsForLocationResourceWithStreamingResponse(client.trips_for_location) self.trip_details = trip_details.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) - self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse( - client.trip_for_vehicle - ) + self.trip_for_vehicle = trip_for_vehicle.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) self.trips_for_route = trips_for_route.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) - self.report_problem_with_stop = ( - report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse( - client.report_problem_with_stop - ) - ) - self.report_problem_with_trip = ( - report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse( - client.report_problem_with_trip - ) - ) + self.report_problem_with_stop = report_problem_with_stop.AsyncReportProblemWithStopResourceWithStreamingResponse(client.report_problem_with_stop) + self.report_problem_with_trip = report_problem_with_trip.AsyncReportProblemWithTripResourceWithStreamingResponse(client.report_problem_with_trip) self.search_for_stop = search_for_stop.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop) - self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse( - client.search_for_route - ) + self.search_for_route = search_for_route.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route) self.block = block.AsyncBlockResourceWithStreamingResponse(client.block) self.shape = shape.AsyncShapeResourceWithStreamingResponse(client.shape) - Client = OnebusawaySDK -AsyncClient = AsyncOnebusawaySDK +AsyncClient = AsyncOnebusawaySDK \ No newline at end of file diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py index 6ddf2c7..f32ba27 100644 --- a/src/onebusaway/_constants.py +++ b/src/onebusaway/_constants.py @@ -11,4 +11,4 @@ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) INITIAL_RETRY_DELAY = 0.5 -MAX_RETRY_DELAY = 8.0 +MAX_RETRY_DELAY = 8.0 \ No newline at end of file diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py index c76aabb..dad6a31 100644 --- a/src/onebusaway/_exceptions.py +++ b/src/onebusaway/_exceptions.py @@ -6,22 +6,11 @@ import httpx -__all__ = [ - "BadRequestError", - "AuthenticationError", - "PermissionDeniedError", - "NotFoundError", - "ConflictError", - "UnprocessableEntityError", - "RateLimitError", - "InternalServerError", -] - +__all__ = ["BadRequestError", "AuthenticationError", "PermissionDeniedError", "NotFoundError", "ConflictError", "UnprocessableEntityError", "RateLimitError", "InternalServerError"] class OnebusawaySDKError(Exception): pass - class APIError(OnebusawaySDKError): message: str request: httpx.Request @@ -43,7 +32,6 @@ def __init__(self, message: str, request: httpx.Request, *, body: object | None) self.message = message self.body = body - class APIResponseValidationError(APIError): response: httpx.Response status_code: int @@ -53,10 +41,8 @@ def __init__(self, response: httpx.Response, body: object | None, *, message: st self.response = response self.status_code = response.status_code - class APIStatusError(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" - response: httpx.Response status_code: int @@ -65,44 +51,34 @@ def __init__(self, message: str, *, response: httpx.Response, body: object | Non self.response = response self.status_code = response.status_code - class APIConnectionError(APIError): def __init__(self, *, message: str = "Connection error.", request: httpx.Request) -> None: super().__init__(message, request, body=None) - class APITimeoutError(APIConnectionError): def __init__(self, request: httpx.Request) -> None: - super().__init__(message="Request timed out.", request=request) - + super().__init__(message= "Request timed out.", request=request) class BadRequestError(APIStatusError): - status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] class AuthenticationError(APIStatusError): - status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] class PermissionDeniedError(APIStatusError): - status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] class NotFoundError(APIStatusError): - status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] class ConflictError(APIStatusError): - status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] class UnprocessableEntityError(APIStatusError): - status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] class RateLimitError(APIStatusError): - status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] - + status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] class InternalServerError(APIStatusError): - pass + pass \ No newline at end of file diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py index 153115b..e20e5cd 100644 --- a/src/onebusaway/_resource.py +++ b/src/onebusaway/_resource.py @@ -8,8 +8,7 @@ import anyio if TYPE_CHECKING: - from ._client import OnebusawaySDK, AsyncOnebusawaySDK - + from ._client import OnebusawaySDK, AsyncOnebusawaySDK class SyncAPIResource: _client: OnebusawaySDK @@ -24,8 +23,7 @@ def __init__(self, client: OnebusawaySDK) -> None: self._get_api_list = client.get_api_list def _sleep(self, seconds: float) -> None: - time.sleep(seconds) - + time.sleep(seconds) class AsyncAPIResource: _client: AsyncOnebusawaySDK @@ -40,4 +38,4 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: self._get_api_list = client.get_api_list async def _sleep(self, seconds: float) -> None: - await anyio.sleep(seconds) + await anyio.sleep(seconds) \ No newline at end of file diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py index 16b6f2b..21c87fc 100644 --- a/src/onebusaway/_response.py +++ b/src/onebusaway/_response.py @@ -138,6 +138,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: origin = get_origin(cast_to) or cast_to + + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -197,6 +199,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") + if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") @@ -270,6 +273,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): + + @overload def parse(self, *, to: type[_T]) -> _T: ... @@ -372,6 +377,8 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): + + @overload async def parse(self, *, to: type[_T]) -> _T: ... diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py index 957b8da..293ffe5 100644 --- a/src/onebusaway/_streaming.py +++ b/src/onebusaway/_streaming.py @@ -53,10 +53,10 @@ def __stream__(self) -> Iterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed for _sse in iterator: ... @@ -117,10 +117,10 @@ async def __stream__(self) -> AsyncIterator[_T]: response = self.response process_data = self._client._process_response_data iterator = self._iter_events() - + async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - + # Ensure the entire stream is consumed async for _sse in iterator: ... diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py index 278749b..5e9600b 100644 --- a/src/onebusaway/_utils/_typing.py +++ b/src/onebusaway/_utils/_typing.py @@ -49,17 +49,16 @@ def is_typevar(typ: type) -> bool: if sys.version_info >= (3, 12): _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) - def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: """Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) - # > True - Str = TypeAliasType("Str", str) + #> True + Str = TypeAliasType('Str', str) is_type_alias_type(Str) - # > True + #> True ``` """ return isinstance(tp, _TYPE_ALIAS_TYPES) diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index e4402cd..ac2c376 100644 --- a/src/onebusaway/_version.py +++ b/src/onebusaway/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "onebusaway" -__version__ = "1.8.4" # x-release-please-version +__version__ = "1.8.5" # x-release-please-version diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 0a958d2..c5f49f6 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -225,173 +225,4 @@ AsyncReportProblemWithTripResourceWithStreamingResponse, ) -__all__ = [ - "AgenciesWithCoverageResource", - "AsyncAgenciesWithCoverageResource", - "AgenciesWithCoverageResourceWithRawResponse", - "AsyncAgenciesWithCoverageResourceWithRawResponse", - "AgenciesWithCoverageResourceWithStreamingResponse", - "AsyncAgenciesWithCoverageResourceWithStreamingResponse", - "AgencyResource", - "AsyncAgencyResource", - "AgencyResourceWithRawResponse", - "AsyncAgencyResourceWithRawResponse", - "AgencyResourceWithStreamingResponse", - "AsyncAgencyResourceWithStreamingResponse", - "VehiclesForAgencyResource", - "AsyncVehiclesForAgencyResource", - "VehiclesForAgencyResourceWithRawResponse", - "AsyncVehiclesForAgencyResourceWithRawResponse", - "VehiclesForAgencyResourceWithStreamingResponse", - "AsyncVehiclesForAgencyResourceWithStreamingResponse", - "ConfigResource", - "AsyncConfigResource", - "ConfigResourceWithRawResponse", - "AsyncConfigResourceWithRawResponse", - "ConfigResourceWithStreamingResponse", - "AsyncConfigResourceWithStreamingResponse", - "CurrentTimeResource", - "AsyncCurrentTimeResource", - "CurrentTimeResourceWithRawResponse", - "AsyncCurrentTimeResourceWithRawResponse", - "CurrentTimeResourceWithStreamingResponse", - "AsyncCurrentTimeResourceWithStreamingResponse", - "StopsForLocationResource", - "AsyncStopsForLocationResource", - "StopsForLocationResourceWithRawResponse", - "AsyncStopsForLocationResourceWithRawResponse", - "StopsForLocationResourceWithStreamingResponse", - "AsyncStopsForLocationResourceWithStreamingResponse", - "StopsForRouteResource", - "AsyncStopsForRouteResource", - "StopsForRouteResourceWithRawResponse", - "AsyncStopsForRouteResourceWithRawResponse", - "StopsForRouteResourceWithStreamingResponse", - "AsyncStopsForRouteResourceWithStreamingResponse", - "StopsForAgencyResource", - "AsyncStopsForAgencyResource", - "StopsForAgencyResourceWithRawResponse", - "AsyncStopsForAgencyResourceWithRawResponse", - "StopsForAgencyResourceWithStreamingResponse", - "AsyncStopsForAgencyResourceWithStreamingResponse", - "StopResource", - "AsyncStopResource", - "StopResourceWithRawResponse", - "AsyncStopResourceWithRawResponse", - "StopResourceWithStreamingResponse", - "AsyncStopResourceWithStreamingResponse", - "StopIDsForAgencyResource", - "AsyncStopIDsForAgencyResource", - "StopIDsForAgencyResourceWithRawResponse", - "AsyncStopIDsForAgencyResourceWithRawResponse", - "StopIDsForAgencyResourceWithStreamingResponse", - "AsyncStopIDsForAgencyResourceWithStreamingResponse", - "ScheduleForStopResource", - "AsyncScheduleForStopResource", - "ScheduleForStopResourceWithRawResponse", - "AsyncScheduleForStopResourceWithRawResponse", - "ScheduleForStopResourceWithStreamingResponse", - "AsyncScheduleForStopResourceWithStreamingResponse", - "RouteResource", - "AsyncRouteResource", - "RouteResourceWithRawResponse", - "AsyncRouteResourceWithRawResponse", - "RouteResourceWithStreamingResponse", - "AsyncRouteResourceWithStreamingResponse", - "RouteIDsForAgencyResource", - "AsyncRouteIDsForAgencyResource", - "RouteIDsForAgencyResourceWithRawResponse", - "AsyncRouteIDsForAgencyResourceWithRawResponse", - "RouteIDsForAgencyResourceWithStreamingResponse", - "AsyncRouteIDsForAgencyResourceWithStreamingResponse", - "RoutesForLocationResource", - "AsyncRoutesForLocationResource", - "RoutesForLocationResourceWithRawResponse", - "AsyncRoutesForLocationResourceWithRawResponse", - "RoutesForLocationResourceWithStreamingResponse", - "AsyncRoutesForLocationResourceWithStreamingResponse", - "RoutesForAgencyResource", - "AsyncRoutesForAgencyResource", - "RoutesForAgencyResourceWithRawResponse", - "AsyncRoutesForAgencyResourceWithRawResponse", - "RoutesForAgencyResourceWithStreamingResponse", - "AsyncRoutesForAgencyResourceWithStreamingResponse", - "ScheduleForRouteResource", - "AsyncScheduleForRouteResource", - "ScheduleForRouteResourceWithRawResponse", - "AsyncScheduleForRouteResourceWithRawResponse", - "ScheduleForRouteResourceWithStreamingResponse", - "AsyncScheduleForRouteResourceWithStreamingResponse", - "ArrivalAndDepartureResource", - "AsyncArrivalAndDepartureResource", - "ArrivalAndDepartureResourceWithRawResponse", - "AsyncArrivalAndDepartureResourceWithRawResponse", - "ArrivalAndDepartureResourceWithStreamingResponse", - "AsyncArrivalAndDepartureResourceWithStreamingResponse", - "TripResource", - "AsyncTripResource", - "TripResourceWithRawResponse", - "AsyncTripResourceWithRawResponse", - "TripResourceWithStreamingResponse", - "AsyncTripResourceWithStreamingResponse", - "TripsForLocationResource", - "AsyncTripsForLocationResource", - "TripsForLocationResourceWithRawResponse", - "AsyncTripsForLocationResourceWithRawResponse", - "TripsForLocationResourceWithStreamingResponse", - "AsyncTripsForLocationResourceWithStreamingResponse", - "TripDetailsResource", - "AsyncTripDetailsResource", - "TripDetailsResourceWithRawResponse", - "AsyncTripDetailsResourceWithRawResponse", - "TripDetailsResourceWithStreamingResponse", - "AsyncTripDetailsResourceWithStreamingResponse", - "TripForVehicleResource", - "AsyncTripForVehicleResource", - "TripForVehicleResourceWithRawResponse", - "AsyncTripForVehicleResourceWithRawResponse", - "TripForVehicleResourceWithStreamingResponse", - "AsyncTripForVehicleResourceWithStreamingResponse", - "TripsForRouteResource", - "AsyncTripsForRouteResource", - "TripsForRouteResourceWithRawResponse", - "AsyncTripsForRouteResourceWithRawResponse", - "TripsForRouteResourceWithStreamingResponse", - "AsyncTripsForRouteResourceWithStreamingResponse", - "ReportProblemWithStopResource", - "AsyncReportProblemWithStopResource", - "ReportProblemWithStopResourceWithRawResponse", - "AsyncReportProblemWithStopResourceWithRawResponse", - "ReportProblemWithStopResourceWithStreamingResponse", - "AsyncReportProblemWithStopResourceWithStreamingResponse", - "ReportProblemWithTripResource", - "AsyncReportProblemWithTripResource", - "ReportProblemWithTripResourceWithRawResponse", - "AsyncReportProblemWithTripResourceWithRawResponse", - "ReportProblemWithTripResourceWithStreamingResponse", - "AsyncReportProblemWithTripResourceWithStreamingResponse", - "SearchForStopResource", - "AsyncSearchForStopResource", - "SearchForStopResourceWithRawResponse", - "AsyncSearchForStopResourceWithRawResponse", - "SearchForStopResourceWithStreamingResponse", - "AsyncSearchForStopResourceWithStreamingResponse", - "SearchForRouteResource", - "AsyncSearchForRouteResource", - "SearchForRouteResourceWithRawResponse", - "AsyncSearchForRouteResourceWithRawResponse", - "SearchForRouteResourceWithStreamingResponse", - "AsyncSearchForRouteResourceWithStreamingResponse", - "BlockResource", - "AsyncBlockResource", - "BlockResourceWithRawResponse", - "AsyncBlockResourceWithRawResponse", - "BlockResourceWithStreamingResponse", - "AsyncBlockResourceWithStreamingResponse", - "ShapeResource", - "AsyncShapeResource", - "ShapeResourceWithRawResponse", - "AsyncShapeResourceWithRawResponse", - "ShapeResourceWithStreamingResponse", - "AsyncShapeResourceWithStreamingResponse", -] +__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource", "AgenciesWithCoverageResourceWithRawResponse", "AsyncAgenciesWithCoverageResourceWithRawResponse", "AgenciesWithCoverageResourceWithStreamingResponse", "AsyncAgenciesWithCoverageResourceWithStreamingResponse", "AgencyResource", "AsyncAgencyResource", "AgencyResourceWithRawResponse", "AsyncAgencyResourceWithRawResponse", "AgencyResourceWithStreamingResponse", "AsyncAgencyResourceWithStreamingResponse", "VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource", "VehiclesForAgencyResourceWithRawResponse", "AsyncVehiclesForAgencyResourceWithRawResponse", "VehiclesForAgencyResourceWithStreamingResponse", "AsyncVehiclesForAgencyResourceWithStreamingResponse", "ConfigResource", "AsyncConfigResource", "ConfigResourceWithRawResponse", "AsyncConfigResourceWithRawResponse", "ConfigResourceWithStreamingResponse", "AsyncConfigResourceWithStreamingResponse", "CurrentTimeResource", "AsyncCurrentTimeResource", "CurrentTimeResourceWithRawResponse", "AsyncCurrentTimeResourceWithRawResponse", "CurrentTimeResourceWithStreamingResponse", "AsyncCurrentTimeResourceWithStreamingResponse", "StopsForLocationResource", "AsyncStopsForLocationResource", "StopsForLocationResourceWithRawResponse", "AsyncStopsForLocationResourceWithRawResponse", "StopsForLocationResourceWithStreamingResponse", "AsyncStopsForLocationResourceWithStreamingResponse", "StopsForRouteResource", "AsyncStopsForRouteResource", "StopsForRouteResourceWithRawResponse", "AsyncStopsForRouteResourceWithRawResponse", "StopsForRouteResourceWithStreamingResponse", "AsyncStopsForRouteResourceWithStreamingResponse", "StopsForAgencyResource", "AsyncStopsForAgencyResource", "StopsForAgencyResourceWithRawResponse", "AsyncStopsForAgencyResourceWithRawResponse", "StopsForAgencyResourceWithStreamingResponse", "AsyncStopsForAgencyResourceWithStreamingResponse", "StopResource", "AsyncStopResource", "StopResourceWithRawResponse", "AsyncStopResourceWithRawResponse", "StopResourceWithStreamingResponse", "AsyncStopResourceWithStreamingResponse", "StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource", "StopIDsForAgencyResourceWithRawResponse", "AsyncStopIDsForAgencyResourceWithRawResponse", "StopIDsForAgencyResourceWithStreamingResponse", "AsyncStopIDsForAgencyResourceWithStreamingResponse", "ScheduleForStopResource", "AsyncScheduleForStopResource", "ScheduleForStopResourceWithRawResponse", "AsyncScheduleForStopResourceWithRawResponse", "ScheduleForStopResourceWithStreamingResponse", "AsyncScheduleForStopResourceWithStreamingResponse", "RouteResource", "AsyncRouteResource", "RouteResourceWithRawResponse", "AsyncRouteResourceWithRawResponse", "RouteResourceWithStreamingResponse", "AsyncRouteResourceWithStreamingResponse", "RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource", "RouteIDsForAgencyResourceWithRawResponse", "AsyncRouteIDsForAgencyResourceWithRawResponse", "RouteIDsForAgencyResourceWithStreamingResponse", "AsyncRouteIDsForAgencyResourceWithStreamingResponse", "RoutesForLocationResource", "AsyncRoutesForLocationResource", "RoutesForLocationResourceWithRawResponse", "AsyncRoutesForLocationResourceWithRawResponse", "RoutesForLocationResourceWithStreamingResponse", "AsyncRoutesForLocationResourceWithStreamingResponse", "RoutesForAgencyResource", "AsyncRoutesForAgencyResource", "RoutesForAgencyResourceWithRawResponse", "AsyncRoutesForAgencyResourceWithRawResponse", "RoutesForAgencyResourceWithStreamingResponse", "AsyncRoutesForAgencyResourceWithStreamingResponse", "ScheduleForRouteResource", "AsyncScheduleForRouteResource", "ScheduleForRouteResourceWithRawResponse", "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", "AsyncArrivalAndDepartureResourceWithRawResponse", "ArrivalAndDepartureResourceWithStreamingResponse", "AsyncArrivalAndDepartureResourceWithStreamingResponse", "TripResource", "AsyncTripResource", "TripResourceWithRawResponse", "AsyncTripResourceWithRawResponse", "TripResourceWithStreamingResponse", "AsyncTripResourceWithStreamingResponse", "TripsForLocationResource", "AsyncTripsForLocationResource", "TripsForLocationResourceWithRawResponse", "AsyncTripsForLocationResourceWithRawResponse", "TripsForLocationResourceWithStreamingResponse", "AsyncTripsForLocationResourceWithStreamingResponse", "TripDetailsResource", "AsyncTripDetailsResource", "TripDetailsResourceWithRawResponse", "AsyncTripDetailsResourceWithRawResponse", "TripDetailsResourceWithStreamingResponse", "AsyncTripDetailsResourceWithStreamingResponse", "TripForVehicleResource", "AsyncTripForVehicleResource", "TripForVehicleResourceWithRawResponse", "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", "TripsForRouteResource", "AsyncTripsForRouteResource", "TripsForRouteResourceWithRawResponse", "AsyncTripsForRouteResourceWithRawResponse", "TripsForRouteResourceWithStreamingResponse", "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", "AsyncReportProblemWithStopResourceWithRawResponse", "ReportProblemWithStopResourceWithStreamingResponse", "AsyncReportProblemWithStopResourceWithStreamingResponse", "ReportProblemWithTripResource", "AsyncReportProblemWithTripResource", "ReportProblemWithTripResourceWithRawResponse", "AsyncReportProblemWithTripResourceWithRawResponse", "ReportProblemWithTripResourceWithStreamingResponse", "AsyncReportProblemWithTripResourceWithStreamingResponse", "SearchForStopResource", "AsyncSearchForStopResource", "SearchForStopResourceWithRawResponse", "AsyncSearchForStopResourceWithRawResponse", "SearchForStopResourceWithStreamingResponse", "AsyncSearchForStopResourceWithStreamingResponse", "SearchForRouteResource", "AsyncSearchForRouteResource", "SearchForRouteResourceWithRawResponse", "AsyncSearchForRouteResourceWithRawResponse", "SearchForRouteResourceWithStreamingResponse", "AsyncSearchForRouteResourceWithStreamingResponse", "BlockResource", "AsyncBlockResource", "BlockResourceWithRawResponse", "AsyncBlockResourceWithRawResponse", "BlockResourceWithStreamingResponse", "AsyncBlockResourceWithStreamingResponse", "ShapeResource", "AsyncShapeResource", "ShapeResourceWithRawResponse", "AsyncShapeResourceWithRawResponse", "ShapeResourceWithStreamingResponse", "AsyncShapeResourceWithStreamingResponse"] \ No newline at end of file diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py index f543a88..ad26d0d 100644 --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -18,7 +18,6 @@ __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] - class AgenciesWithCoverageResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: @@ -39,29 +38,24 @@ def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingRe """ return AgenciesWithCoverageResourceWithStreamingResponse(self) - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageListResponse: + def list(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgenciesWithCoverageListResponse, ) - class AsyncAgenciesWithCoverageResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: @@ -82,29 +76,24 @@ def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStream """ return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - async def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageListResponse: + async def list(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgenciesWithCoverageListResponse: """ Returns a list of all transit agencies currently supported by OneBusAway along with the center of their coverage area. """ return await self._get( "/api/where/agencies-with-coverage.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgenciesWithCoverageListResponse, ) - class AgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -113,7 +102,6 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) - class AsyncAgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -122,7 +110,6 @@ def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> agencies_with_coverage.list, ) - class AgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage @@ -131,11 +118,10 @@ def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None agencies_with_coverage.list, ) - class AsyncAgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage self.list = async_to_streamed_response_wrapper( agencies_with_coverage.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py index 9141792..90ac9ae 100644 --- a/src/onebusaway/resources/agency.py +++ b/src/onebusaway/resources/agency.py @@ -18,7 +18,6 @@ __all__ = ["AgencyResource", "AsyncAgencyResource"] - class AgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AgencyResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> AgencyResourceWithStreamingResponse: """ return AgencyResourceWithStreamingResponse(self) - def retrieve( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgencyRetrieveResponse: + def retrieve(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgencyRetrieveResponse, ) - class AsyncAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAgencyResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncAgencyResourceWithStreamingResponse: """ return AsyncAgencyResourceWithStreamingResponse(self) - async def retrieve( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgencyRetrieveResponse: + async def retrieve(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> AgencyRetrieveResponse: """ Retrieve information for a specific transit agency identified by its unique ID. @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=AgencyRetrieveResponse, ) - class AgencyResourceWithRawResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -135,7 +128,6 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) - class AsyncAgencyResourceWithRawResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency @@ -144,7 +136,6 @@ def __init__(self, agency: AsyncAgencyResource) -> None: agency.retrieve, ) - class AgencyResourceWithStreamingResponse: def __init__(self, agency: AgencyResource) -> None: self._agency = agency @@ -153,11 +144,10 @@ def __init__(self, agency: AgencyResource) -> None: agency.retrieve, ) - class AsyncAgencyResourceWithStreamingResponse: def __init__(self, agency: AsyncAgencyResource) -> None: self._agency = agency self.retrieve = async_to_streamed_response_wrapper( agency.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py index 8323a51..3daac58 100644 --- a/src/onebusaway/resources/arrival_and_departure.py +++ b/src/onebusaway/resources/arrival_and_departure.py @@ -27,7 +27,6 @@ __all__ = ["ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource"] - class ArrivalAndDepartureResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ArrivalAndDepartureResourceWithRawResponse: @@ -48,22 +47,20 @@ def with_streaming_response(self) -> ArrivalAndDepartureResourceWithStreamingRes """ return ArrivalAndDepartureResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -77,42 +74,33 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, - arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), cast_to=ArrivalAndDepartureRetrieveResponse, ) - def list( - self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureListResponse: + def list(self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -132,27 +120,19 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, - arrival_and_departure_list_params.ArrivalAndDepartureListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), cast_to=ArrivalAndDepartureListResponse, ) - class AsyncArrivalAndDepartureResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncArrivalAndDepartureResourceWithRawResponse: @@ -173,22 +153,20 @@ def with_streaming_response(self) -> AsyncArrivalAndDepartureResourceWithStreami """ return AsyncArrivalAndDepartureResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - service_date: int, - trip_id: str, - stop_sequence: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + service_date: int, + trip_id: str, + stop_sequence: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureRetrieveResponse: """ arrival-and-departure-for-stop @@ -202,42 +180,33 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/arrival-and-departure-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "service_date": service_date, - "trip_id": trip_id, - "stop_sequence": stop_sequence, - "time": time, - "vehicle_id": vehicle_id, - }, - arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "service_date": service_date, + "trip_id": trip_id, + "stop_sequence": stop_sequence, + "time": time, + "vehicle_id": vehicle_id, + }, arrival_and_departure_retrieve_params.ArrivalAndDepartureRetrieveParams)), cast_to=ArrivalAndDepartureRetrieveResponse, ) - async def list( - self, - stop_id: str, - *, - minutes_after: int | NotGiven = NOT_GIVEN, - minutes_before: int | NotGiven = NOT_GIVEN, - time: Union[str, datetime] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ArrivalAndDepartureListResponse: + async def list(self, + stop_id: str, + *, + minutes_after: int | NotGiven = NOT_GIVEN, + minutes_before: int | NotGiven = NOT_GIVEN, + time: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ArrivalAndDepartureListResponse: """ arrivals-and-departures-for-stop @@ -257,27 +226,19 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "minutes_after": minutes_after, - "minutes_before": minutes_before, - "time": time, - }, - arrival_and_departure_list_params.ArrivalAndDepartureListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "time": time, + }, arrival_and_departure_list_params.ArrivalAndDepartureListParams)), cast_to=ArrivalAndDepartureListResponse, ) - class ArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -289,7 +250,6 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) - class AsyncArrivalAndDepartureResourceWithRawResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -301,7 +261,6 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N arrival_and_departure.list, ) - class ArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -313,7 +272,6 @@ def __init__(self, arrival_and_departure: ArrivalAndDepartureResource) -> None: arrival_and_departure.list, ) - class AsyncArrivalAndDepartureResourceWithStreamingResponse: def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> None: self._arrival_and_departure = arrival_and_departure @@ -323,4 +281,4 @@ def __init__(self, arrival_and_departure: AsyncArrivalAndDepartureResource) -> N ) self.list = async_to_streamed_response_wrapper( arrival_and_departure.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py index cbee583..66e28a8 100644 --- a/src/onebusaway/resources/block.py +++ b/src/onebusaway/resources/block.py @@ -18,7 +18,6 @@ __all__ = ["BlockResource", "AsyncBlockResource"] - class BlockResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BlockResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> BlockResourceWithStreamingResponse: """ return BlockResourceWithStreamingResponse(self) - def retrieve( - self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BlockRetrieveResponse: + def retrieve(self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + raise ValueError( + f'Expected a non-empty value for `block_id` but received {block_id!r}' + ) return self._get( f"/api/where/block/{block_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=BlockRetrieveResponse, ) - class AsyncBlockResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBlockResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncBlockResourceWithStreamingResponse: """ return AsyncBlockResourceWithStreamingResponse(self) - async def retrieve( - self, - block_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BlockRetrieveResponse: + async def retrieve(self, + block_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> BlockRetrieveResponse: """ Get details of a specific block by ID @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not block_id: - raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}") + raise ValueError( + f'Expected a non-empty value for `block_id` but received {block_id!r}' + ) return await self._get( f"/api/where/block/{block_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=BlockRetrieveResponse, ) - class BlockResourceWithRawResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -135,7 +128,6 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) - class AsyncBlockResourceWithRawResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block @@ -144,7 +136,6 @@ def __init__(self, block: AsyncBlockResource) -> None: block.retrieve, ) - class BlockResourceWithStreamingResponse: def __init__(self, block: BlockResource) -> None: self._block = block @@ -153,11 +144,10 @@ def __init__(self, block: BlockResource) -> None: block.retrieve, ) - class AsyncBlockResourceWithStreamingResponse: def __init__(self, block: AsyncBlockResource) -> None: self._block = block self.retrieve = async_to_streamed_response_wrapper( block.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py index 4b3de23..e52cb1e 100644 --- a/src/onebusaway/resources/config.py +++ b/src/onebusaway/resources/config.py @@ -18,7 +18,6 @@ __all__ = ["ConfigResource", "AsyncConfigResource"] - class ConfigResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigResourceWithRawResponse: @@ -39,26 +38,21 @@ def with_streaming_response(self) -> ConfigResourceWithStreamingResponse: """ return ConfigResourceWithStreamingResponse(self) - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigRetrieveResponse: + def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: """config""" return self._get( "/api/where/config.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ConfigRetrieveResponse, ) - class AsyncConfigResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigResourceWithRawResponse: @@ -79,26 +73,21 @@ def with_streaming_response(self) -> AsyncConfigResourceWithStreamingResponse: """ return AsyncConfigResourceWithStreamingResponse(self) - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigRetrieveResponse: + async def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ConfigRetrieveResponse: """config""" return await self._get( "/api/where/config.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ConfigRetrieveResponse, ) - class ConfigResourceWithRawResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -107,7 +96,6 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) - class AsyncConfigResourceWithRawResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config @@ -116,7 +104,6 @@ def __init__(self, config: AsyncConfigResource) -> None: config.retrieve, ) - class ConfigResourceWithStreamingResponse: def __init__(self, config: ConfigResource) -> None: self._config = config @@ -125,11 +112,10 @@ def __init__(self, config: ConfigResource) -> None: config.retrieve, ) - class AsyncConfigResourceWithStreamingResponse: def __init__(self, config: AsyncConfigResource) -> None: self._config = config self.retrieve = async_to_streamed_response_wrapper( config.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py index 1dcc9a8..b4b29d5 100644 --- a/src/onebusaway/resources/current_time.py +++ b/src/onebusaway/resources/current_time.py @@ -18,7 +18,6 @@ __all__ = ["CurrentTimeResource", "AsyncCurrentTimeResource"] - class CurrentTimeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CurrentTimeResourceWithRawResponse: @@ -39,26 +38,21 @@ def with_streaming_response(self) -> CurrentTimeResourceWithStreamingResponse: """ return CurrentTimeResourceWithStreamingResponse(self) - def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CurrentTimeRetrieveResponse: + def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: """current-time""" return self._get( "/api/where/current-time.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=CurrentTimeRetrieveResponse, ) - class AsyncCurrentTimeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCurrentTimeResourceWithRawResponse: @@ -79,26 +73,21 @@ def with_streaming_response(self) -> AsyncCurrentTimeResourceWithStreamingRespon """ return AsyncCurrentTimeResourceWithStreamingResponse(self) - async def retrieve( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CurrentTimeRetrieveResponse: + async def retrieve(self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> CurrentTimeRetrieveResponse: """current-time""" return await self._get( "/api/where/current-time.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=CurrentTimeRetrieveResponse, ) - class CurrentTimeResourceWithRawResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -107,7 +96,6 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) - class AsyncCurrentTimeResourceWithRawResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time @@ -116,7 +104,6 @@ def __init__(self, current_time: AsyncCurrentTimeResource) -> None: current_time.retrieve, ) - class CurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: CurrentTimeResource) -> None: self._current_time = current_time @@ -125,11 +112,10 @@ def __init__(self, current_time: CurrentTimeResource) -> None: current_time.retrieve, ) - class AsyncCurrentTimeResourceWithStreamingResponse: def __init__(self, current_time: AsyncCurrentTimeResource) -> None: self._current_time = current_time self.retrieve = async_to_streamed_response_wrapper( current_time.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py index d1614f6..0c26ff9 100644 --- a/src/onebusaway/resources/report_problem_with_stop.py +++ b/src/onebusaway/resources/report_problem_with_stop.py @@ -25,7 +25,6 @@ __all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] - class ReportProblemWithStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: @@ -46,23 +45,20 @@ def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingR """ return ReportProblemWithStopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + def retrieve(self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -86,29 +82,21 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, - report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), cast_to=ResponseWrapper, ) - class AsyncReportProblemWithStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: @@ -129,23 +117,20 @@ def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStrea """ return AsyncReportProblemWithStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] - | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + async def retrieve(self, + stop_id: str, + *, + code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a stop @@ -169,29 +154,21 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/report-problem-with-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "code": code, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - }, - report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "code": code, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + }, report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams)), cast_to=ResponseWrapper, ) - class ReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -200,7 +177,6 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) - class AsyncReportProblemWithStopResourceWithRawResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -209,7 +185,6 @@ def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) report_problem_with_stop.retrieve, ) - class ReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop @@ -218,11 +193,10 @@ def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> N report_problem_with_stop.retrieve, ) - class AsyncReportProblemWithStopResourceWithStreamingResponse: def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: self._report_problem_with_stop = report_problem_with_stop self.retrieve = async_to_streamed_response_wrapper( report_problem_with_stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py index d0f9733..b2506b5 100644 --- a/src/onebusaway/resources/report_problem_with_trip.py +++ b/src/onebusaway/resources/report_problem_with_trip.py @@ -25,7 +25,6 @@ __all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"] - class ReportProblemWithTripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse: @@ -46,35 +45,25 @@ def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingR """ return ReportProblemWithTripResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + def retrieve(self, + trip_id: str, + *, + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -108,34 +97,26 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, - report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), cast_to=ResponseWrapper, ) - class AsyncReportProblemWithTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse: @@ -156,35 +137,25 @@ def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStrea """ return AsyncReportProblemWithTripResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] - | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - stop_id: str | NotGiven = NOT_GIVEN, - user_comment: str | NotGiven = NOT_GIVEN, - user_lat: float | NotGiven = NOT_GIVEN, - user_location_accuracy: float | NotGiven = NOT_GIVEN, - user_lon: float | NotGiven = NOT_GIVEN, - user_on_vehicle: bool | NotGiven = NOT_GIVEN, - user_vehicle_number: str | NotGiven = NOT_GIVEN, - vehicle_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ResponseWrapper: + async def retrieve(self, + trip_id: str, + *, + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + stop_id: str | NotGiven = NOT_GIVEN, + user_comment: str | NotGiven = NOT_GIVEN, + user_lat: float | NotGiven = NOT_GIVEN, + user_location_accuracy: float | NotGiven = NOT_GIVEN, + user_lon: float | NotGiven = NOT_GIVEN, + user_on_vehicle: bool | NotGiven = NOT_GIVEN, + user_vehicle_number: str | NotGiven = NOT_GIVEN, + vehicle_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ResponseWrapper: """ Submit a user-generated problem report for a particular trip. @@ -218,34 +189,26 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/report-problem-with-trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "code": code, - "service_date": service_date, - "stop_id": stop_id, - "user_comment": user_comment, - "user_lat": user_lat, - "user_location_accuracy": user_location_accuracy, - "user_lon": user_lon, - "user_on_vehicle": user_on_vehicle, - "user_vehicle_number": user_vehicle_number, - "vehicle_id": vehicle_id, - }, - report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "code": code, + "service_date": service_date, + "stop_id": stop_id, + "user_comment": user_comment, + "user_lat": user_lat, + "user_location_accuracy": user_location_accuracy, + "user_lon": user_lon, + "user_on_vehicle": user_on_vehicle, + "user_vehicle_number": user_vehicle_number, + "vehicle_id": vehicle_id, + }, report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams)), cast_to=ResponseWrapper, ) - class ReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -254,7 +217,6 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) - class AsyncReportProblemWithTripResourceWithRawResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -263,7 +225,6 @@ def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) report_problem_with_trip.retrieve, ) - class ReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip @@ -272,11 +233,10 @@ def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> N report_problem_with_trip.retrieve, ) - class AsyncReportProblemWithTripResourceWithStreamingResponse: def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None: self._report_problem_with_trip = report_problem_with_trip self.retrieve = async_to_streamed_response_wrapper( report_problem_with_trip.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py index 62ae14a..adc785a 100644 --- a/src/onebusaway/resources/route.py +++ b/src/onebusaway/resources/route.py @@ -18,7 +18,6 @@ __all__ = ["RouteResource", "AsyncRouteResource"] - class RouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> RouteResourceWithStreamingResponse: """ return RouteResourceWithStreamingResponse(self) - def retrieve( - self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteRetrieveResponse: + def retrieve(self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteRetrieveResponse, ) - class AsyncRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncRouteResourceWithStreamingResponse: """ return AsyncRouteResourceWithStreamingResponse(self) - async def retrieve( - self, - route_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteRetrieveResponse: + async def retrieve(self, + route_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteRetrieveResponse: """ Retrieve information for a specific route identified by its unique ID. @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteRetrieveResponse, ) - class RouteResourceWithRawResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -135,7 +128,6 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) - class AsyncRouteResourceWithRawResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route @@ -144,7 +136,6 @@ def __init__(self, route: AsyncRouteResource) -> None: route.retrieve, ) - class RouteResourceWithStreamingResponse: def __init__(self, route: RouteResource) -> None: self._route = route @@ -153,11 +144,10 @@ def __init__(self, route: RouteResource) -> None: route.retrieve, ) - class AsyncRouteResourceWithStreamingResponse: def __init__(self, route: AsyncRouteResource) -> None: self._route = route self.retrieve = async_to_streamed_response_wrapper( route.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py index e5ddfa3..7a33d59 100644 --- a/src/onebusaway/resources/route_ids_for_agency.py +++ b/src/onebusaway/resources/route_ids_for_agency.py @@ -18,7 +18,6 @@ __all__ = ["RouteIDsForAgencyResource", "AsyncRouteIDsForAgencyResource"] - class RouteIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RouteIDsForAgencyResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> RouteIDsForAgencyResourceWithStreamingRespo """ return RouteIDsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteIDsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -63,16 +60,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteIDsForAgencyListResponse, ) - class AsyncRouteIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRouteIDsForAgencyResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncRouteIDsForAgencyResourceWithStreaming """ return AsyncRouteIDsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteIDsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RouteIDsForAgencyListResponse: """ Get route IDs for a specific agency @@ -117,16 +111,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/route-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RouteIDsForAgencyListResponse, ) - class RouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -135,7 +128,6 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) - class AsyncRouteIDsForAgencyResourceWithRawResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -144,7 +136,6 @@ def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None route_ids_for_agency.list, ) - class RouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency @@ -153,11 +144,10 @@ def __init__(self, route_ids_for_agency: RouteIDsForAgencyResource) -> None: route_ids_for_agency.list, ) - class AsyncRouteIDsForAgencyResourceWithStreamingResponse: def __init__(self, route_ids_for_agency: AsyncRouteIDsForAgencyResource) -> None: self._route_ids_for_agency = route_ids_for_agency self.list = async_to_streamed_response_wrapper( route_ids_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py index ff7a8cd..7f1b5ba 100644 --- a/src/onebusaway/resources/routes_for_agency.py +++ b/src/onebusaway/resources/routes_for_agency.py @@ -18,7 +18,6 @@ __all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"] - class RoutesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> RoutesForAgencyResourceWithStreamingRespons """ return RoutesForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -63,16 +60,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RoutesForAgencyListResponse, ) - class AsyncRoutesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncRoutesForAgencyResourceWithStreamingRe """ return AsyncRoutesForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForAgencyListResponse: """ Retrieve the list of all routes for a particular agency by id @@ -117,16 +111,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/routes-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=RoutesForAgencyListResponse, ) - class RoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -135,7 +128,6 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) - class AsyncRoutesForAgencyResourceWithRawResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -144,7 +136,6 @@ def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: routes_for_agency.list, ) - class RoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency @@ -153,11 +144,10 @@ def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None: routes_for_agency.list, ) - class AsyncRoutesForAgencyResourceWithStreamingResponse: def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None: self._routes_for_agency = routes_for_agency self.list = async_to_streamed_response_wrapper( routes_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py index d315909..f43e196 100644 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -23,7 +23,6 @@ __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] - class RoutesForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: @@ -44,22 +43,20 @@ def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingRespo """ return RoutesForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationListResponse: + def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: """ routes-for-location @@ -74,27 +71,17 @@ def list( """ return self._get( "/api/where/routes-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - routes_for_location_list_params.RoutesForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, routes_for_location_list_params.RoutesForLocationListParams)), cast_to=RoutesForLocationListResponse, ) - class AsyncRoutesForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: @@ -115,22 +102,20 @@ def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreaming """ return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationListResponse: + async def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> RoutesForLocationListResponse: """ routes-for-location @@ -145,27 +130,17 @@ async def list( """ return await self._get( "/api/where/routes-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - routes_for_location_list_params.RoutesForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, routes_for_location_list_params.RoutesForLocationListParams)), cast_to=RoutesForLocationListResponse, ) - class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -174,7 +149,6 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) - class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -183,7 +157,6 @@ def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: routes_for_location.list, ) - class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location @@ -192,11 +165,10 @@ def __init__(self, routes_for_location: RoutesForLocationResource) -> None: routes_for_location.list, ) - class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location self.list = async_to_streamed_response_wrapper( routes_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py index 3d5509d..53a5303 100644 --- a/src/onebusaway/resources/schedule_for_route.py +++ b/src/onebusaway/resources/schedule_for_route.py @@ -26,7 +26,6 @@ __all__ = ["ScheduleForRouteResource", "AsyncScheduleForRouteResource"] - class ScheduleForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForRouteResourceWithRawResponse: @@ -47,18 +46,16 @@ def with_streaming_response(self) -> ScheduleForRouteResourceWithStreamingRespon """ return ScheduleForRouteResourceWithStreamingResponse(self) - def retrieve( - self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForRouteRetrieveResponse: + def retrieve(self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -75,22 +72,17 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "date": date + }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), cast_to=ScheduleForRouteRetrieveResponse, ) - class AsyncScheduleForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForRouteResourceWithRawResponse: @@ -111,18 +103,16 @@ def with_streaming_response(self) -> AsyncScheduleForRouteResourceWithStreamingR """ return AsyncScheduleForRouteResourceWithStreamingResponse(self) - async def retrieve( - self, - route_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForRouteRetrieveResponse: + async def retrieve(self, + route_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForRouteRetrieveResponse: """ Retrieve the full schedule for a route on a particular day @@ -139,22 +129,17 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/schedule-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"date": date}, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "date": date + }, schedule_for_route_retrieve_params.ScheduleForRouteRetrieveParams)), cast_to=ScheduleForRouteRetrieveResponse, ) - class ScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -163,7 +148,6 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class AsyncScheduleForRouteResourceWithRawResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -172,7 +156,6 @@ def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class ScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route @@ -181,11 +164,10 @@ def __init__(self, schedule_for_route: ScheduleForRouteResource) -> None: schedule_for_route.retrieve, ) - class AsyncScheduleForRouteResourceWithStreamingResponse: def __init__(self, schedule_for_route: AsyncScheduleForRouteResource) -> None: self._schedule_for_route = schedule_for_route self.retrieve = async_to_streamed_response_wrapper( schedule_for_route.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py index 78b4d36..f1dd499 100644 --- a/src/onebusaway/resources/schedule_for_stop.py +++ b/src/onebusaway/resources/schedule_for_stop.py @@ -26,7 +26,6 @@ __all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"] - class ScheduleForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse: @@ -47,18 +46,16 @@ def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingRespons """ return ScheduleForStopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForStopRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -75,20 +72,17 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "date": date + }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), cast_to=ScheduleForStopRetrieveResponse, ) - class AsyncScheduleForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse: @@ -109,18 +103,16 @@ def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingRe """ return AsyncScheduleForStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - date: Union[str, date] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleForStopRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + date: Union[str, date] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ScheduleForStopRetrieveResponse: """ Get schedule for a specific stop @@ -137,22 +129,17 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/schedule-for-stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "date": date + }, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams)), cast_to=ScheduleForStopRetrieveResponse, ) - class ScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -161,7 +148,6 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class AsyncScheduleForStopResourceWithRawResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -170,7 +156,6 @@ def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class ScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop @@ -179,11 +164,10 @@ def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None: schedule_for_stop.retrieve, ) - class AsyncScheduleForStopResourceWithStreamingResponse: def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None: self._schedule_for_stop = schedule_for_stop self.retrieve = async_to_streamed_response_wrapper( schedule_for_stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py index fe1d9a2..b4b3968 100644 --- a/src/onebusaway/resources/search_for_route.py +++ b/src/onebusaway/resources/search_for_route.py @@ -23,7 +23,6 @@ __all__ = ["SearchForRouteResource", "AsyncSearchForRouteResource"] - class SearchForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForRouteResourceWithRawResponse: @@ -44,18 +43,16 @@ def with_streaming_response(self) -> SearchForRouteResourceWithStreamingResponse """ return SearchForRouteResourceWithStreamingResponse(self) - def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteListResponse: + def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -74,23 +71,13 @@ def list( """ return self._get( "/api/where/search/route.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_route_list_params.SearchForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_route_list_params.SearchForRouteListParams)), cast_to=SearchForRouteListResponse, ) - class AsyncSearchForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForRouteResourceWithRawResponse: @@ -111,18 +98,16 @@ def with_streaming_response(self) -> AsyncSearchForRouteResourceWithStreamingRes """ return AsyncSearchForRouteResourceWithStreamingResponse(self) - async def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForRouteListResponse: + async def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForRouteListResponse: """ Search for a route based on its name. @@ -141,23 +126,13 @@ async def list( """ return await self._get( "/api/where/search/route.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_route_list_params.SearchForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_route_list_params.SearchForRouteListParams)), cast_to=SearchForRouteListResponse, ) - class SearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -166,7 +141,6 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) - class AsyncSearchForRouteResourceWithRawResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -175,7 +149,6 @@ def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: search_for_route.list, ) - class SearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: SearchForRouteResource) -> None: self._search_for_route = search_for_route @@ -184,11 +157,10 @@ def __init__(self, search_for_route: SearchForRouteResource) -> None: search_for_route.list, ) - class AsyncSearchForRouteResourceWithStreamingResponse: def __init__(self, search_for_route: AsyncSearchForRouteResource) -> None: self._search_for_route = search_for_route self.list = async_to_streamed_response_wrapper( search_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py index 8efb8ad..2aba780 100644 --- a/src/onebusaway/resources/search_for_stop.py +++ b/src/onebusaway/resources/search_for_stop.py @@ -23,7 +23,6 @@ __all__ = ["SearchForStopResource", "AsyncSearchForStopResource"] - class SearchForStopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SearchForStopResourceWithRawResponse: @@ -44,18 +43,16 @@ def with_streaming_response(self) -> SearchForStopResourceWithStreamingResponse: """ return SearchForStopResourceWithStreamingResponse(self) - def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopListResponse: + def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -74,23 +71,13 @@ def list( """ return self._get( "/api/where/search/stop.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_stop_list_params.SearchForStopListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_stop_list_params.SearchForStopListParams)), cast_to=SearchForStopListResponse, ) - class AsyncSearchForStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSearchForStopResourceWithRawResponse: @@ -111,18 +98,16 @@ def with_streaming_response(self) -> AsyncSearchForStopResourceWithStreamingResp """ return AsyncSearchForStopResourceWithStreamingResponse(self) - async def list( - self, - *, - input: str, - max_count: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SearchForStopListResponse: + async def list(self, + *, + input: str, + max_count: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> SearchForStopListResponse: """ Search for a stop based on its name. @@ -141,23 +126,13 @@ async def list( """ return await self._get( "/api/where/search/stop.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "input": input, - "max_count": max_count, - }, - search_for_stop_list_params.SearchForStopListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "input": input, + "max_count": max_count, + }, search_for_stop_list_params.SearchForStopListParams)), cast_to=SearchForStopListResponse, ) - class SearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -166,7 +141,6 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) - class AsyncSearchForStopResourceWithRawResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -175,7 +149,6 @@ def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: search_for_stop.list, ) - class SearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: SearchForStopResource) -> None: self._search_for_stop = search_for_stop @@ -184,11 +157,10 @@ def __init__(self, search_for_stop: SearchForStopResource) -> None: search_for_stop.list, ) - class AsyncSearchForStopResourceWithStreamingResponse: def __init__(self, search_for_stop: AsyncSearchForStopResource) -> None: self._search_for_stop = search_for_stop self.list = async_to_streamed_response_wrapper( search_for_stop.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py index 0b4c291..7ae390c 100644 --- a/src/onebusaway/resources/shape.py +++ b/src/onebusaway/resources/shape.py @@ -18,7 +18,6 @@ __all__ = ["ShapeResource", "AsyncShapeResource"] - class ShapeResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ShapeResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> ShapeResourceWithStreamingResponse: """ return ShapeResourceWithStreamingResponse(self) - def retrieve( - self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ShapeRetrieveResponse: + def retrieve(self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + raise ValueError( + f'Expected a non-empty value for `shape_id` but received {shape_id!r}' + ) return self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ShapeRetrieveResponse, ) - class AsyncShapeResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncShapeResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncShapeResourceWithStreamingResponse: """ return AsyncShapeResourceWithStreamingResponse(self) - async def retrieve( - self, - shape_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ShapeRetrieveResponse: + async def retrieve(self, + shape_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> ShapeRetrieveResponse: """ Retrieve a shape (the path traveled by a transit vehicle) by ID. @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not shape_id: - raise ValueError(f"Expected a non-empty value for `shape_id` but received {shape_id!r}") + raise ValueError( + f'Expected a non-empty value for `shape_id` but received {shape_id!r}' + ) return await self._get( f"/api/where/shape/{shape_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=ShapeRetrieveResponse, ) - class ShapeResourceWithRawResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -135,7 +128,6 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) - class AsyncShapeResourceWithRawResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape @@ -144,7 +136,6 @@ def __init__(self, shape: AsyncShapeResource) -> None: shape.retrieve, ) - class ShapeResourceWithStreamingResponse: def __init__(self, shape: ShapeResource) -> None: self._shape = shape @@ -153,11 +144,10 @@ def __init__(self, shape: ShapeResource) -> None: shape.retrieve, ) - class AsyncShapeResourceWithStreamingResponse: def __init__(self, shape: AsyncShapeResource) -> None: self._shape = shape self.retrieve = async_to_streamed_response_wrapper( shape.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py index 502f8ce..5d1f22e 100644 --- a/src/onebusaway/resources/stop.py +++ b/src/onebusaway/resources/stop.py @@ -18,7 +18,6 @@ __all__ = ["StopResource", "AsyncStopResource"] - class StopResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> StopResourceWithStreamingResponse: """ return StopResourceWithStreamingResponse(self) - def retrieve( - self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopRetrieveResponse: + def retrieve(self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: """ Get details of a specific stop @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopRetrieveResponse, ) - class AsyncStopResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse: """ return AsyncStopResourceWithStreamingResponse(self) - async def retrieve( - self, - stop_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopRetrieveResponse: + async def retrieve(self, + stop_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopRetrieveResponse: """ Get details of a specific stop @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not stop_id: - raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}") + raise ValueError( + f'Expected a non-empty value for `stop_id` but received {stop_id!r}' + ) return await self._get( f"/api/where/stop/{stop_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopRetrieveResponse, ) - class StopResourceWithRawResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -135,7 +128,6 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) - class AsyncStopResourceWithRawResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop @@ -144,7 +136,6 @@ def __init__(self, stop: AsyncStopResource) -> None: stop.retrieve, ) - class StopResourceWithStreamingResponse: def __init__(self, stop: StopResource) -> None: self._stop = stop @@ -153,11 +144,10 @@ def __init__(self, stop: StopResource) -> None: stop.retrieve, ) - class AsyncStopResourceWithStreamingResponse: def __init__(self, stop: AsyncStopResource) -> None: self._stop = stop self.retrieve = async_to_streamed_response_wrapper( stop.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py index 3850d16..5311acd 100644 --- a/src/onebusaway/resources/stop_ids_for_agency.py +++ b/src/onebusaway/resources/stop_ids_for_agency.py @@ -18,7 +18,6 @@ __all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"] - class StopIDsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingRespon """ return StopIDsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopIDsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -63,16 +60,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopIDsForAgencyListResponse, ) - class AsyncStopIDsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingR """ return AsyncStopIDsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopIDsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopIDsForAgencyListResponse: """ Get stop IDs for a specific agency @@ -117,16 +111,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/stop-ids-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopIDsForAgencyListResponse, ) - class StopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -135,7 +128,6 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class AsyncStopIDsForAgencyResourceWithRawResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -144,7 +136,6 @@ def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class StopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency @@ -153,11 +144,10 @@ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None: stop_ids_for_agency.list, ) - class AsyncStopIDsForAgencyResourceWithStreamingResponse: def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None: self._stop_ids_for_agency = stop_ids_for_agency self.list = async_to_streamed_response_wrapper( stop_ids_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_agency.py b/src/onebusaway/resources/stops_for_agency.py index 834ab5c..8458527 100644 --- a/src/onebusaway/resources/stops_for_agency.py +++ b/src/onebusaway/resources/stops_for_agency.py @@ -18,7 +18,6 @@ __all__ = ["StopsForAgencyResource", "AsyncStopsForAgencyResource"] - class StopsForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForAgencyResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> StopsForAgencyResourceWithStreamingResponse """ return StopsForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForAgencyListResponse: + def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -63,16 +60,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopsForAgencyListResponse, ) - class AsyncStopsForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForAgencyResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncStopsForAgencyResourceWithStreamingRes """ return AsyncStopsForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForAgencyListResponse: + async def list(self, + agency_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForAgencyListResponse: """ Get stops for a specific agency @@ -117,16 +111,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/stops-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=StopsForAgencyListResponse, ) - class StopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -135,7 +128,6 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) - class AsyncStopsForAgencyResourceWithRawResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -144,7 +136,6 @@ def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: stops_for_agency.list, ) - class StopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency @@ -153,11 +144,10 @@ def __init__(self, stops_for_agency: StopsForAgencyResource) -> None: stops_for_agency.list, ) - class AsyncStopsForAgencyResourceWithStreamingResponse: def __init__(self, stops_for_agency: AsyncStopsForAgencyResource) -> None: self._stops_for_agency = stops_for_agency self.list = async_to_streamed_response_wrapper( stops_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py index 80322e3..3da78db 100644 --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -23,7 +23,6 @@ __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] - class StopsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: @@ -44,22 +43,20 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon """ return StopsForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationListResponse: + def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: """ stops-for-location @@ -82,27 +79,17 @@ def list( """ return self._get( "/api/where/stops-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - stops_for_location_list_params.StopsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, stops_for_location_list_params.StopsForLocationListParams)), cast_to=StopsForLocationListResponse, ) - class AsyncStopsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: @@ -123,22 +110,20 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR """ return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lon: float, - lat_span: float | NotGiven = NOT_GIVEN, - lon_span: float | NotGiven = NOT_GIVEN, - query: str | NotGiven = NOT_GIVEN, - radius: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForLocationListResponse: + async def list(self, + *, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForLocationListResponse: """ stops-for-location @@ -161,27 +146,17 @@ async def list( """ return await self._get( "/api/where/stops-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lon": lon, - "lat_span": lat_span, - "lon_span": lon_span, - "query": query, - "radius": radius, - }, - stops_for_location_list_params.StopsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, + }, stops_for_location_list_params.StopsForLocationListParams)), cast_to=StopsForLocationListResponse, ) - class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -190,7 +165,6 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) - class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -199,7 +173,6 @@ def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: stops_for_location.list, ) - class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location @@ -208,11 +181,10 @@ def __init__(self, stops_for_location: StopsForLocationResource) -> None: stops_for_location.list, ) - class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location self.list = async_to_streamed_response_wrapper( stops_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py index 36f7514..d4c1d80 100644 --- a/src/onebusaway/resources/stops_for_route.py +++ b/src/onebusaway/resources/stops_for_route.py @@ -23,7 +23,6 @@ __all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"] - class StopsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> StopsForRouteResourceWithRawResponse: @@ -44,19 +43,17 @@ def with_streaming_response(self) -> StopsForRouteResourceWithStreamingResponse: """ return StopsForRouteResourceWithStreamingResponse(self) - def list( - self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForRouteListResponse: + def list(self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -74,26 +71,18 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_polylines": include_polylines, - "time": time, - }, - stops_for_route_list_params.StopsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_polylines": include_polylines, + "time": time, + }, stops_for_route_list_params.StopsForRouteListParams)), cast_to=StopsForRouteListResponse, ) - class AsyncStopsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse: @@ -114,19 +103,17 @@ def with_streaming_response(self) -> AsyncStopsForRouteResourceWithStreamingResp """ return AsyncStopsForRouteResourceWithStreamingResponse(self) - async def list( - self, - route_id: str, - *, - include_polylines: bool | NotGiven = NOT_GIVEN, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StopsForRouteListResponse: + async def list(self, + route_id: str, + *, + include_polylines: bool | NotGiven = NOT_GIVEN, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> StopsForRouteListResponse: """ Get stops for a specific route @@ -144,26 +131,18 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/stops-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_polylines": include_polylines, - "time": time, - }, - stops_for_route_list_params.StopsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_polylines": include_polylines, + "time": time, + }, stops_for_route_list_params.StopsForRouteListParams)), cast_to=StopsForRouteListResponse, ) - class StopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -172,7 +151,6 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) - class AsyncStopsForRouteResourceWithRawResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -181,7 +159,6 @@ def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: stops_for_route.list, ) - class StopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: StopsForRouteResource) -> None: self._stops_for_route = stops_for_route @@ -190,11 +167,10 @@ def __init__(self, stops_for_route: StopsForRouteResource) -> None: stops_for_route.list, ) - class AsyncStopsForRouteResourceWithStreamingResponse: def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None: self._stops_for_route = stops_for_route self.list = async_to_streamed_response_wrapper( stops_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py index 9b7e137..c570387 100644 --- a/src/onebusaway/resources/trip.py +++ b/src/onebusaway/resources/trip.py @@ -18,7 +18,6 @@ __all__ = ["TripResource", "AsyncTripResource"] - class TripResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripResourceWithRawResponse: @@ -39,17 +38,15 @@ def with_streaming_response(self) -> TripResourceWithStreamingResponse: """ return TripResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripRetrieveResponse: + def retrieve(self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: """ Get details of a specific trip @@ -63,16 +60,15 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=TripRetrieveResponse, ) - class AsyncTripResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripResourceWithRawResponse: @@ -93,17 +89,15 @@ def with_streaming_response(self) -> AsyncTripResourceWithStreamingResponse: """ return AsyncTripResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripRetrieveResponse: + async def retrieve(self, + trip_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripRetrieveResponse: """ Get details of a specific trip @@ -117,16 +111,15 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/trip/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout), cast_to=TripRetrieveResponse, ) - class TripResourceWithRawResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -135,7 +128,6 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) - class AsyncTripResourceWithRawResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip @@ -144,7 +136,6 @@ def __init__(self, trip: AsyncTripResource) -> None: trip.retrieve, ) - class TripResourceWithStreamingResponse: def __init__(self, trip: TripResource) -> None: self._trip = trip @@ -153,11 +144,10 @@ def __init__(self, trip: TripResource) -> None: trip.retrieve, ) - class AsyncTripResourceWithStreamingResponse: def __init__(self, trip: AsyncTripResource) -> None: self._trip = trip self.retrieve = async_to_streamed_response_wrapper( trip.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py index 71092c9..4c4fe91 100644 --- a/src/onebusaway/resources/trip_details.py +++ b/src/onebusaway/resources/trip_details.py @@ -23,7 +23,6 @@ __all__ = ["TripDetailsResource", "AsyncTripDetailsResource"] - class TripDetailsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripDetailsResourceWithRawResponse: @@ -44,22 +43,20 @@ def with_streaming_response(self) -> TripDetailsResourceWithStreamingResponse: """ return TripDetailsResourceWithStreamingResponse(self) - def retrieve( - self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripDetailRetrieveResponse: + def retrieve(self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -86,29 +83,21 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, - trip_detail_retrieve_params.TripDetailRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, trip_detail_retrieve_params.TripDetailRetrieveParams)), cast_to=TripDetailRetrieveResponse, ) - class AsyncTripDetailsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripDetailsResourceWithRawResponse: @@ -129,22 +118,20 @@ def with_streaming_response(self) -> AsyncTripDetailsResourceWithStreamingRespon """ return AsyncTripDetailsResourceWithStreamingResponse(self) - async def retrieve( - self, - trip_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - service_date: int | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripDetailRetrieveResponse: + async def retrieve(self, + trip_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + service_date: int | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripDetailRetrieveResponse: """ Retrieve Trip Details @@ -171,29 +158,21 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not trip_id: - raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}") + raise ValueError( + f'Expected a non-empty value for `trip_id` but received {trip_id!r}' + ) return await self._get( f"/api/where/trip-details/{trip_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "service_date": service_date, - "time": time, - }, - trip_detail_retrieve_params.TripDetailRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "service_date": service_date, + "time": time, + }, trip_detail_retrieve_params.TripDetailRetrieveParams)), cast_to=TripDetailRetrieveResponse, ) - class TripDetailsResourceWithRawResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -202,7 +181,6 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) - class AsyncTripDetailsResourceWithRawResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details @@ -211,7 +189,6 @@ def __init__(self, trip_details: AsyncTripDetailsResource) -> None: trip_details.retrieve, ) - class TripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: TripDetailsResource) -> None: self._trip_details = trip_details @@ -220,11 +197,10 @@ def __init__(self, trip_details: TripDetailsResource) -> None: trip_details.retrieve, ) - class AsyncTripDetailsResourceWithStreamingResponse: def __init__(self, trip_details: AsyncTripDetailsResource) -> None: self._trip_details = trip_details self.retrieve = async_to_streamed_response_wrapper( trip_details.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py index 4417b48..1a993a1 100644 --- a/src/onebusaway/resources/trip_for_vehicle.py +++ b/src/onebusaway/resources/trip_for_vehicle.py @@ -23,7 +23,6 @@ __all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"] - class TripForVehicleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripForVehicleResourceWithRawResponse: @@ -44,21 +43,19 @@ def with_streaming_response(self) -> TripForVehicleResourceWithStreamingResponse """ return TripForVehicleResourceWithStreamingResponse(self) - def retrieve( - self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripForVehicleRetrieveResponse: + def retrieve(self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -83,28 +80,20 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") + raise ValueError( + f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' + ) return self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, - trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), cast_to=TripForVehicleRetrieveResponse, ) - class AsyncTripForVehicleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse: @@ -125,21 +114,19 @@ def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingRes """ return AsyncTripForVehicleResourceWithStreamingResponse(self) - async def retrieve( - self, - vehicle_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripForVehicleRetrieveResponse: + async def retrieve(self, + vehicle_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripForVehicleRetrieveResponse: """ Retrieve trip for a specific vehicle @@ -164,28 +151,20 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if not vehicle_id: - raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}") + raise ValueError( + f'Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}' + ) return await self._get( f"/api/where/trip-for-vehicle/{vehicle_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "include_trip": include_trip, - "time": time, - }, - trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "include_trip": include_trip, + "time": time, + }, trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams)), cast_to=TripForVehicleRetrieveResponse, ) - class TripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -194,7 +173,6 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class AsyncTripForVehicleResourceWithRawResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -203,7 +181,6 @@ def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class TripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle @@ -212,11 +189,10 @@ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None: trip_for_vehicle.retrieve, ) - class AsyncTripForVehicleResourceWithStreamingResponse: def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None: self._trip_for_vehicle = trip_for_vehicle self.retrieve = async_to_streamed_response_wrapper( trip_for_vehicle.retrieve, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py index 84958f9..f3decf4 100644 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -23,7 +23,6 @@ __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] - class TripsForLocationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: @@ -44,23 +43,21 @@ def with_streaming_response(self) -> TripsForLocationResourceWithStreamingRespon """ return TripsForLocationResourceWithStreamingResponse(self) - def list( - self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationListResponse: + def list(self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -91,28 +88,18 @@ def list( """ return self._get( "/api/where/trips-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, - trips_for_location_list_params.TripsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, trips_for_location_list_params.TripsForLocationListParams)), cast_to=TripsForLocationListResponse, ) - class AsyncTripsForLocationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: @@ -133,23 +120,21 @@ def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingR """ return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def list( - self, - *, - lat: float, - lat_span: float, - lon: float, - lon_span: float, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_trip: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationListResponse: + async def list(self, + *, + lat: float, + lat_span: float, + lon: float, + lon_span: float, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_trip: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -180,28 +165,18 @@ async def list( """ return await self._get( "/api/where/trips-for-location.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "lat": lat, - "lat_span": lat_span, - "lon": lon, - "lon_span": lon_span, - "include_schedule": include_schedule, - "include_trip": include_trip, - "time": time, - }, - trips_for_location_list_params.TripsForLocationListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "lat": lat, + "lat_span": lat_span, + "lon": lon, + "lon_span": lon_span, + "include_schedule": include_schedule, + "include_trip": include_trip, + "time": time, + }, trips_for_location_list_params.TripsForLocationListParams)), cast_to=TripsForLocationListResponse, ) - class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -210,7 +185,6 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) - class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -219,7 +193,6 @@ def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: trips_for_location.list, ) - class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location @@ -228,11 +201,10 @@ def __init__(self, trips_for_location: TripsForLocationResource) -> None: trips_for_location.list, ) - class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location self.list = async_to_streamed_response_wrapper( trips_for_location.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py index a5ca21d..129ab33 100644 --- a/src/onebusaway/resources/trips_for_route.py +++ b/src/onebusaway/resources/trips_for_route.py @@ -23,7 +23,6 @@ __all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] - class TripsForRouteResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: @@ -44,20 +43,18 @@ def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: """ return TripsForRouteResourceWithStreamingResponse(self) - def list( - self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForRouteListResponse: + def list(self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -78,27 +75,19 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, - trips_for_route_list_params.TripsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, trips_for_route_list_params.TripsForRouteListParams)), cast_to=TripsForRouteListResponse, ) - class AsyncTripsForRouteResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: @@ -119,20 +108,18 @@ def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResp """ return AsyncTripsForRouteResourceWithStreamingResponse(self) - async def list( - self, - route_id: str, - *, - include_schedule: bool | NotGiven = NOT_GIVEN, - include_status: bool | NotGiven = NOT_GIVEN, - time: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForRouteListResponse: + async def list(self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: bool | NotGiven = NOT_GIVEN, + time: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> TripsForRouteListResponse: """ Search for active trips for a specific route. @@ -153,27 +140,19 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not route_id: - raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + raise ValueError( + f'Expected a non-empty value for `route_id` but received {route_id!r}' + ) return await self._get( f"/api/where/trips-for-route/{route_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_schedule": include_schedule, - "include_status": include_status, - "time": time, - }, - trips_for_route_list_params.TripsForRouteListParams, - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "include_schedule": include_schedule, + "include_status": include_status, + "time": time, + }, trips_for_route_list_params.TripsForRouteListParams)), cast_to=TripsForRouteListResponse, ) - class TripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -182,7 +161,6 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) - class AsyncTripsForRouteResourceWithRawResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -191,7 +169,6 @@ def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: trips_for_route.list, ) - class TripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: TripsForRouteResource) -> None: self._trips_for_route = trips_for_route @@ -200,11 +177,10 @@ def __init__(self, trips_for_route: TripsForRouteResource) -> None: trips_for_route.list, ) - class AsyncTripsForRouteResourceWithStreamingResponse: def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: self._trips_for_route = trips_for_route self.list = async_to_streamed_response_wrapper( trips_for_route.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py index 3f8697d..2cd39db 100644 --- a/src/onebusaway/resources/vehicles_for_agency.py +++ b/src/onebusaway/resources/vehicles_for_agency.py @@ -23,7 +23,6 @@ __all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] - class VehiclesForAgencyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: @@ -44,18 +43,16 @@ def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingRespo """ return VehiclesForAgencyResourceWithStreamingResponse(self) - def list( - self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VehiclesForAgencyListResponse: + def list(self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -71,20 +68,17 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({ + "time": time + }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), cast_to=VehiclesForAgencyListResponse, ) - class AsyncVehiclesForAgencyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: @@ -105,18 +99,16 @@ def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreaming """ return AsyncVehiclesForAgencyResourceWithStreamingResponse(self) - async def list( - self, - agency_id: str, - *, - time: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VehiclesForAgencyListResponse: + async def list(self, + agency_id: str, + *, + time: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,) -> VehiclesForAgencyListResponse: """ Get vehicles for a specific agency @@ -132,22 +124,17 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if not agency_id: - raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") + raise ValueError( + f'Expected a non-empty value for `agency_id` but received {agency_id!r}' + ) return await self._get( f"/api/where/vehicles-for-agency/{agency_id}.json", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams - ), - ), + options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({ + "time": time + }, vehicles_for_agency_list_params.VehiclesForAgencyListParams)), cast_to=VehiclesForAgencyListResponse, ) - class VehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -156,7 +143,6 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class AsyncVehiclesForAgencyResourceWithRawResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -165,7 +151,6 @@ def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class VehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency @@ -174,11 +159,10 @@ def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: vehicles_for_agency.list, ) - class AsyncVehiclesForAgencyResourceWithStreamingResponse: def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: self._vehicles_for_agency = vehicles_for_agency self.list = async_to_streamed_response_wrapper( vehicles_for_agency.list, - ) + ) \ No newline at end of file diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py index 13f182b..d972228 100644 --- a/src/onebusaway/types/agencies_with_coverage_list_response.py +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -8,32 +8,25 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "AgenciesWithCoverageListResponse", - "AgenciesWithCoverageListResponseData", - "AgenciesWithCoverageListResponseDataList", -] - +__all__ = ["AgenciesWithCoverageListResponse", "AgenciesWithCoverageListResponseData", "AgenciesWithCoverageListResponseDataList"] class AgenciesWithCoverageListResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") lat: float - lat_span: float = FieldInfo(alias="latSpan") + lat_span: float = FieldInfo(alias = "latSpan") lon: float - lon_span: float = FieldInfo(alias="lonSpan") - + lon_span: float = FieldInfo(alias = "lonSpan") class AgenciesWithCoverageListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[AgenciesWithCoverageListResponseDataList] references: References - class AgenciesWithCoverageListResponse(ResponseWrapper): - data: AgenciesWithCoverageListResponseData + data: AgenciesWithCoverageListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py index 61d8e79..a599b3c 100644 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -10,7 +10,6 @@ __all__ = ["AgencyRetrieveResponse", "AgencyRetrieveResponseData", "AgencyRetrieveResponseDataEntry"] - class AgencyRetrieveResponseDataEntry(BaseModel): id: str @@ -24,22 +23,20 @@ class AgencyRetrieveResponseDataEntry(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) + fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) - + private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") references: References - class AgencyRetrieveResponse(ResponseWrapper): - data: AgencyRetrieveResponseData + data: AgencyRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py index fd1f0c0..79b8ee0 100644 --- a/src/onebusaway/types/arrival_and_departure_list_params.py +++ b/src/onebusaway/types/arrival_and_departure_list_params.py @@ -10,7 +10,6 @@ __all__ = ["ArrivalAndDepartureListParams"] - class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_after: Annotated[int, PropertyInfo(alias="minutesAfter")] """Include vehicles arriving or departing in the next n minutes.""" @@ -18,5 +17,5 @@ class ArrivalAndDepartureListParams(TypedDict, total=False): minutes_before: Annotated[int, PropertyInfo(alias="minutesBefore")] """Include vehicles having arrived or departed in the previous n minutes.""" - time: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """The specific time for querying the system status.""" + time: Annotated[Union[str, datetime], PropertyInfo(format = "iso8601")] + """The specific time for querying the system status.""" \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py index cbabf18..65e555a 100644 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -8,16 +8,7 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ArrivalAndDepartureListResponse", - "ArrivalAndDepartureListResponseData", - "ArrivalAndDepartureListResponseDataEntry", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", - "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition", -] - +__all__ = ["ArrivalAndDepartureListResponse", "ArrivalAndDepartureListResponseData", "ArrivalAndDepartureListResponseDataEntry", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", "ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition"] class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -26,7 +17,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLast lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -34,39 +24,38 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -75,10 +64,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -87,10 +76,10 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -99,18 +88,16 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ - ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation - ] = FieldInfo(alias="lastKnownLocation", default=None) + last_known_location: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -122,160 +109,152 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas position: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias="stopSequence") + stop_sequence: int = FieldInfo(alias = "stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias="tripHeadsign") + trip_headsign: str = FieldInfo(alias = "tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( - alias="tripStatus", default=None - ) + trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo(alias = "tripStatus", default = None) """Trip-specific status for the arriving transit vehicle.""" - class ArrivalAndDepartureListResponseDataEntry(BaseModel): - arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( - alias="arrivalsAndDepartures" - ) - + arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo(alias = "arrivalsAndDepartures") class ArrivalAndDepartureListResponseData(BaseModel): entry: ArrivalAndDepartureListResponseDataEntry references: References - class ArrivalAndDepartureListResponse(ResponseWrapper): - data: ArrivalAndDepartureListResponseData + data: ArrivalAndDepartureListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py index 3451b73..ea44970 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_params.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_params.py @@ -8,7 +8,6 @@ __all__ = ["ArrivalAndDepartureRetrieveParams"] - class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): service_date: Required[Annotated[int, PropertyInfo(alias="serviceDate")]] @@ -18,4 +17,4 @@ class ArrivalAndDepartureRetrieveParams(TypedDict, total=False): time: int - vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] + vehicle_id: Annotated[str, PropertyInfo(alias="vehicleId")] \ No newline at end of file diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py index a0bc771..5b73f1f 100644 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -8,15 +8,7 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ArrivalAndDepartureRetrieveResponse", - "ArrivalAndDepartureRetrieveResponseData", - "ArrivalAndDepartureRetrieveResponseDataEntry", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", - "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition", -] - +__all__ = ["ArrivalAndDepartureRetrieveResponse", "ArrivalAndDepartureRetrieveResponseData", "ArrivalAndDepartureRetrieveResponseDataEntry", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatus", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation", "ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition"] class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None @@ -25,7 +17,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation(Ba lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -33,39 +24,38 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -74,10 +64,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -86,10 +76,10 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -98,18 +88,16 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -121,154 +109,149 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): position: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") """Indicates if riders can depart from this transit vehicle.""" - number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + number_of_stops_away: int = FieldInfo(alias = "numberOfStopsAway") """ Number of stops between the arriving transit vehicle and the current stop (excluding the current stop). """ - predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + predicted_arrival_time: int = FieldInfo(alias = "predictedArrivalTime") """ Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time available). """ - predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + predicted_departure_time: int = FieldInfo(alias = "predictedDepartureTime") """ Predicted departure time, in milliseconds since Unix epoch (zero if no real-time available). """ - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") """The ID of the route for the arriving vehicle.""" - scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + scheduled_arrival_time: int = FieldInfo(alias = "scheduledArrivalTime") """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + scheduled_departure_time: int = FieldInfo(alias = "scheduledDepartureTime") """Scheduled departure time, in milliseconds since Unix epoch.""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. """ - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") """The ID of the stop the vehicle is arriving at.""" - stop_sequence: int = FieldInfo(alias="stopSequence") + stop_sequence: int = FieldInfo(alias = "stopSequence") """ Index of the stop into the sequence of stops that make up the trip for this arrival. """ - total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + total_stops_in_trip: int = FieldInfo(alias = "totalStopsInTrip") """Total number of stops visited on the trip for this arrival.""" - trip_headsign: str = FieldInfo(alias="tripHeadsign") + trip_headsign: str = FieldInfo(alias = "tripHeadsign") """ Optional trip headsign that potentially overrides the trip headsign in the referenced trip element. """ - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") """The ID of the trip for the arriving vehicle.""" - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") """ID of the transit vehicle serving this trip.""" - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + actual_track: Optional[str] = FieldInfo(alias = "actualTrack", default = None) """The actual track information of the arriving transit vehicle.""" - distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + distance_from_stop: Optional[float] = FieldInfo(alias = "distanceFromStop", default = None) """Distance of the arriving transit vehicle from the stop, in meters.""" frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) """Historical occupancy information of the transit vehicle.""" - last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + last_update_time: Optional[int] = FieldInfo(alias = "lastUpdateTime", default = None) """Timestamp of the last update time for this arrival.""" - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) """Current occupancy status of the transit vehicle.""" predicted: Optional[bool] = None """Indicates if real-time arrival info is available for this trip.""" - predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + predicted_arrival_interval: Optional[str] = FieldInfo(alias = "predictedArrivalInterval", default = None) """Interval for predicted arrival time, if available.""" - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + predicted_departure_interval: Optional[str] = FieldInfo(alias = "predictedDepartureInterval", default = None) """Interval for predicted departure time, if available.""" - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + predicted_occupancy: Optional[str] = FieldInfo(alias = "predictedOccupancy", default = None) """Predicted occupancy status of the transit vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + route_long_name: Optional[str] = FieldInfo(alias = "routeLongName", default = None) """ Optional route long name that potentially overrides the route long name in the referenced route element. """ - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) """ Optional route short name that potentially overrides the route short name in the referenced route element. """ - scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + scheduled_arrival_interval: Optional[str] = FieldInfo(alias = "scheduledArrivalInterval", default = None) """Interval for scheduled arrival time.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + scheduled_departure_interval: Optional[str] = FieldInfo(alias = "scheduledDepartureInterval", default = None) """Interval for scheduled departure time.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + scheduled_track: Optional[str] = FieldInfo(alias = "scheduledTrack", default = None) """Scheduled track information of the arriving transit vehicle.""" - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this arrival.""" status: Optional[str] = None """Current status of the arrival.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( - alias="tripStatus", default=None - ) + trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo(alias = "tripStatus", default = None) """Trip-specific status for the arriving transit vehicle.""" - class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry references: References - class ArrivalAndDepartureRetrieveResponse(ResponseWrapper): - data: ArrivalAndDepartureRetrieveResponseData + data: ArrivalAndDepartureRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py index aecb822..abd6b68 100644 --- a/src/onebusaway/types/block_retrieve_response.py +++ b/src/onebusaway/types/block_retrieve_response.py @@ -8,70 +8,53 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "BlockRetrieveResponse", - "BlockRetrieveResponseData", - "BlockRetrieveResponseDataEntry", - "BlockRetrieveResponseDataEntryConfiguration", - "BlockRetrieveResponseDataEntryConfigurationTrip", - "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", - "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime", -] - +__all__ = ["BlockRetrieveResponse", "BlockRetrieveResponseData", "BlockRetrieveResponseDataEntry", "BlockRetrieveResponseDataEntryConfiguration", "BlockRetrieveResponseDataEntryConfigurationTrip", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime", "BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime"] class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime(BaseModel): - arrival_time: int = FieldInfo(alias="arrivalTime") - - departure_time: int = FieldInfo(alias="departureTime") + arrival_time: int = FieldInfo(alias = "arrivalTime") - stop_id: str = FieldInfo(alias="stopId") + departure_time: int = FieldInfo(alias = "departureTime") - drop_off_type: Optional[int] = FieldInfo(alias="dropOffType", default=None) + stop_id: str = FieldInfo(alias = "stopId") - pickup_type: Optional[int] = FieldInfo(alias="pickupType", default=None) + drop_off_type: Optional[int] = FieldInfo(alias = "dropOffType", default = None) + pickup_type: Optional[int] = FieldInfo(alias = "pickupType", default = None) class BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime(BaseModel): - accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") + accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") - block_sequence: int = FieldInfo(alias="blockSequence") + block_sequence: int = FieldInfo(alias = "blockSequence") - distance_along_block: float = FieldInfo(alias="distanceAlongBlock") - - stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias="stopTime") + distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + stop_time: BlockRetrieveResponseDataEntryConfigurationTripBlockStopTimeStopTime = FieldInfo(alias = "stopTime") class BlockRetrieveResponseDataEntryConfigurationTrip(BaseModel): - accumulated_slack_time: float = FieldInfo(alias="accumulatedSlackTime") - - block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo( - alias="blockStopTimes" - ) + accumulated_slack_time: float = FieldInfo(alias = "accumulatedSlackTime") - distance_along_block: float = FieldInfo(alias="distanceAlongBlock") + block_stop_times: List[BlockRetrieveResponseDataEntryConfigurationTripBlockStopTime] = FieldInfo(alias = "blockStopTimes") - trip_id: str = FieldInfo(alias="tripId") + distance_along_block: float = FieldInfo(alias = "distanceAlongBlock") + trip_id: str = FieldInfo(alias = "tripId") class BlockRetrieveResponseDataEntryConfiguration(BaseModel): - active_service_ids: List[str] = FieldInfo(alias="activeServiceIds") + active_service_ids: List[str] = FieldInfo(alias = "activeServiceIds") trips: List[BlockRetrieveResponseDataEntryConfigurationTrip] - inactive_service_ids: Optional[List[str]] = FieldInfo(alias="inactiveServiceIds", default=None) - + inactive_service_ids: Optional[List[str]] = FieldInfo(alias = "inactiveServiceIds", default = None) class BlockRetrieveResponseDataEntry(BaseModel): id: str configurations: List[BlockRetrieveResponseDataEntryConfiguration] - class BlockRetrieveResponseData(BaseModel): entry: BlockRetrieveResponseDataEntry references: References - class BlockRetrieveResponse(ResponseWrapper): - data: BlockRetrieveResponseData + data: BlockRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py index eaa7cf9..c81ccf4 100644 --- a/src/onebusaway/types/config_retrieve_response.py +++ b/src/onebusaway/types/config_retrieve_response.py @@ -8,75 +8,64 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ConfigRetrieveResponse", - "ConfigRetrieveResponseData", - "ConfigRetrieveResponseDataEntry", - "ConfigRetrieveResponseDataEntryGitProperties", -] - +__all__ = ["ConfigRetrieveResponse", "ConfigRetrieveResponseData", "ConfigRetrieveResponseDataEntry", "ConfigRetrieveResponseDataEntryGitProperties"] class ConfigRetrieveResponseDataEntryGitProperties(BaseModel): - git_branch: Optional[str] = FieldInfo(alias="git.branch", default=None) - - git_build_host: Optional[str] = FieldInfo(alias="git.build.host", default=None) + git_branch: Optional[str] = FieldInfo(alias = "git.branch", default = None) - git_build_time: Optional[str] = FieldInfo(alias="git.build.time", default=None) + git_build_host: Optional[str] = FieldInfo(alias = "git.build.host", default = None) - git_build_user_email: Optional[str] = FieldInfo(alias="git.build.user.email", default=None) + git_build_time: Optional[str] = FieldInfo(alias = "git.build.time", default = None) - git_build_user_name: Optional[str] = FieldInfo(alias="git.build.user.name", default=None) + git_build_user_email: Optional[str] = FieldInfo(alias = "git.build.user.email", default = None) - git_build_version: Optional[str] = FieldInfo(alias="git.build.version", default=None) + git_build_user_name: Optional[str] = FieldInfo(alias = "git.build.user.name", default = None) - git_closest_tag_commit_count: Optional[str] = FieldInfo(alias="git.closest.tag.commit.count", default=None) + git_build_version: Optional[str] = FieldInfo(alias = "git.build.version", default = None) - git_closest_tag_name: Optional[str] = FieldInfo(alias="git.closest.tag.name", default=None) + git_closest_tag_commit_count: Optional[str] = FieldInfo(alias = "git.closest.tag.commit.count", default = None) - git_commit_id: Optional[str] = FieldInfo(alias="git.commit.id", default=None) + git_closest_tag_name: Optional[str] = FieldInfo(alias = "git.closest.tag.name", default = None) - git_commit_id_abbrev: Optional[str] = FieldInfo(alias="git.commit.id.abbrev", default=None) + git_commit_id: Optional[str] = FieldInfo(alias = "git.commit.id", default = None) - git_commit_id_describe: Optional[str] = FieldInfo(alias="git.commit.id.describe", default=None) + git_commit_id_abbrev: Optional[str] = FieldInfo(alias = "git.commit.id.abbrev", default = None) - git_commit_id_describe_short: Optional[str] = FieldInfo(alias="git.commit.id.describe-short", default=None) + git_commit_id_describe: Optional[str] = FieldInfo(alias = "git.commit.id.describe", default = None) - git_commit_message_full: Optional[str] = FieldInfo(alias="git.commit.message.full", default=None) + git_commit_id_describe_short: Optional[str] = FieldInfo(alias = "git.commit.id.describe-short", default = None) - git_commit_message_short: Optional[str] = FieldInfo(alias="git.commit.message.short", default=None) + git_commit_message_full: Optional[str] = FieldInfo(alias = "git.commit.message.full", default = None) - git_commit_time: Optional[str] = FieldInfo(alias="git.commit.time", default=None) + git_commit_message_short: Optional[str] = FieldInfo(alias = "git.commit.message.short", default = None) - git_commit_user_email: Optional[str] = FieldInfo(alias="git.commit.user.email", default=None) + git_commit_time: Optional[str] = FieldInfo(alias = "git.commit.time", default = None) - git_commit_user_name: Optional[str] = FieldInfo(alias="git.commit.user.name", default=None) + git_commit_user_email: Optional[str] = FieldInfo(alias = "git.commit.user.email", default = None) - git_dirty: Optional[str] = FieldInfo(alias="git.dirty", default=None) + git_commit_user_name: Optional[str] = FieldInfo(alias = "git.commit.user.name", default = None) - git_remote_origin_url: Optional[str] = FieldInfo(alias="git.remote.origin.url", default=None) + git_dirty: Optional[str] = FieldInfo(alias = "git.dirty", default = None) - git_tags: Optional[str] = FieldInfo(alias="git.tags", default=None) + git_remote_origin_url: Optional[str] = FieldInfo(alias = "git.remote.origin.url", default = None) + git_tags: Optional[str] = FieldInfo(alias = "git.tags", default = None) class ConfigRetrieveResponseDataEntry(BaseModel): id: Optional[str] = None - git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo( - alias="gitProperties", default=None - ) + git_properties: Optional[ConfigRetrieveResponseDataEntryGitProperties] = FieldInfo(alias = "gitProperties", default = None) name: Optional[str] = None - service_date_from: Optional[str] = FieldInfo(alias="serviceDateFrom", default=None) - - service_date_to: Optional[str] = FieldInfo(alias="serviceDateTo", default=None) + service_date_from: Optional[str] = FieldInfo(alias = "serviceDateFrom", default = None) + service_date_to: Optional[str] = FieldInfo(alias = "serviceDateTo", default = None) class ConfigRetrieveResponseData(BaseModel): entry: ConfigRetrieveResponseDataEntry references: References - class ConfigRetrieveResponse(ResponseWrapper): - data: ConfigRetrieveResponseData + data: ConfigRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py index 20fddb2..90377e3 100644 --- a/src/onebusaway/types/current_time_retrieve_response.py +++ b/src/onebusaway/types/current_time_retrieve_response.py @@ -10,18 +10,15 @@ __all__ = ["CurrentTimeRetrieveResponse", "CurrentTimeRetrieveResponseData", "CurrentTimeRetrieveResponseDataEntry"] - class CurrentTimeRetrieveResponseDataEntry(BaseModel): - readable_time: Optional[str] = FieldInfo(alias="readableTime", default=None) + readable_time: Optional[str] = FieldInfo(alias = "readableTime", default = None) time: Optional[int] = None - class CurrentTimeRetrieveResponseData(BaseModel): entry: CurrentTimeRetrieveResponseDataEntry references: References - class CurrentTimeRetrieveResponse(ResponseWrapper): - data: CurrentTimeRetrieveResponseData + data: CurrentTimeRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py index 609f03f..559f5b8 100644 --- a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py @@ -8,7 +8,6 @@ __all__ = ["ReportProblemWithStopRetrieveParams"] - class ReportProblemWithStopRetrieveParams(TypedDict, total=False): code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] """A string code identifying the nature of the problem""" @@ -23,4 +22,4 @@ class ReportProblemWithStopRetrieveParams(TypedDict, total=False): """The reporting user’s location accuracy, in meters""" user_lon: Annotated[float, PropertyInfo(alias="userLon")] - """The reporting user’s current longitude""" + """The reporting user’s current longitude""" \ No newline at end of file diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py index f55386d..03bd538 100644 --- a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py +++ b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py @@ -8,16 +8,8 @@ __all__ = ["ReportProblemWithTripRetrieveParams"] - class ReportProblemWithTripRetrieveParams(TypedDict, total=False): - code: Literal[ - "vehicle_never_came", - "vehicle_came_early", - "vehicle_came_late", - "wrong_headsign", - "vehicle_does_not_stop_here", - "other", - ] + code: Literal["vehicle_never_came", "vehicle_came_early", "vehicle_came_late", "wrong_headsign", "vehicle_does_not_stop_here", "other"] """A string code identifying the nature of the problem""" service_date: Annotated[int, PropertyInfo(alias="serviceDate")] @@ -45,4 +37,4 @@ class ReportProblemWithTripRetrieveParams(TypedDict, total=False): """The vehicle number, as reported by the user""" vehicle_id: Annotated[str, PropertyInfo(alias="vehicleID")] - """The vehicle actively serving the trip""" + """The vehicle actively serving the trip""" \ No newline at end of file diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py index 193704e..520e852 100644 --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -10,14 +10,12 @@ __all__ = ["RouteIDsForAgencyListResponse", "RouteIDsForAgencyListResponseData"] - class RouteIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[str] references: References - class RouteIDsForAgencyListResponse(ResponseWrapper): - data: RouteIDsForAgencyListResponseData + data: RouteIDsForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py index a0dfa1e..aaf73fd 100644 --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -10,11 +10,10 @@ __all__ = ["RouteRetrieveResponse", "RouteRetrieveResponseData", "RouteRetrieveResponseDataEntry"] - class RouteRetrieveResponseDataEntry(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,22 +21,20 @@ class RouteRetrieveResponseDataEntry(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RouteRetrieveResponseData(BaseModel): entry: RouteRetrieveResponseDataEntry references: References - class RouteRetrieveResponse(ResponseWrapper): - data: RouteRetrieveResponseData + data: RouteRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py index 672141d..ccca9a8 100644 --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -10,11 +10,10 @@ __all__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"] - class RoutesForAgencyListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,24 +21,22 @@ class RoutesForAgencyListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RoutesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[RoutesForAgencyListResponseDataList] references: References - class RoutesForAgencyListResponse(ResponseWrapper): - data: RoutesForAgencyListResponseData + data: RoutesForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_location_list_params.py b/src/onebusaway/types/routes_for_location_list_params.py index 033ec2a..0773789 100644 --- a/src/onebusaway/types/routes_for_location_list_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -8,7 +8,6 @@ __all__ = ["RoutesForLocationListParams"] - class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -20,4 +19,4 @@ class RoutesForLocationListParams(TypedDict, total=False): query: str - radius: float + radius: float \ No newline at end of file diff --git a/src/onebusaway/types/routes_for_location_list_response.py b/src/onebusaway/types/routes_for_location_list_response.py index 0393f01..d053900 100644 --- a/src/onebusaway/types/routes_for_location_list_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -8,17 +8,12 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "RoutesForLocationListResponse", - "RoutesForLocationListResponseData", - "RoutesForLocationListResponseDataList", -] - +__all__ = ["RoutesForLocationListResponse", "RoutesForLocationListResponseData", "RoutesForLocationListResponseDataList"] class RoutesForLocationListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -26,26 +21,24 @@ class RoutesForLocationListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class RoutesForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[RoutesForLocationListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class RoutesForLocationListResponse(ResponseWrapper): - data: RoutesForLocationListResponseData + data: RoutesForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py index 6d4d029..e763ac0 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_params.py @@ -10,10 +10,9 @@ __all__ = ["ScheduleForRouteRetrieveParams"] - class ScheduleForRouteRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to current date) - """ + """ \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py index 8266786..4f02939 100644 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -7,17 +7,7 @@ from .._models import BaseModel from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ScheduleForRouteRetrieveResponse", - "ScheduleForRouteRetrieveResponseData", - "ScheduleForRouteRetrieveResponseDataEntry", - "ScheduleForRouteRetrieveResponseDataEntryStop", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", - "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", - "ScheduleForRouteRetrieveResponseDataEntryTrip", -] - +__all__ = ["ScheduleForRouteRetrieveResponse", "ScheduleForRouteRetrieveResponseData", "ScheduleForRouteRetrieveResponseDataEntry", "ScheduleForRouteRetrieveResponseDataEntryStop", "ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime", "ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime", "ScheduleForRouteRetrieveResponseDataEntryTrip"] class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): id: str @@ -30,102 +20,89 @@ class ScheduleForRouteRetrieveResponseDataEntryStop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") - arrival_time: int = FieldInfo(alias="arrivalTime") + arrival_time: int = FieldInfo(alias = "arrivalTime") - departure_enabled: bool = FieldInfo(alias="departureEnabled") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") - departure_time: int = FieldInfo(alias="departureTime") + departure_time: int = FieldInfo(alias = "departureTime") - stop_id: str = FieldInfo(alias="stopId") + stop_id: str = FieldInfo(alias = "stopId") - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + service_id: Optional[str] = FieldInfo(alias = "serviceId", default = None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime(BaseModel): - stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo( - alias="stopTimes" - ) - - trip_id: str = FieldInfo(alias="tripId") + stop_times: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTimeStopTime] = FieldInfo(alias = "stopTimes") + trip_id: str = FieldInfo(alias = "tripId") class ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping(BaseModel): - direction_id: str = FieldInfo(alias="directionId") + direction_id: str = FieldInfo(alias = "directionId") - stop_ids: List[str] = FieldInfo(alias="stopIds") + stop_ids: List[str] = FieldInfo(alias = "stopIds") - trip_headsigns: List[str] = FieldInfo(alias="tripHeadsigns") + trip_headsigns: List[str] = FieldInfo(alias = "tripHeadsigns") - trip_ids: List[str] = FieldInfo(alias="tripIds") - - trips_with_stop_times: Optional[ - List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime] - ] = FieldInfo(alias="tripsWithStopTimes", default=None) + trip_ids: List[str] = FieldInfo(alias = "tripIds") + trips_with_stop_times: Optional[List[ScheduleForRouteRetrieveResponseDataEntryStopTripGroupingTripsWithStopTime]] = FieldInfo(alias = "tripsWithStopTimes", default = None) class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") - - service_id: str = FieldInfo(alias="serviceId") + route_id: str = FieldInfo(alias = "routeId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + service_id: str = FieldInfo(alias = "serviceId") - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class ScheduleForRouteRetrieveResponseDataEntry(BaseModel): - route_id: str = FieldInfo(alias="routeId") + route_id: str = FieldInfo(alias = "routeId") - schedule_date: int = FieldInfo(alias="scheduleDate") + schedule_date: int = FieldInfo(alias = "scheduleDate") - service_ids: List[str] = FieldInfo(alias="serviceIds") + service_ids: List[str] = FieldInfo(alias = "serviceIds") stops: List[ScheduleForRouteRetrieveResponseDataEntryStop] - stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo( - alias="stopTripGroupings" - ) + stop_trip_groupings: List[ScheduleForRouteRetrieveResponseDataEntryStopTripGrouping] = FieldInfo(alias = "stopTripGroupings") trips: List[ScheduleForRouteRetrieveResponseDataEntryTrip] - class ScheduleForRouteRetrieveResponseData(BaseModel): entry: ScheduleForRouteRetrieveResponseDataEntry - class ScheduleForRouteRetrieveResponse(ResponseWrapper): - data: ScheduleForRouteRetrieveResponseData + data: ScheduleForRouteRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py index 99b89f7..fcfed09 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_params.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_params.py @@ -10,10 +10,9 @@ __all__ = ["ScheduleForStopRetrieveParams"] - class ScheduleForStopRetrieveParams(TypedDict, total=False): - date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + date: Annotated[Union[str, datetime.date], PropertyInfo(format = "iso8601")] """ The date for which you want to request a schedule in the format YYYY-MM-DD (optional, defaults to the current date) - """ + """ \ No newline at end of file diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py index 83d1985..619e319 100644 --- a/src/onebusaway/types/schedule_for_stop_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_stop_retrieve_response.py @@ -8,82 +8,59 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "ScheduleForStopRetrieveResponse", - "ScheduleForStopRetrieveResponseData", - "ScheduleForStopRetrieveResponseDataEntry", - "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", - "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency", -] - +__all__ = ["ScheduleForStopRetrieveResponse", "ScheduleForStopRetrieveResponseData", "ScheduleForStopRetrieveResponseDataEntry", "ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime", "ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency"] class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime(BaseModel): - arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") - - arrival_time: int = FieldInfo(alias="arrivalTime") + arrival_enabled: bool = FieldInfo(alias = "arrivalEnabled") - departure_enabled: bool = FieldInfo(alias="departureEnabled") + arrival_time: int = FieldInfo(alias = "arrivalTime") - departure_time: int = FieldInfo(alias="departureTime") + departure_enabled: bool = FieldInfo(alias = "departureEnabled") - service_id: str = FieldInfo(alias="serviceId") + departure_time: int = FieldInfo(alias = "departureTime") - trip_id: str = FieldInfo(alias="tripId") + service_id: str = FieldInfo(alias = "serviceId") - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + trip_id: str = FieldInfo(alias = "tripId") + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency(BaseModel): - end_time: int = FieldInfo(alias="endTime") + end_time: int = FieldInfo(alias = "endTime") headway: int - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") - service_id: str = FieldInfo(alias="serviceId") + service_id: str = FieldInfo(alias = "serviceId") - start_time: int = FieldInfo(alias="startTime") - - trip_id: str = FieldInfo(alias="tripId") + start_time: int = FieldInfo(alias = "startTime") + trip_id: str = FieldInfo(alias = "tripId") class ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule(BaseModel): - schedule_stop_times: List[ - ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime - ] = FieldInfo(alias="scheduleStopTimes") - - trip_headsign: str = FieldInfo(alias="tripHeadsign") + schedule_stop_times: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleStopTime] = FieldInfo(alias = "scheduleStopTimes") - schedule_frequencies: Optional[ - List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency] - ] = FieldInfo(alias="scheduleFrequencies", default=None) + trip_headsign: str = FieldInfo(alias = "tripHeadsign") + schedule_frequencies: Optional[List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionScheduleScheduleFrequency]] = FieldInfo(alias = "scheduleFrequencies", default = None) class ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule(BaseModel): - route_id: str = FieldInfo(alias="routeId") - - stop_route_direction_schedules: List[ - ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule - ] = FieldInfo(alias="stopRouteDirectionSchedules") + route_id: str = FieldInfo(alias = "routeId") + stop_route_direction_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteScheduleStopRouteDirectionSchedule] = FieldInfo(alias = "stopRouteDirectionSchedules") class ScheduleForStopRetrieveResponseDataEntry(BaseModel): date: int - stop_id: str = FieldInfo(alias="stopId") - - stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo( - alias="stopRouteSchedules" - ) + stop_id: str = FieldInfo(alias = "stopId") + stop_route_schedules: List[ScheduleForStopRetrieveResponseDataEntryStopRouteSchedule] = FieldInfo(alias = "stopRouteSchedules") class ScheduleForStopRetrieveResponseData(BaseModel): entry: ScheduleForStopRetrieveResponseDataEntry references: References - class ScheduleForStopRetrieveResponse(ResponseWrapper): - data: ScheduleForStopRetrieveResponseData + data: ScheduleForStopRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/search_for_route_list_params.py b/src/onebusaway/types/search_for_route_list_params.py index 76f767b..885eb3e 100755 --- a/src/onebusaway/types/search_for_route_list_params.py +++ b/src/onebusaway/types/search_for_route_list_params.py @@ -8,10 +8,9 @@ __all__ = ["SearchForRouteListParams"] - class SearchForRouteListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" + """The max number of results to return. Defaults to 20.""" \ No newline at end of file diff --git a/src/onebusaway/types/search_for_route_list_response.py b/src/onebusaway/types/search_for_route_list_response.py index e54153a..6d4b6d8 100755 --- a/src/onebusaway/types/search_for_route_list_response.py +++ b/src/onebusaway/types/search_for_route_list_response.py @@ -10,11 +10,10 @@ __all__ = ["SearchForRouteListResponse", "SearchForRouteListResponseData", "SearchForRouteListResponseDataList"] - class SearchForRouteListResponseDataList(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -22,26 +21,24 @@ class SearchForRouteListResponseDataList(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class SearchForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[SearchForRouteListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class SearchForRouteListResponse(ResponseWrapper): - data: Optional[SearchForRouteListResponseData] = None + data: Optional[SearchForRouteListResponseData] = None \ No newline at end of file diff --git a/src/onebusaway/types/search_for_stop_list_params.py b/src/onebusaway/types/search_for_stop_list_params.py index 012f802..42ba10a 100755 --- a/src/onebusaway/types/search_for_stop_list_params.py +++ b/src/onebusaway/types/search_for_stop_list_params.py @@ -8,10 +8,9 @@ __all__ = ["SearchForStopListParams"] - class SearchForStopListParams(TypedDict, total=False): input: Required[str] """The string to search for.""" max_count: Annotated[int, PropertyInfo(alias="maxCount")] - """The max number of results to return. Defaults to 20.""" + """The max number of results to return. Defaults to 20.""" \ No newline at end of file diff --git a/src/onebusaway/types/search_for_stop_list_response.py b/src/onebusaway/types/search_for_stop_list_response.py index 502455c..22d28a0 100755 --- a/src/onebusaway/types/search_for_stop_list_response.py +++ b/src/onebusaway/types/search_for_stop_list_response.py @@ -10,7 +10,6 @@ __all__ = ["SearchForStopListResponse", "SearchForStopListResponseData", "SearchForStopListResponseDataList"] - class SearchForStopListResponseDataList(BaseModel): id: str @@ -22,28 +21,26 @@ class SearchForStopListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class SearchForStopListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[SearchForStopListResponseDataList] - out_of_range: bool = FieldInfo(alias="outOfRange") + out_of_range: bool = FieldInfo(alias = "outOfRange") references: References - class SearchForStopListResponse(ResponseWrapper): - data: Optional[SearchForStopListResponseData] = None + data: Optional[SearchForStopListResponseData] = None \ No newline at end of file diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py index 07a3b6a..e331899 100644 --- a/src/onebusaway/types/shape_retrieve_response.py +++ b/src/onebusaway/types/shape_retrieve_response.py @@ -8,7 +8,6 @@ __all__ = ["ShapeRetrieveResponse", "ShapeRetrieveResponseData", "ShapeRetrieveResponseDataEntry"] - class ShapeRetrieveResponseDataEntry(BaseModel): length: int @@ -17,12 +16,10 @@ class ShapeRetrieveResponseDataEntry(BaseModel): levels: Optional[str] = None - class ShapeRetrieveResponseData(BaseModel): entry: ShapeRetrieveResponseDataEntry references: References - class ShapeRetrieveResponse(ResponseWrapper): - data: ShapeRetrieveResponseData + data: ShapeRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py index 1da019e..5991736 100644 --- a/src/onebusaway/types/shared/__init__.py +++ b/src/onebusaway/types/shared/__init__.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .references import References as References -from .response_wrapper import ResponseWrapper as ResponseWrapper +from .response_wrapper import ResponseWrapper as ResponseWrapper \ No newline at end of file diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py index 8c6deab..4eca75f 100644 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -7,25 +7,7 @@ from ..._models import BaseModel -__all__ = [ - "References", - "Agency", - "Route", - "Situation", - "SituationActiveWindow", - "SituationAllAffect", - "SituationConsequence", - "SituationConsequenceConditionDetails", - "SituationConsequenceConditionDetailsDiversionPath", - "SituationDescription", - "SituationPublicationWindow", - "SituationSummary", - "SituationURL", - "Stop", - "StopTime", - "Trip", -] - +__all__ = ["References", "Agency", "Route", "Situation", "SituationActiveWindow", "SituationAllAffect", "SituationConsequence", "SituationConsequenceConditionDetails", "SituationConsequenceConditionDetailsDiversionPath", "SituationDescription", "SituationPublicationWindow", "SituationSummary", "SituationURL", "Stop", "StopTime", "Trip"] class Agency(BaseModel): id: str @@ -40,19 +22,18 @@ class Agency(BaseModel): email: Optional[str] = None - fare_url: Optional[str] = FieldInfo(alias="fareUrl", default=None) + fare_url: Optional[str] = FieldInfo(alias = "fareUrl", default = None) lang: Optional[str] = None phone: Optional[str] = None - private_service: Optional[bool] = FieldInfo(alias="privateService", default=None) - + private_service: Optional[bool] = FieldInfo(alias = "privateService", default = None) class Route(BaseModel): id: str - agency_id: str = FieldInfo(alias="agencyId") + agency_id: str = FieldInfo(alias = "agencyId") type: int @@ -60,45 +41,42 @@ class Route(BaseModel): description: Optional[str] = None - long_name: Optional[str] = FieldInfo(alias="longName", default=None) + long_name: Optional[str] = FieldInfo(alias = "longName", default = None) - null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias = "nullSafeShortName", default = None) - short_name: Optional[str] = FieldInfo(alias="shortName", default=None) + short_name: Optional[str] = FieldInfo(alias = "shortName", default = None) - text_color: Optional[str] = FieldInfo(alias="textColor", default=None) + text_color: Optional[str] = FieldInfo(alias = "textColor", default = None) url: Optional[str] = None - class SituationActiveWindow(BaseModel): - from_: Optional[int] = FieldInfo(alias="from", default=None) + from_: Optional[int] = FieldInfo(alias = "from", default = None) """Start time of the active window as a Unix timestamp.""" to: Optional[int] = None """End time of the active window as a Unix timestamp.""" - class SituationAllAffect(BaseModel): - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: Optional[str] = FieldInfo(alias = "agencyId", default = None) """Identifier for the agency.""" - application_id: Optional[str] = FieldInfo(alias="applicationId", default=None) + application_id: Optional[str] = FieldInfo(alias = "applicationId", default = None) """Identifier for the application.""" - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) """Identifier for the direction.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) + route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) """Identifier for the route.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) """Identifier for the stop.""" - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) + trip_id: Optional[str] = FieldInfo(alias = "tripId", default = None) """Identifier for the trip.""" - class SituationConsequenceConditionDetailsDiversionPath(BaseModel): length: Optional[int] = None """Length of the diversion path.""" @@ -109,23 +87,16 @@ class SituationConsequenceConditionDetailsDiversionPath(BaseModel): points: Optional[str] = None """Points of the diversion path.""" - class SituationConsequenceConditionDetails(BaseModel): - diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo( - alias="diversionPath", default=None - ) - - diversion_stop_ids: Optional[List[str]] = FieldInfo(alias="diversionStopIds", default=None) + diversion_path: Optional[SituationConsequenceConditionDetailsDiversionPath] = FieldInfo(alias = "diversionPath", default = None) + diversion_stop_ids: Optional[List[str]] = FieldInfo(alias = "diversionStopIds", default = None) class SituationConsequence(BaseModel): condition: Optional[str] = None """Condition of the consequence.""" - condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo( - alias="conditionDetails", default=None - ) - + condition_details: Optional[SituationConsequenceConditionDetails] = FieldInfo(alias = "conditionDetails", default = None) class SituationDescription(BaseModel): lang: Optional[str] = None @@ -134,15 +105,13 @@ class SituationDescription(BaseModel): value: Optional[str] = None """Longer description of the situation.""" - class SituationPublicationWindow(BaseModel): - from_: int = FieldInfo(alias="from") + from_: int = FieldInfo(alias = "from") """Start time of the time window as a Unix timestamp.""" to: int """End time of the time window as a Unix timestamp.""" - class SituationSummary(BaseModel): lang: Optional[str] = None """Language of the summary.""" @@ -150,7 +119,6 @@ class SituationSummary(BaseModel): value: Optional[str] = None """Short summary of the situation.""" - class SituationURL(BaseModel): lang: Optional[str] = None """Language of the URL.""" @@ -158,32 +126,27 @@ class SituationURL(BaseModel): value: Optional[str] = None """URL for more information about the situation.""" - class Situation(BaseModel): id: str """Unique identifier for the situation.""" - creation_time: int = FieldInfo(alias="creationTime") + creation_time: int = FieldInfo(alias = "creationTime") """Unix timestamp of when this situation was created.""" - active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias="activeWindows", default=None) + active_windows: Optional[List[SituationActiveWindow]] = FieldInfo(alias = "activeWindows", default = None) - all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias="allAffects", default=None) + all_affects: Optional[List[SituationAllAffect]] = FieldInfo(alias = "allAffects", default = None) - consequence_message: Optional[str] = FieldInfo(alias="consequenceMessage", default=None) + consequence_message: Optional[str] = FieldInfo(alias = "consequenceMessage", default = None) """Message regarding the consequence of the situation.""" consequences: Optional[List[SituationConsequence]] = None description: Optional[SituationDescription] = None - publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo( - alias="publicationWindows", default=None - ) + publication_windows: Optional[List[SituationPublicationWindow]] = FieldInfo(alias = "publicationWindows", default = None) - reason: Optional[ - Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"] - ] = None + reason: Optional[Literal["equipmentReason", "environmentReason", "personnelReason", "miscellaneousReason", "securityAlert"]] = None """Reason for the service alert, taken from TPEG codes.""" severity: Optional[str] = None @@ -193,7 +156,6 @@ class Situation(BaseModel): url: Optional[SituationURL] = None - class Stop(BaseModel): id: str @@ -205,56 +167,53 @@ class Stop(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) - - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class Trip(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") - - service_id: str = FieldInfo(alias="serviceId") + route_id: str = FieldInfo(alias = "routeId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + service_id: str = FieldInfo(alias = "serviceId") - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class References(BaseModel): agencies: List[Agency] @@ -265,6 +224,6 @@ class References(BaseModel): stops: List[Stop] - stop_times: List[StopTime] = FieldInfo(alias="stopTimes") + stop_times: List[StopTime] = FieldInfo(alias = "stopTimes") - trips: List[Trip] + trips: List[Trip] \ No newline at end of file diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py index 72ecc38..77dae24 100644 --- a/src/onebusaway/types/shared/response_wrapper.py +++ b/src/onebusaway/types/shared/response_wrapper.py @@ -7,12 +7,11 @@ __all__ = ["ResponseWrapper"] - class ResponseWrapper(BaseModel): code: int - current_time: int = FieldInfo(alias="currentTime") + current_time: int = FieldInfo(alias = "currentTime") text: str - version: int + version: int \ No newline at end of file diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py index 3ae9947..bd9c2fe 100644 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -10,14 +10,12 @@ __all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"] - class StopIDsForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[str] references: References - class StopIDsForAgencyListResponse(ResponseWrapper): - data: StopIDsForAgencyListResponseData + data: StopIDsForAgencyListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py index 6a69553..49c171b 100644 --- a/src/onebusaway/types/stop_retrieve_response.py +++ b/src/onebusaway/types/stop_retrieve_response.py @@ -10,7 +10,6 @@ __all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"] - class StopRetrieveResponseDataEntry(BaseModel): id: str @@ -22,24 +21,22 @@ class StopRetrieveResponseDataEntry(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopRetrieveResponseData(BaseModel): entry: StopRetrieveResponseDataEntry references: References - class StopRetrieveResponse(ResponseWrapper): - data: StopRetrieveResponseData + data: StopRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_agency_list_response.py b/src/onebusaway/types/stops_for_agency_list_response.py index 422c5ee..467880b 100644 --- a/src/onebusaway/types/stops_for_agency_list_response.py +++ b/src/onebusaway/types/stops_for_agency_list_response.py @@ -10,7 +10,6 @@ __all__ = ["StopsForAgencyListResponse", "StopsForAgencyListResponseList"] - class StopsForAgencyListResponseList(BaseModel): id: str @@ -22,24 +21,23 @@ class StopsForAgencyListResponseList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForAgencyListResponse(ResponseWrapper): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[StopsForAgencyListResponseList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py index 3174257..4b672c6 100644 --- a/src/onebusaway/types/stops_for_location_list_params.py +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -8,7 +8,6 @@ __all__ = ["StopsForLocationListParams"] - class StopsForLocationListParams(TypedDict, total=False): lat: Required[float] @@ -24,4 +23,4 @@ class StopsForLocationListParams(TypedDict, total=False): """A search query string to filter the results""" radius: float - """The radius in meters to search within""" + """The radius in meters to search within""" \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_location_list_response.py b/src/onebusaway/types/stops_for_location_list_response.py index e075eb1..c2404b9 100644 --- a/src/onebusaway/types/stops_for_location_list_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -10,7 +10,6 @@ __all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] - class StopsForLocationListResponseDataList(BaseModel): id: str @@ -22,28 +21,26 @@ class StopsForLocationListResponseDataList(BaseModel): parent: str - route_ids: List[str] = FieldInfo(alias="routeIds") + route_ids: List[str] = FieldInfo(alias = "routeIds") - static_route_ids: List[str] = FieldInfo(alias="staticRouteIds") + static_route_ids: List[str] = FieldInfo(alias = "staticRouteIds") code: Optional[str] = None direction: Optional[str] = None - location_type: Optional[int] = FieldInfo(alias="locationType", default=None) - - wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) + location_type: Optional[int] = FieldInfo(alias = "locationType", default = None) + wheelchair_boarding: Optional[str] = FieldInfo(alias = "wheelchairBoarding", default = None) class StopsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[StopsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) - + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) class StopsForLocationListResponse(ResponseWrapper): - data: StopsForLocationListResponseData + data: StopsForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py index ddf40d0..c55ae9d 100644 --- a/src/onebusaway/types/stops_for_route_list_params.py +++ b/src/onebusaway/types/stops_for_route_list_params.py @@ -8,10 +8,9 @@ __all__ = ["StopsForRouteListParams"] - class StopsForRouteListParams(TypedDict, total=False): include_polylines: Annotated[bool, PropertyInfo(alias="includePolylines")] """Include polyline elements in the response (default true)""" time: str - """Specify service date (YYYY-MM-DD or epoch) (default today)""" + """Specify service date (YYYY-MM-DD or epoch) (default today)""" \ No newline at end of file diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py index 53cff4e..4528bac 100644 --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -8,16 +8,7 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopsForRouteListResponse", - "StopsForRouteListResponseData", - "StopsForRouteListResponseDataEntry", - "StopsForRouteListResponseDataEntryPolyline", - "StopsForRouteListResponseDataEntryStopGrouping", - "StopsForRouteListResponseDataEntryStopGroupingName", - "StopsForRouteListResponseDataEntryStopGroupingPolyline", -] - +__all__ = ["StopsForRouteListResponse", "StopsForRouteListResponseData", "StopsForRouteListResponseDataEntry", "StopsForRouteListResponseDataEntryPolyline", "StopsForRouteListResponseDataEntryStopGrouping", "StopsForRouteListResponseDataEntryStopGroupingName", "StopsForRouteListResponseDataEntryStopGroupingPolyline"] class StopsForRouteListResponseDataEntryPolyline(BaseModel): length: Optional[int] = None @@ -26,7 +17,6 @@ class StopsForRouteListResponseDataEntryPolyline(BaseModel): points: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): name: Optional[str] = None @@ -34,7 +24,6 @@ class StopsForRouteListResponseDataEntryStopGroupingName(BaseModel): type: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): length: Optional[int] = None @@ -42,7 +31,6 @@ class StopsForRouteListResponseDataEntryStopGroupingPolyline(BaseModel): points: Optional[str] = None - class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): id: Optional[str] = None @@ -50,26 +38,21 @@ class StopsForRouteListResponseDataEntryStopGrouping(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryStopGroupingPolyline]] = None - stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) - + stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) class StopsForRouteListResponseDataEntry(BaseModel): polylines: Optional[List[StopsForRouteListResponseDataEntryPolyline]] = None - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - - stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo( - alias="stopGroupings", default=None - ) + route_id: Optional[str] = FieldInfo(alias = "routeId", default = None) - stop_ids: Optional[List[str]] = FieldInfo(alias="stopIds", default=None) + stop_groupings: Optional[List[StopsForRouteListResponseDataEntryStopGrouping]] = FieldInfo(alias = "stopGroupings", default = None) + stop_ids: Optional[List[str]] = FieldInfo(alias = "stopIds", default = None) class StopsForRouteListResponseData(BaseModel): entry: StopsForRouteListResponseDataEntry references: References - class StopsForRouteListResponse(ResponseWrapper): - data: StopsForRouteListResponseData + data: StopsForRouteListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py index a8529bf..42a37db 100644 --- a/src/onebusaway/types/trip_detail_retrieve_params.py +++ b/src/onebusaway/types/trip_detail_retrieve_params.py @@ -8,7 +8,6 @@ __all__ = ["TripDetailRetrieveParams"] - class TripDetailRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -32,4 +31,4 @@ class TripDetailRetrieveParams(TypedDict, total=False): """Service date for the trip as Unix time in milliseconds (optional).""" time: int - """Time parameter to query the system at a specific time (optional).""" + """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py index 4b76689..99d8166 100644 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -8,44 +8,32 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripDetailRetrieveResponse", - "TripDetailRetrieveResponseData", - "TripDetailRetrieveResponseDataEntry", - "TripDetailRetrieveResponseDataEntrySchedule", - "TripDetailRetrieveResponseDataEntryScheduleStopTime", - "TripDetailRetrieveResponseDataEntryStatus", - "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", - "TripDetailRetrieveResponseDataEntryStatusPosition", -] - +__all__ = ["TripDetailRetrieveResponse", "TripDetailRetrieveResponseData", "TripDetailRetrieveResponseDataEntry", "TripDetailRetrieveResponseDataEntrySchedule", "TripDetailRetrieveResponseDataEntryScheduleStopTime", "TripDetailRetrieveResponseDataEntryStatus", "TripDetailRetrieveResponseDataEntryStatusLastKnownLocation", "TripDetailRetrieveResponseDataEntryStatusPosition"] class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +41,6 @@ class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +48,38 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +88,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +100,10 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +112,16 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,38 +133,35 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripDetailRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripDetailRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None - class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry references: References - class TripDetailRetrieveResponse(ResponseWrapper): - data: TripDetailRetrieveResponseData + data: TripDetailRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py index 3e8240c..7cf1876 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py @@ -8,7 +8,6 @@ __all__ = ["TripForVehicleRetrieveParams"] - class TripForVehicleRetrieveParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """ @@ -30,4 +29,4 @@ class TripForVehicleRetrieveParams(TypedDict, total=False): """ time: int - """Time parameter to query the system at a specific time (optional).""" + """Time parameter to query the system at a specific time (optional).""" \ No newline at end of file diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py index 136b96c..cecc593 100644 --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -8,44 +8,32 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripForVehicleRetrieveResponse", - "TripForVehicleRetrieveResponseData", - "TripForVehicleRetrieveResponseDataEntry", - "TripForVehicleRetrieveResponseDataEntrySchedule", - "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", - "TripForVehicleRetrieveResponseDataEntryStatus", - "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", - "TripForVehicleRetrieveResponseDataEntryStatusPosition", -] - +__all__ = ["TripForVehicleRetrieveResponse", "TripForVehicleRetrieveResponseData", "TripForVehicleRetrieveResponseDataEntry", "TripForVehicleRetrieveResponseDataEntrySchedule", "TripForVehicleRetrieveResponseDataEntryScheduleStopTime", "TripForVehicleRetrieveResponseDataEntryStatus", "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation", "TripForVehicleRetrieveResponseDataEntryStatusPosition"] class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +41,6 @@ class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +48,38 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +88,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +100,10 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +112,16 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,38 +133,35 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripForVehicleRetrieveResponseDataEntry(BaseModel): - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None - class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry references: References - class TripForVehicleRetrieveResponse(ResponseWrapper): - data: TripForVehicleRetrieveResponseData + data: TripForVehicleRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py index 152bfa2..7c3c1bc 100644 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -10,36 +10,33 @@ __all__ = ["TripRetrieveResponse", "TripRetrieveResponseData", "TripRetrieveResponseDataEntry"] - class TripRetrieveResponseDataEntry(BaseModel): id: str - route_id: str = FieldInfo(alias="routeId") - - service_id: str = FieldInfo(alias="serviceId") + route_id: str = FieldInfo(alias = "routeId") - block_id: Optional[str] = FieldInfo(alias="blockId", default=None) + service_id: str = FieldInfo(alias = "serviceId") - direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) + block_id: Optional[str] = FieldInfo(alias = "blockId", default = None) - peak_offpeak: Optional[int] = FieldInfo(alias="peakOffpeak", default=None) + direction_id: Optional[str] = FieldInfo(alias = "directionId", default = None) - route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + peak_offpeak: Optional[int] = FieldInfo(alias = "peakOffpeak", default = None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) + route_short_name: Optional[str] = FieldInfo(alias = "routeShortName", default = None) - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + shape_id: Optional[str] = FieldInfo(alias = "shapeId", default = None) - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) + time_zone: Optional[str] = FieldInfo(alias = "timeZone", default = None) - trip_short_name: Optional[str] = FieldInfo(alias="tripShortName", default=None) + trip_headsign: Optional[str] = FieldInfo(alias = "tripHeadsign", default = None) + trip_short_name: Optional[str] = FieldInfo(alias = "tripShortName", default = None) class TripRetrieveResponseData(BaseModel): entry: TripRetrieveResponseDataEntry references: References - class TripRetrieveResponse(ResponseWrapper): - data: TripRetrieveResponseData + data: TripRetrieveResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_location_list_params.py b/src/onebusaway/types/trips_for_location_list_params.py index 69a9186..5c50ae9 100644 --- a/src/onebusaway/types/trips_for_location_list_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -8,7 +8,6 @@ __all__ = ["TripsForLocationListParams"] - class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] """The latitude coordinate of the search center""" @@ -35,4 +34,4 @@ class TripsForLocationListParams(TypedDict, total=False): """ time: int - """Specific time for the query. Defaults to the current time.""" + """Specific time for the query. Defaults to the current time.""" \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py index 68ae881..01b2233 100644 --- a/src/onebusaway/types/trips_for_location_list_response.py +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -8,44 +8,32 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripsForLocationListResponse", - "TripsForLocationListResponseData", - "TripsForLocationListResponseDataList", - "TripsForLocationListResponseDataListSchedule", - "TripsForLocationListResponseDataListScheduleStopTime", - "TripsForLocationListResponseDataListStatus", - "TripsForLocationListResponseDataListStatusLastKnownLocation", - "TripsForLocationListResponseDataListStatusPosition", -] - +__all__ = ["TripsForLocationListResponse", "TripsForLocationListResponseData", "TripsForLocationListResponseDataList", "TripsForLocationListResponseDataListSchedule", "TripsForLocationListResponseDataListScheduleStopTime", "TripsForLocationListResponseDataListStatus", "TripsForLocationListResponseDataListStatusLastKnownLocation", "TripsForLocationListResponseDataListStatusPosition"] class TripsForLocationListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForLocationListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +41,6 @@ class TripsForLocationListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripsForLocationListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +48,38 @@ class TripsForLocationListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripsForLocationListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +88,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +100,10 @@ class TripsForLocationListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +112,16 @@ class TripsForLocationListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripsForLocationListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,44 +133,41 @@ class TripsForLocationListResponseDataListStatus(BaseModel): position: Optional[TripsForLocationListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripsForLocationListResponseDataList(BaseModel): schedule: TripsForLocationListResponseDataListSchedule status: TripsForLocationListResponseDataListStatus - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForLocationListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") """Indicates if the limit of trips has been exceeded""" list: List[TripsForLocationListResponseDataList] references: References - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + out_of_range: Optional[bool] = FieldInfo(alias = "outOfRange", default = None) """Indicates if the search location is out of range""" - class TripsForLocationListResponse(ResponseWrapper): - data: TripsForLocationListResponseData + data: TripsForLocationListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py index c2f7ec0..e1dbb72 100644 --- a/src/onebusaway/types/trips_for_route_list_params.py +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -8,7 +8,6 @@ __all__ = ["TripsForRouteListParams"] - class TripsForRouteListParams(TypedDict, total=False): include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] """Determine whether full schedule elements are included. Defaults to false.""" @@ -20,4 +19,4 @@ class TripsForRouteListParams(TypedDict, total=False): """ time: int - """Query the system at a specific time. Useful for testing.""" + """Query the system at a specific time. Useful for testing.""" \ No newline at end of file diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py index f9bc2d8..3e33f85 100644 --- a/src/onebusaway/types/trips_for_route_list_response.py +++ b/src/onebusaway/types/trips_for_route_list_response.py @@ -8,44 +8,32 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "TripsForRouteListResponse", - "TripsForRouteListResponseData", - "TripsForRouteListResponseDataList", - "TripsForRouteListResponseDataListSchedule", - "TripsForRouteListResponseDataListScheduleStopTime", - "TripsForRouteListResponseDataListStatus", - "TripsForRouteListResponseDataListStatusLastKnownLocation", - "TripsForRouteListResponseDataListStatusPosition", -] - +__all__ = ["TripsForRouteListResponse", "TripsForRouteListResponseData", "TripsForRouteListResponseDataList", "TripsForRouteListResponseDataListSchedule", "TripsForRouteListResponseDataListScheduleStopTime", "TripsForRouteListResponseDataListStatus", "TripsForRouteListResponseDataListStatusLastKnownLocation", "TripsForRouteListResponseDataListStatusPosition"] class TripsForRouteListResponseDataListScheduleStopTime(BaseModel): - arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None) - - departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None) + arrival_time: Optional[int] = FieldInfo(alias = "arrivalTime", default = None) - distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None) + departure_time: Optional[int] = FieldInfo(alias = "departureTime", default = None) - historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + distance_along_trip: Optional[float] = FieldInfo(alias = "distanceAlongTrip", default = None) - stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None) + historical_occupancy: Optional[str] = FieldInfo(alias = "historicalOccupancy", default = None) - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + stop_headsign: Optional[str] = FieldInfo(alias = "stopHeadsign", default = None) + stop_id: Optional[str] = FieldInfo(alias = "stopId", default = None) class TripsForRouteListResponseDataListSchedule(BaseModel): - next_trip_id: str = FieldInfo(alias="nextTripId") + next_trip_id: str = FieldInfo(alias = "nextTripId") - previous_trip_id: str = FieldInfo(alias="previousTripId") + previous_trip_id: str = FieldInfo(alias = "previousTripId") - stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias = "stopTimes") - time_zone: str = FieldInfo(alias="timeZone") + time_zone: str = FieldInfo(alias = "timeZone") frequency: Optional[str] = None - class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -53,7 +41,6 @@ class TripsForRouteListResponseDataListStatusLastKnownLocation(BaseModel): lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class TripsForRouteListResponseDataListStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -61,39 +48,38 @@ class TripsForRouteListResponseDataListStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class TripsForRouteListResponseDataListStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -102,10 +88,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -114,10 +100,10 @@ class TripsForRouteListResponseDataListStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -126,18 +112,16 @@ class TripsForRouteListResponseDataListStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[TripsForRouteListResponseDataListStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -149,40 +133,37 @@ class TripsForRouteListResponseDataListStatus(BaseModel): position: Optional[TripsForRouteListResponseDataListStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class TripsForRouteListResponseDataList(BaseModel): schedule: TripsForRouteListResponseDataListSchedule status: TripsForRouteListResponseDataListStatus - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") frequency: Optional[str] = None - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + service_date: Optional[int] = FieldInfo(alias = "serviceDate", default = None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) class TripsForRouteListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[TripsForRouteListResponseDataList] references: References - class TripsForRouteListResponse(ResponseWrapper): - data: TripsForRouteListResponseData + data: TripsForRouteListResponseData \ No newline at end of file diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py index ebf92d1..808fd7a 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_params.py +++ b/src/onebusaway/types/vehicles_for_agency_list_params.py @@ -6,7 +6,6 @@ __all__ = ["VehiclesForAgencyListParams"] - class VehiclesForAgencyListParams(TypedDict, total=False): time: str - """Specific time for querying the status (timestamp format)""" + """Specific time for querying the status (timestamp format)""" \ No newline at end of file diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py index 34601dd..05d11de 100644 --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -8,23 +8,13 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "VehiclesForAgencyListResponse", - "VehiclesForAgencyListResponseData", - "VehiclesForAgencyListResponseDataList", - "VehiclesForAgencyListResponseDataListLocation", - "VehiclesForAgencyListResponseDataListTripStatus", - "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", - "VehiclesForAgencyListResponseDataListTripStatusPosition", -] - +__all__ = ["VehiclesForAgencyListResponse", "VehiclesForAgencyListResponseData", "VehiclesForAgencyListResponseDataList", "VehiclesForAgencyListResponseDataListLocation", "VehiclesForAgencyListResponseDataListTripStatus", "VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation", "VehiclesForAgencyListResponseDataListTripStatusPosition"] class VehiclesForAgencyListResponseDataListLocation(BaseModel): lat: Optional[float] = None lon: Optional[float] = None - class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel): lat: Optional[float] = None """Latitude of the last known location of the transit vehicle.""" @@ -32,7 +22,6 @@ class VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation(BaseModel lon: Optional[float] = None """Longitude of the last known location of the transit vehicle.""" - class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lat: Optional[float] = None """Latitude of the current position of the transit vehicle.""" @@ -40,39 +29,38 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): lon: Optional[float] = None """Longitude of the current position of the transit vehicle.""" - class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: str = FieldInfo(alias="activeTripId") + active_trip_id: str = FieldInfo(alias = "activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + block_trip_sequence: int = FieldInfo(alias = "blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: str = FieldInfo(alias="closestStop") + closest_stop: str = FieldInfo(alias = "closestStop") """ID of the closest stop to the current location of the transit vehicle.""" - distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + distance_along_trip: float = FieldInfo(alias = "distanceAlongTrip") """Distance, in meters, the transit vehicle has progressed along the active trip.""" - last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + last_known_distance_along_trip: float = FieldInfo(alias = "lastKnownDistanceAlongTrip") """ Last known distance along the trip received in real-time from the transit vehicle. """ - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") """Timestamp of the last known real-time location update from the transit vehicle.""" - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") """Timestamp of the last known real-time update from the transit vehicle.""" - occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + occupancy_capacity: int = FieldInfo(alias = "occupancyCapacity") """Capacity of the transit vehicle in terms of occupancy.""" - occupancy_count: int = FieldInfo(alias="occupancyCount") + occupancy_count: int = FieldInfo(alias = "occupancyCount") """Current count of occupants in the transit vehicle.""" - occupancy_status: str = FieldInfo(alias="occupancyStatus") + occupancy_status: str = FieldInfo(alias = "occupancyStatus") """Current occupancy status of the transit vehicle.""" phase: str @@ -81,10 +69,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): predicted: bool """Indicates if real-time arrival info is available for this trip.""" - schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + schedule_deviation: int = FieldInfo(alias = "scheduleDeviation") """Deviation from the schedule in seconds (positive for late, negative for early).""" - service_date: int = FieldInfo(alias="serviceDate") + service_date: int = FieldInfo(alias = "serviceDate") """ Time, in milliseconds since the Unix epoch, of midnight for the start of the service date for the trip. @@ -93,10 +81,10 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): status: str """Current status modifiers for the trip.""" - total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + total_distance_along_trip: float = FieldInfo(alias = "totalDistanceAlongTrip") """Total length of the trip, in meters.""" - closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + closest_stop_time_offset: Optional[int] = FieldInfo(alias = "closestStopTimeOffset", default = None) """ Time offset from the closest stop to the current position of the transit vehicle (in seconds). @@ -105,18 +93,16 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): frequency: Optional[str] = None """Information about frequency-based scheduling, if applicable to the trip.""" - last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( - alias="lastKnownLocation", default=None - ) + last_known_location: Optional[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo(alias = "lastKnownLocation", default = None) """Last known location of the transit vehicle.""" - last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + last_known_orientation: Optional[float] = FieldInfo(alias = "lastKnownOrientation", default = None) """Last known orientation value received in real-time from the transit vehicle.""" - next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + next_stop: Optional[str] = FieldInfo(alias = "nextStop", default = None) """ID of the next stop the transit vehicle is scheduled to arrive at.""" - next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + next_stop_time_offset: Optional[int] = FieldInfo(alias = "nextStopTimeOffset", default = None) """ Time offset from the next stop to the current position of the transit vehicle (in seconds). @@ -128,50 +114,47 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): position: Optional[VehiclesForAgencyListResponseDataListTripStatusPosition] = None """Current position of the transit vehicle.""" - scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias = "scheduledDistanceAlongTrip", default = None) """ Distance, in meters, the transit vehicle is scheduled to have progressed along the active trip. """ - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + situation_ids: Optional[List[str]] = FieldInfo(alias = "situationIds", default = None) """References to situation elements (if any) applicable to this trip.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + vehicle_id: Optional[str] = FieldInfo(alias = "vehicleId", default = None) """ID of the transit vehicle currently serving the trip.""" - class VehiclesForAgencyListResponseDataList(BaseModel): - last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + last_location_update_time: int = FieldInfo(alias = "lastLocationUpdateTime") - last_update_time: int = FieldInfo(alias="lastUpdateTime") + last_update_time: int = FieldInfo(alias = "lastUpdateTime") location: VehiclesForAgencyListResponseDataListLocation - trip_id: str = FieldInfo(alias="tripId") + trip_id: str = FieldInfo(alias = "tripId") - trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias="tripStatus") + trip_status: VehiclesForAgencyListResponseDataListTripStatus = FieldInfo(alias = "tripStatus") - vehicle_id: str = FieldInfo(alias="vehicleId") + vehicle_id: str = FieldInfo(alias = "vehicleId") - occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None) + occupancy_capacity: Optional[int] = FieldInfo(alias = "occupancyCapacity", default = None) - occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None) + occupancy_count: Optional[int] = FieldInfo(alias = "occupancyCount", default = None) - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + occupancy_status: Optional[str] = FieldInfo(alias = "occupancyStatus", default = None) phase: Optional[str] = None status: Optional[str] = None - class VehiclesForAgencyListResponseData(BaseModel): - limit_exceeded: bool = FieldInfo(alias="limitExceeded") + limit_exceeded: bool = FieldInfo(alias = "limitExceeded") list: List[VehiclesForAgencyListResponseDataList] references: References - class VehiclesForAgencyListResponse(ResponseWrapper): - data: VehiclesForAgencyListResponseData + data: VehiclesForAgencyListResponseData \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py index fd8019a..bd67c17 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py index fd8019a..bd67c17 100644 --- a/tests/api_resources/__init__.py +++ b/tests/api_resources/__init__.py @@ -1 +1 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. \ No newline at end of file diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py index fad1087..31c169e 100644 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -13,60 +13,61 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: agencies_with_coverage = client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.list() as response: + with client.agencies_with_coverage.with_streaming_response.list() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncAgenciesWithCoverage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: agencies_with_coverage = await async_client.agencies_with_coverage.list() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.list() as response: + async with async_client.agencies_with_coverage.with_streaming_response.list() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py index 05b83a8..a991b01 100644 --- a/tests/api_resources/test_agency.py +++ b/tests/api_resources/test_agency.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: agency = client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.agency.with_streaming_response.retrieve( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.agency.with_raw_response.retrieve( - "", - ) - - + client.agency.with_raw_response.retrieve( + "", + ) class TestAsyncAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: agency = await async_client.agency.retrieve( "agencyID", ) - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agency.with_raw_response.retrieve( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.agency.with_streaming_response.retrieve( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' agency = await response.parse() - assert_matches_type(AgencyRetrieveResponse, agency, path=["response"]) + assert_matches_type(AgencyRetrieveResponse, agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.agency.with_raw_response.retrieve( - "", - ) + await async_client.agency.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py index 0ba8109..6af856f 100644 --- a/tests/api_resources/test_arrival_and_departure.py +++ b/tests/api_resources/test_arrival_and_departure.py @@ -17,9 +17,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestArrivalAndDeparture: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: @@ -28,7 +28,7 @@ def test_method_retrieve(self, client: OnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -40,10 +40,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -51,9 +52,9 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: @@ -61,30 +62,30 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: arrival_and_departure = client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -94,42 +95,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) - - + client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) class TestAsyncArrivalAndDeparture: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: @@ -138,7 +139,7 @@ async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: service_date=0, trip_id="tripId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -150,10 +151,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw time=0, vehicle_id="vehicleId", ) - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrival_and_departure.with_raw_response.retrieve( stop_id="1_75403", service_date=0, @@ -161,9 +163,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: @@ -171,30 +173,30 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD stop_id="1_75403", service_date=0, trip_id="tripId", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureRetrieveResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.retrieve( - stop_id="", - service_date=0, - trip_id="tripId", - ) + await async_client.arrival_and_departure.with_raw_response.retrieve( + stop_id="", + service_date=0, + trip_id="tripId", + ) @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: arrival_and_departure = await async_client.arrival_and_departure.list( stop_id="1_75403", ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -204,35 +206,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD minutes_before=0, time=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrival_and_departure.with_raw_response.list( stop_id="1_75403", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.arrival_and_departure.with_streaming_response.list( stop_id="1_75403", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' arrival_and_departure = await response.parse() - assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=["response"]) + assert_matches_type(ArrivalAndDepartureListResponse, arrival_and_departure, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.arrival_and_departure.with_raw_response.list( - stop_id="", - ) + await async_client.arrival_and_departure.with_raw_response.list( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py index a07a29b..51df2aa 100644 --- a/tests/api_resources/test_block.py +++ b/tests/api_resources/test_block.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestBlock: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: block = client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.block.with_streaming_response.retrieve( "blockID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - client.block.with_raw_response.retrieve( - "", - ) - - + client.block.with_raw_response.retrieve( + "", + ) class TestAsyncBlock: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: block = await async_client.block.retrieve( "blockID", ) - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.block.with_raw_response.retrieve( "blockID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.block.with_streaming_response.retrieve( "blockID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' block = await response.parse() - assert_matches_type(BlockRetrieveResponse, block, path=["response"]) + assert_matches_type(BlockRetrieveResponse, block, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `block_id` but received ''"): - await async_client.block.with_raw_response.retrieve( - "", - ) + await async_client.block.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py index 62bdd91..c69064e 100644 --- a/tests/api_resources/test_config.py +++ b/tests/api_resources/test_config.py @@ -13,60 +13,61 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestConfig: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: config = client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.config.with_streaming_response.retrieve() as response: + with client.config.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncConfig: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: config = await async_client.config.retrieve() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.config.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.config.with_streaming_response.retrieve() as response: + async with async_client.config.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' config = await response.parse() - assert_matches_type(ConfigRetrieveResponse, config, path=["response"]) + assert_matches_type(ConfigRetrieveResponse, config, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py index 1a05528..ff80f9e 100644 --- a/tests/api_resources/test_current_time.py +++ b/tests/api_resources/test_current_time.py @@ -13,60 +13,61 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestCurrentTime: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: current_time = client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.current_time.with_streaming_response.retrieve() as response: + with client.current_time.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncCurrentTime: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: current_time = await async_client.current_time.retrieve() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.current_time.with_raw_response.retrieve() assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.current_time.with_streaming_response.retrieve() as response: + async with async_client.current_time.with_streaming_response.retrieve() as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' current_time = await response.parse() - assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=["response"]) + assert_matches_type(CurrentTimeRetrieveResponse, current_time, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py index 0b15883..4233004 100644 --- a/tests/api_resources/test_report_problem_with_stop.py +++ b/tests/api_resources/test_report_problem_with_stop.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestReportProblemWithStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_stop = client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +34,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) - - + client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) class TestAsyncReportProblemWithStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,35 +88,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_location_accuracy=0, user_lon=0, ) - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_stop = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.report_problem_with_stop.with_raw_response.retrieve( - stop_id="", - ) + await async_client.report_problem_with_stop.with_raw_response.retrieve( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py index 0bc9cf2..c92d0cf 100644 --- a/tests/api_resources/test_report_problem_with_trip.py +++ b/tests/api_resources/test_report_problem_with_trip.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestReportProblemWithTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: report_problem_with_trip = client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -39,49 +39,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) - - + client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) class TestAsyncReportProblemWithTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: report_problem_with_trip = await async_client.report_problem_with_trip.retrieve( trip_id="tripID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -98,35 +98,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw user_vehicle_number="userVehicleNumber", vehicle_id="vehicleID", ) - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.report_problem_with_trip.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.report_problem_with_trip.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' report_problem_with_trip = await response.parse() - assert_matches_type(ResponseWrapper, report_problem_with_trip, path=["response"]) + assert_matches_type(ResponseWrapper, report_problem_with_trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.report_problem_with_trip.with_raw_response.retrieve( - trip_id="", - ) + await async_client.report_problem_with_trip.with_raw_response.retrieve( + trip_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py index 8b773cf..b046f5b 100644 --- a/tests/api_resources/test_route.py +++ b/tests/api_resources/test_route.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: route = client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.route.with_streaming_response.retrieve( "routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.route.with_raw_response.retrieve( - "", - ) - - + client.route.with_raw_response.retrieve( + "", + ) class TestAsyncRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: route = await async_client.route.retrieve( "routeID", ) - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.route.with_raw_response.retrieve( "routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route.with_streaming_response.retrieve( "routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route = await response.parse() - assert_matches_type(RouteRetrieveResponse, route, path=["response"]) + assert_matches_type(RouteRetrieveResponse, route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.route.with_raw_response.retrieve( - "", - ) + await async_client.route.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py index 867c19a..586c885 100644 --- a/tests/api_resources/test_route_ids_for_agency.py +++ b/tests/api_resources/test_route_ids_for_agency.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRouteIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: route_ids_for_agency = client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.route_ids_for_agency.with_raw_response.list( - "", - ) - - + client.route_ids_for_agency.with_raw_response.list( + "", + ) class TestAsyncRouteIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: route_ids_for_agency = await async_client.route_ids_for_agency.list( "agencyID", ) - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.route_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.route_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' route_ids_for_agency = await response.parse() - assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=["response"]) + assert_matches_type(RouteIDsForAgencyListResponse, route_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.route_ids_for_agency.with_raw_response.list( - "", - ) + await async_client.route_ids_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py index 1fe2d56..3c5e3d1 100644 --- a/tests/api_resources/test_routes_for_agency.py +++ b/tests/api_resources/test_routes_for_agency.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoutesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: routes_for_agency = client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.routes_for_agency.with_raw_response.list( - "", - ) - - + client.routes_for_agency.with_raw_response.list( + "", + ) class TestAsyncRoutesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: routes_for_agency = await async_client.routes_for_agency.list( "agencyID", ) - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_agency = await response.parse() - assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=["response"]) + assert_matches_type(RoutesForAgencyListResponse, routes_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.routes_for_agency.with_raw_response.list( - "", - ) + await async_client.routes_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py index 55fbc31..76683a4 100644 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestRoutesForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +23,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,37 +35,37 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncRoutesForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,7 +73,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,30 +85,31 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py index 6973a7e..2fee578 100644 --- a/tests/api_resources/test_schedule_for_route.py +++ b/tests/api_resources/test_schedule_for_route.py @@ -14,16 +14,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestScheduleForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_route = client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) - - + client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) class TestAsyncScheduleForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_route = await async_client.schedule_for_route.retrieve( route_id="1_100223", ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,35 +81,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw route_id="1_100223", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_route.with_raw_response.retrieve( route_id="1_100223", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_route.with_streaming_response.retrieve( route_id="1_100223", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_route = await response.parse() - assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=["response"]) + assert_matches_type(ScheduleForRouteRetrieveResponse, schedule_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.schedule_for_route.with_raw_response.retrieve( - route_id="", - ) + await async_client.schedule_for_route.with_raw_response.retrieve( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py index 0154e44..beb7aea 100644 --- a/tests/api_resources/test_schedule_for_stop.py +++ b/tests/api_resources/test_schedule_for_stop.py @@ -14,16 +14,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestScheduleForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: schedule_for_stop = client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) - - + client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) class TestAsyncScheduleForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: schedule_for_stop = await async_client.schedule_for_stop.retrieve( stop_id="stopID", ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -81,35 +81,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw stop_id="stopID", date=parse_date("2019-12-27"), ) - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.schedule_for_stop.with_raw_response.retrieve( stop_id="stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.schedule_for_stop.with_streaming_response.retrieve( stop_id="stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' schedule_for_stop = await response.parse() - assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=["response"]) + assert_matches_type(ScheduleForStopRetrieveResponse, schedule_for_stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.schedule_for_stop.with_raw_response.retrieve( - stop_id="", - ) + await async_client.schedule_for_stop.with_raw_response.retrieve( + stop_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py index 76114f6..0726471 100644 --- a/tests/api_resources/test_search_for_route.py +++ b/tests/api_resources/test_search_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestSearchForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_route = client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +30,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_route.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncSearchForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_route = await async_client.search_for_route.list( input="input", ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,28 +73,29 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_route.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_route.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_route = await response.parse() - assert_matches_type(SearchForRouteListResponse, search_for_route, path=["response"]) + assert_matches_type(SearchForRouteListResponse, search_for_route, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py index bed17ea..8ff8b57 100644 --- a/tests/api_resources/test_search_for_stop.py +++ b/tests/api_resources/test_search_for_stop.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestSearchForStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: search_for_stop = client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,42 +30,42 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.search_for_stop.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncSearchForStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: search_for_stop = await async_client.search_for_stop.list( input="input", ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,28 +73,29 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD input="input", max_count=0, ) - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.search_for_stop.with_raw_response.list( input="input", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.search_for_stop.with_streaming_response.list( input="input", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' search_for_stop = await response.parse() - assert_matches_type(SearchForStopListResponse, search_for_stop, path=["response"]) + assert_matches_type(SearchForStopListResponse, search_for_stop, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py index 369da7d..adfbf9f 100644 --- a/tests/api_resources/test_shape.py +++ b/tests/api_resources/test_shape.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestShape: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: shape = client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.shape.with_streaming_response.retrieve( "shapeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - client.shape.with_raw_response.retrieve( - "", - ) - - + client.shape.with_raw_response.retrieve( + "", + ) class TestAsyncShape: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: shape = await async_client.shape.retrieve( "shapeID", ) - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.shape.with_raw_response.retrieve( "shapeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.shape.with_streaming_response.retrieve( "shapeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' shape = await response.parse() - assert_matches_type(ShapeRetrieveResponse, shape, path=["response"]) + assert_matches_type(ShapeRetrieveResponse, shape, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `shape_id` but received ''"): - await async_client.shape.with_raw_response.retrieve( - "", - ) + await async_client.shape.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py index 9286176..dc113e5 100644 --- a/tests/api_resources/test_stop.py +++ b/tests/api_resources/test_stop.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStop: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: stop = client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.stop.with_streaming_response.retrieve( "stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - client.stop.with_raw_response.retrieve( - "", - ) - - + client.stop.with_raw_response.retrieve( + "", + ) class TestAsyncStop: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: stop = await async_client.stop.retrieve( "stopID", ) - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stop.with_raw_response.retrieve( "stopID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop.with_streaming_response.retrieve( "stopID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop = await response.parse() - assert_matches_type(StopRetrieveResponse, stop, path=["response"]) + assert_matches_type(StopRetrieveResponse, stop, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): - await async_client.stop.with_raw_response.retrieve( - "", - ) + await async_client.stop.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py index 923a743..9a060b7 100644 --- a/tests/api_resources/test_stop_ids_for_agency.py +++ b/tests/api_resources/test_stop_ids_for_agency.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopIDsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stop_ids_for_agency = client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stop_ids_for_agency.with_raw_response.list( - "", - ) - - + client.stop_ids_for_agency.with_raw_response.list( + "", + ) class TestAsyncStopIDsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stop_ids_for_agency = await async_client.stop_ids_for_agency.list( "agencyID", ) - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stop_ids_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stop_ids_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stop_ids_for_agency = await response.parse() - assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"]) + assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stop_ids_for_agency.with_raw_response.list( - "", - ) + await async_client.stop_ids_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_agency.py b/tests/api_resources/test_stops_for_agency.py index 7c6538e..ce3acaf 100644 --- a/tests/api_resources/test_stops_for_agency.py +++ b/tests/api_resources/test_stops_for_agency.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_agency = client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.stops_for_agency.with_raw_response.list( - "", - ) - - + client.stops_for_agency.with_raw_response.list( + "", + ) class TestAsyncStopsForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_agency = await async_client.stops_for_agency.list( "agencyID", ) - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_agency.with_raw_response.list( "agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_agency.with_streaming_response.list( "agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_agency = await response.parse() - assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=["response"]) + assert_matches_type(StopsForAgencyListResponse, stops_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.stops_for_agency.with_raw_response.list( - "", - ) + await async_client.stops_for_agency.with_raw_response.list( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py index fcb2f07..91440a5 100644 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -23,7 +23,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -35,37 +35,37 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncStopsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -73,7 +73,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lat=0, lon=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -85,30 +85,31 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD query="query", radius=0, ) - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_location.with_raw_response.list( lat=0, lon=0, ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_location.with_streaming_response.list( lat=0, lon=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_location = await response.parse() - assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py index e062f7d..c2381e7 100644 --- a/tests/api_resources/test_stops_for_route.py +++ b/tests/api_resources/test_stops_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestStopsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: stops_for_route = client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -31,49 +31,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.stops_for_route.with_raw_response.list( - route_id="", - ) - - + client.stops_for_route.with_raw_response.list( + route_id="", + ) class TestAsyncStopsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: stops_for_route = await async_client.stops_for_route.list( route_id="routeID", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -82,35 +82,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_polylines=True, time="time", ) - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.stops_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' stops_for_route = await response.parse() - assert_matches_type(StopsForRouteListResponse, stops_for_route, path=["response"]) + assert_matches_type(StopsForRouteListResponse, stops_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.stops_for_route.with_raw_response.list( - route_id="", - ) + await async_client.stops_for_route.with_raw_response.list( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py index ef2bd7f..c7eeb0e 100644 --- a/tests/api_resources/test_trip.py +++ b/tests/api_resources/test_trip.py @@ -13,86 +13,87 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTrip: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip = client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip.with_streaming_response.retrieve( "tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip.with_raw_response.retrieve( - "", - ) - - + client.trip.with_raw_response.retrieve( + "", + ) class TestAsyncTrip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip = await async_client.trip.retrieve( "tripID", ) - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip.with_raw_response.retrieve( "tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip.with_streaming_response.retrieve( "tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip = await response.parse() - assert_matches_type(TripRetrieveResponse, trip, path=["response"]) + assert_matches_type(TripRetrieveResponse, trip, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip.with_raw_response.retrieve( - "", - ) + await async_client.trip.with_raw_response.retrieve( + "", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py index 82d00d9..41a8789 100644 --- a/tests/api_resources/test_trip_details.py +++ b/tests/api_resources/test_trip_details.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripDetails: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_detail = client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -34,49 +34,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - client.trip_details.with_raw_response.retrieve( - trip_id="", - ) - - + client.trip_details.with_raw_response.retrieve( + trip_id="", + ) class TestAsyncTripDetails: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_detail = await async_client.trip_details.retrieve( trip_id="tripID", ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -88,35 +88,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw service_date=0, time=0, ) - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip_details.with_raw_response.retrieve( trip_id="tripID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_details.with_streaming_response.retrieve( trip_id="tripID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_detail = await response.parse() - assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=["response"]) + assert_matches_type(TripDetailRetrieveResponse, trip_detail, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `trip_id` but received ''"): - await async_client.trip_details.with_raw_response.retrieve( - trip_id="", - ) + await async_client.trip_details.with_raw_response.retrieve( + trip_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py index be96fa6..c574a5b 100644 --- a/tests/api_resources/test_trip_for_vehicle.py +++ b/tests/api_resources/test_trip_for_vehicle.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripForVehicle: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_retrieve(self, client: OnebusawaySDK) -> None: trip_for_vehicle = client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: @@ -33,49 +33,49 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: + response = client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: with client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) - - + client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) class TestAsyncTripForVehicle: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: trip_for_vehicle = await async_client.trip_for_vehicle.retrieve( vehicle_id="vehicleID", ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -86,35 +86,36 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trip_for_vehicle.with_raw_response.retrieve( vehicle_id="vehicleID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trip_for_vehicle.with_streaming_response.retrieve( vehicle_id="vehicleID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trip_for_vehicle = await response.parse() - assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"]) + assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"): - await async_client.trip_for_vehicle.with_raw_response.retrieve( - vehicle_id="", - ) + await async_client.trip_for_vehicle.with_raw_response.retrieve( + vehicle_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py index 050d552..75fc984 100644 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -13,9 +13,9 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripsForLocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: @@ -25,7 +25,7 @@ def test_method_list(self, client: OnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -38,10 +38,11 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -50,9 +51,9 @@ def test_raw_response_list(self, client: OnebusawaySDK) -> None: ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: @@ -61,18 +62,17 @@ def test_streaming_response_list(self, client: OnebusawaySDK) -> None: lat_span=0, lon=0, lon_span=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) assert cast(Any, response.is_closed) is True - - class TestAsyncTripsForLocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -82,7 +82,7 @@ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -95,10 +95,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_trip=True, time=0, ) - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, @@ -107,9 +108,9 @@ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: @@ -118,11 +119,11 @@ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) - lat_span=0, lon=0, lon_span=0, - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_location = await response.parse() - assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=['response']) - assert cast(Any, response.is_closed) is True + assert cast(Any, response.is_closed) is True \ No newline at end of file diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py index 0ef4092..ce2af07 100644 --- a/tests/api_resources/test_trips_for_route.py +++ b/tests/api_resources/test_trips_for_route.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestTripsForRoute: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: trips_for_route = client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -32,49 +32,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - client.trips_for_route.with_raw_response.list( - route_id="", - ) - - + client.trips_for_route.with_raw_response.list( + route_id="", + ) class TestAsyncTripsForRoute: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: trips_for_route = await async_client.trips_for_route.list( route_id="routeID", ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -84,35 +84,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD include_status=True, time=0, ) - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_route.with_raw_response.list( route_id="routeID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.trips_for_route.with_streaming_response.list( route_id="routeID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' trips_for_route = await response.parse() - assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_id` but received ''"): - await async_client.trips_for_route.with_raw_response.list( - route_id="", - ) + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) \ No newline at end of file diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py index 5f201f2..078450d 100644 --- a/tests/api_resources/test_vehicles_for_agency.py +++ b/tests/api_resources/test_vehicles_for_agency.py @@ -13,16 +13,16 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - class TestVehiclesForAgency: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize def test_method_list(self, client: OnebusawaySDK) -> None: vehicles_for_agency = client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: @@ -30,49 +30,49 @@ def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize def test_streaming_response_list(self, client: OnebusawaySDK) -> None: with client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) - - + client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) class TestAsyncVehiclesForAgency: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=['loose', 'strict']) + @parametrize async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: vehicles_for_agency = await async_client.vehicles_for_agency.list( agency_id="agencyID", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: @@ -80,35 +80,36 @@ async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySD agency_id="agencyID", time="time", ) - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.vehicles_for_agency.with_raw_response.list( agency_id="agencyID", ) assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) @parametrize async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: async with async_client.vehicles_for_agency.with_streaming_response.list( agency_id="agencyID", - ) as response: + ) as response : assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + assert response.http_request.headers.get('X-Stainless-Lang') == 'python' vehicles_for_agency = await response.parse() - assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=["response"]) + assert_matches_type(VehiclesForAgencyListResponse, vehicles_for_agency, path=['response']) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"): - await async_client.vehicles_for_agency.with_raw_response.list( - agency_id="", - ) + await async_client.vehicles_for_agency.with_raw_response.list( + agency_id="", + ) \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index d166173..cdab733 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") @@ -30,22 +30,20 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: api_key = "My API Key" - @pytest.fixture(scope="session") def client(request: FixtureRequest) -> Iterator[OnebusawaySDK]: - strict = getattr(request, "param", True) + strict = getattr(request, 'param', True) if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') - with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + with OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : yield client - @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOnebusawaySDK]: - strict = getattr(request, "param", True) + strict = getattr(request, 'param', True) if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + raise TypeError(f'Unexpected fixture parameter type {type(strict)}, expected {bool}') - async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + async with AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client : yield client diff --git a/tests/test_client.py b/tests/test_client.py index 7b650cc..0d603b3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -28,10 +28,10 @@ from onebusaway._constants import RAW_RESPONSE_HEADER from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from onebusaway._base_client import ( - DEFAULT_TIMEOUT, - HTTPX_DEFAULT_TIMEOUT, - BaseClient, - make_request_options, + DEFAULT_TIMEOUT, + HTTPX_DEFAULT_TIMEOUT, + BaseClient, + make_request_options, ) from .utils import update_env @@ -39,17 +39,14 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" - def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]: - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - url = httpx.URL(request.url) - return dict(url.params) - + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + url = httpx.URL(request.url) + return dict(url.params) def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 - def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -57,7 +54,6 @@ def _get_open_connections(client: OnebusawaySDK | AsyncOnebusawaySDK) -> int: pool = transport._pool return len(pool._requests) - class TestOnebusawaySDK: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -72,9 +68,7 @@ def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock( - return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') - ) + respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) response = self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -106,58 +100,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - assert client.default_headers["X-Foo"] == "bar" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + assert client.default_headers['X-Foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers['X-Foo'] == 'bar' # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) - assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + copied = client.copy(default_headers={'X-Bar': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers['X-Bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={'X-Foo': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'stainless' # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get("X-Foo") is None + assert copied.default_headers.get('X-Foo') is None - copied = client.copy(set_default_headers={"X-Bar": "Robert"}) - assert copied.default_headers["X-Bar"] == "Robert" + copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) + assert copied.default_headers['X-Bar'] == 'Robert' with pytest.raises( - ValueError, - match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ValueError, + match='`default_headers` and `set_default_headers` arguments are mutually exclusive', ): - client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) def test_copy_default_query(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} - ) - assert _get_params(client)["foo"] == "bar" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "foo": "bar" + }) + assert _get_params(client)['foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)["foo"] == "bar" + assert _get_params(copied)['foo'] == 'bar' # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={'bar': 'stainless'}) params = _get_params(copied) - assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params['foo'] == 'bar' + assert params['bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={'foo': 'stainless'}) + assert _get_params(copied)['foo'] == 'stainless' # set_default_query @@ -165,21 +159,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={"bar": "Robert"}) - assert _get_params(copied)["bar"] == "Robert" + copied = client.copy(set_default_query={'bar': 'Robert'}) + assert _get_params(copied)['bar'] == 'Robert' with pytest.raises( - ValueError, - # TODO: update - match="`default_query` and `set_default_query` arguments are mutually exclusive", + ValueError, + # TODO: update + match='`default_query` and `set_default_query` arguments are mutually exclusive', ): - client.copy(set_default_query={}, default_query={"foo": "Bar", "key": api_key}) + client.copy(set_default_query={}, default_query={'foo': 'Bar', "key": api_key}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -265,9 +259,7 @@ def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) def test_client_timeout_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -276,70 +268,54 @@ def test_client_timeout_option(self) -> None: def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default async def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match="Invalid `http_client` arg"): - async with httpx.AsyncClient() as http_client: - OnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - http_client=cast(Any, http_client), - ) + with pytest.raises(TypeError, match='Invalid `http_client` arg') : + async with httpx.AsyncClient() as http_client : + OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) def test_default_headers_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" - - client2 = OnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }, - ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'bar' + assert request.headers.get('x-stainless-lang') == 'python' + + client2 = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }) + request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'stainless' + assert request.headers.get('x-stainless-lang') == 'my-overriding-header' def test_default_query_option(self) -> None: - client = OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "query_param": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) url = httpx.URL(request.url) assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -351,7 +327,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -434,7 +410,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2", "key": api_key} + assert params == {'bar': '1', 'foo': '2', "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( @@ -448,7 +424,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {'foo': '2', "key": api_key} def test_multipart_repeating_array(self, client: OnebusawaySDK) -> None: request = client._build_request( @@ -487,29 +463,27 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" - + assert response.foo == 'bar' @pytest.mark.respx(base_url=base_url) def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" - class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" + assert response.foo == 'bar' - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -520,7 +494,6 @@ def test_non_application_json_content_type_for_json_data(self, respx_mock: MockR """ Response that sets Content-Type to something other than application/json but returns json data """ - class Model(BaseModel): foo: int @@ -537,9 +510,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = OnebusawaySDK( - base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True - ) + client = OnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -547,25 +518,11 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): - client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == "http://localhost:5000/from/env/" + with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): + client = OnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == 'http://localhost:5000/from/env/' - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -577,21 +534,7 @@ def test_base_url_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -603,21 +546,7 @@ def test_base_url_no_trailing_slash(self, client: OnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - OnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.Client(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), OnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.Client())], ids = ["standard", "custom http client"]) def test_absolute_request_url(self, client: OnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -643,9 +572,9 @@ def test_copied_client_does_not_close_http(self) -> None: def test_client_context_manager(self) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -662,9 +591,7 @@ class Model(BaseModel): def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - OnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) - ) + OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: @@ -676,7 +603,7 @@ class Model(BaseModel): strict_client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - strict_client.get("/foo", cast_to=Model) + strict_client.get("/foo", cast_to=Model) client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -684,26 +611,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], - [3, "60", 60], - [3, "61", 0.5], - [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [ 3, "20", 20 ], + [ 3, "0", 0.5 ], + [ 3, "-10", 0.5 ], + [ 3, "60", 60 ], + [ 3, "61", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], + [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], + [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], + [ 3, "99999999999999999999999999999999999", 0.5 ], + [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "", 0.5 ], + [ 2, "", 0.5 * 2.0 ], + [ 1, "", 0.5 * 4.0 ], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: client = OnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -711,7 +638,7 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -719,11 +646,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -733,11 +656,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -750,7 +669,7 @@ def test_retries_taken( client: OnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -761,7 +680,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -776,7 +695,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_omit_retry_count_header( - self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + client: OnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -791,15 +713,18 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": Omit()}) + response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_overwrite_retry_count_header( - self, client: OnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + client: OnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -814,11 +739,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) - - assert response.http_request.headers.get("x-stainless-retry-count") == "42" - + response = client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) + assert response.http_request.headers.get('x-stainless-retry-count') == '42' class TestAsyncOnebusawaySDK: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -835,9 +758,7 @@ async def test_raw_response(self, respx_mock: MockRouter) -> None: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: - respx_mock.post("/foo").mock( - return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') - ) + respx_mock.post("/foo").mock(return_value=httpx.Response(200, headers={'Content-Type':'application/binary'}, content='{"foo": "bar"}')) response = await self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 @@ -869,58 +790,58 @@ def test_copy_default_options(self) -> None: assert isinstance(self.client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - assert client.default_headers["X-Foo"] == "bar" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + assert client.default_headers['X-Foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers['X-Foo'] == 'bar' # merges already given headers - copied = client.copy(default_headers={"X-Bar": "stainless"}) - assert copied.default_headers["X-Foo"] == "bar" - assert copied.default_headers["X-Bar"] == "stainless" + copied = client.copy(default_headers={'X-Bar': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'bar' + assert copied.default_headers['X-Bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_headers={"X-Foo": "stainless"}) - assert copied.default_headers["X-Foo"] == "stainless" + copied = client.copy(default_headers={'X-Foo': 'stainless'}) + assert copied.default_headers['X-Foo'] == 'stainless' # set_default_headers # completely overrides already set values copied = client.copy(set_default_headers={}) - assert copied.default_headers.get("X-Foo") is None + assert copied.default_headers.get('X-Foo') is None - copied = client.copy(set_default_headers={"X-Bar": "Robert"}) - assert copied.default_headers["X-Bar"] == "Robert" + copied = client.copy(set_default_headers={'X-Bar': 'Robert'}) + assert copied.default_headers['X-Bar'] == 'Robert' with pytest.raises( - ValueError, - match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ValueError, + match='`default_headers` and `set_default_headers` arguments are mutually exclusive', ): - client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.copy(set_default_headers={}, default_headers={'X-Foo': 'Bar'}) def test_copy_default_query(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} - ) - assert _get_params(client)["foo"] == "bar" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "foo": "bar" + }) + assert _get_params(client)['foo'] == 'bar' # does not override the already given value when not specified copied = client.copy() - assert _get_params(copied)["foo"] == "bar" + assert _get_params(copied)['foo'] == 'bar' # merges already given params - copied = client.copy(default_query={"bar": "stainless"}) + copied = client.copy(default_query={'bar': 'stainless'}) params = _get_params(copied) - assert params["foo"] == "bar" - assert params["bar"] == "stainless" + assert params['foo'] == 'bar' + assert params['bar'] == 'stainless' # uses new values for any already given headers - copied = client.copy(default_query={"foo": "stainless"}) - assert _get_params(copied)["foo"] == "stainless" + copied = client.copy(default_query={'foo': 'stainless'}) + assert _get_params(copied)['foo'] == 'stainless' # set_default_query @@ -928,21 +849,21 @@ def test_copy_default_query(self) -> None: copied = client.copy(set_default_query={}) assert _get_params(copied) == {"key": api_key} - copied = client.copy(set_default_query={"bar": "Robert"}) - assert _get_params(copied)["bar"] == "Robert" + copied = client.copy(set_default_query={'bar': 'Robert'}) + assert _get_params(copied)['bar'] == 'Robert' with pytest.raises( - ValueError, - # TODO: update - match="`default_query` and `set_default_query` arguments are mutually exclusive", + ValueError, + # TODO: update + match='`default_query` and `set_default_query` arguments are mutually exclusive', ): - client.copy(set_default_query={}, default_query={"foo": "Bar"}) + client.copy(set_default_query={}, default_query={'foo': 'Bar'}) def test_copy_signature(self) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( - # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] ) copy_signature = inspect.signature(self.client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} @@ -1027,9 +948,7 @@ async def test_request_timeout(self) -> None: assert timeout == httpx.Timeout(100.0) async def test_client_timeout_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1038,70 +957,54 @@ async def test_client_timeout_option(self) -> None: async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == httpx.Timeout(None) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore - assert timeout == DEFAULT_TIMEOUT # our default + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default def test_invalid_http_client(self) -> None: - with pytest.raises(TypeError, match="Invalid `http_client` arg"): - with httpx.Client() as http_client: - AsyncOnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - http_client=cast(Any, http_client), - ) + with pytest.raises(TypeError, match='Invalid `http_client` arg') : + with httpx.Client() as http_client : + AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=cast(Any, http_client)) def test_default_headers_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "bar" - assert request.headers.get("x-stainless-lang") == "python" - - client2 = AsyncOnebusawaySDK( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - default_headers={ - "X-Foo": "stainless", - "X-Stainless-Lang": "my-overriding-header", - }, - ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) - assert request.headers.get("x-foo") == "stainless" - assert request.headers.get("x-stainless-lang") == "my-overriding-header" + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'bar' + assert request.headers.get('x-stainless-lang') == 'python' + + client2 = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }) + request = client2._build_request(FinalRequestOptions(method="get", url='/foo')) + assert request.headers.get('x-foo') == 'stainless' + assert request.headers.get('x-stainless-lang') == 'my-overriding-header' def test_default_query_option(self) -> None: - client = AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} - ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={ + "query_param": "bar" + }) + request = client._build_request(FinalRequestOptions(method="get", url='/foo')) url = httpx.URL(request.url) # Include the 'key' in the expected params assert dict(url.params) == {"query_param": "bar", "key": api_key} @@ -1114,7 +1017,7 @@ def test_default_query_option(self) -> None: ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overridden", "key": api_key} + assert dict(url.params) == {'foo': 'baz', "query_param": "overridden", "key": api_key} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1197,7 +1100,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"bar": "1", "foo": "2", "key": api_key} + assert params == {'bar': '1', 'foo': '2', "key": api_key} # `extra_query` takes priority over `query` when keys clash request = self.client._build_request( FinalRequestOptions( @@ -1210,7 +1113,7 @@ def test_request_extra_query(self) -> None: ), ) params = dict(request.url.params) - assert params == {"foo": "2", "key": api_key} + assert params == {'foo': '2', "key": api_key} def test_multipart_repeating_array(self, async_client: AsyncOnebusawaySDK) -> None: request = async_client._build_request( @@ -1249,29 +1152,27 @@ class Model1(BaseModel): class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" - + assert response.foo == 'bar' @pytest.mark.respx(base_url=base_url) async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: """Union of objects with the same field name using a different type""" - class Model1(BaseModel): foo: int class Model2(BaseModel): foo: str - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 'bar'})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) - assert response.foo == "bar" + assert response.foo == 'bar' - respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + respx_mock.get('/foo').mock(return_value=httpx.Response(200, json={'foo': 1})) response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) @@ -1282,7 +1183,6 @@ async def test_non_application_json_content_type_for_json_data(self, respx_mock: """ Response that sets Content-Type to something other than application/json but returns json data """ - class Model(BaseModel): foo: int @@ -1299,9 +1199,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = AsyncOnebusawaySDK( - base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True - ) + client = AsyncOnebusawaySDK(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -1309,25 +1207,11 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" def test_base_url_env(self) -> None: - with update_env(ONEBUSAWAY_SDK_BASE_URL="http://localhost:5000/from/env"): - client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) - assert client.base_url == "http://localhost:5000/from/env/" + with update_env(ONEBUSAWAY_SDK_BASE_URL='http://localhost:5000/from/env'): + client = AsyncOnebusawaySDK(api_key=api_key, _strict_response_validation=True) + assert client.base_url == 'http://localhost:5000/from/env/' - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1339,21 +1223,7 @@ def test_base_url_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: excepted_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == excepted_url - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1366,21 +1236,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncOnebusawaySDK) -> None: expected_url = f"http://localhost:5000/custom/path/foo?key={urllib.parse.quote_plus(client.api_key)}" assert request.url == expected_url - @pytest.mark.parametrize( - "client", - [ - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncOnebusawaySDK( - base_url="http://localhost:5000/custom/path/", - api_key=api_key, - _strict_response_validation=True, - http_client=httpx.AsyncClient(), - ), - ], - ids=["standard", "custom http client"], - ) + @pytest.mark.parametrize("client", [AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), AsyncOnebusawaySDK(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, http_client=httpx.AsyncClient())], ids = ["standard", "custom http client"]) def test_absolute_request_url(self, client: AsyncOnebusawaySDK) -> None: request = client._build_request( FinalRequestOptions( @@ -1407,9 +1263,9 @@ async def test_copied_client_does_not_close_http(self) -> None: async def test_client_context_manager(self) -> None: client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: - assert c2 is client - assert not c2.is_closed() - assert not client.is_closed() + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() assert client.is_closed() @pytest.mark.respx(base_url=base_url) @@ -1427,9 +1283,7 @@ class Model(BaseModel): async def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - AsyncOnebusawaySDK( - base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) - ) + AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio @@ -1442,7 +1296,7 @@ class Model(BaseModel): strict_client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): - await strict_client.get("/foo", cast_to=Model) + await strict_client.get("/foo", cast_to=Model) client = AsyncOnebusawaySDK(base_url=base_url, api_key=api_key, _strict_response_validation=False) @@ -1450,26 +1304,26 @@ class Model(BaseModel): assert isinstance(response, str) # type: ignore[unreachable] @pytest.mark.parametrize( - "remaining_retries,retry_after,timeout", - [ - [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], - [3, "60", 60], - [3, "61", 0.5], - [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing - ], - ) + "remaining_retries,retry_after,timeout", + [ + [ 3, "20", 20 ], + [ 3, "0", 0.5 ], + [ 3, "-10", 0.5 ], + [ 3, "60", 60 ], + [ 3, "61", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:57 GMT", 20 ], + [ 3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "Fri, 29 Sep 2023 16:27:37 GMT", 60 ], + [ 3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5 ], + [ 3, "99999999999999999999999999999999999", 0.5 ], + [ 3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5 ], + [ 3, "", 0.5 ], + [ 2, "", 0.5 * 2.0 ], + [ 1, "", 0.5 * 4.0 ], + [-1100, "", 8], # test large number potentially overflowing + ], + ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @pytest.mark.asyncio async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: @@ -1478,7 +1332,7 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1486,11 +1340,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -1500,11 +1350,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) respx_mock.get("/api/where/current-time.json").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.get( - "/api/where/current-time.json", - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await self.client.get("/api/where/current-time.json", cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}) assert _get_open_connections(self.client) == 0 @@ -1518,7 +1364,7 @@ async def test_retries_taken( async_client: AsyncOnebusawaySDK, failures_before_success: int, failure_mode: Literal["status", "exception"], - respx_mock: MockRouter, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1529,7 +1375,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: if nb_retries < failures_before_success: nb_retries += 1 if failure_mode == "exception": - raise RuntimeError("oops") + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -1545,7 +1391,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_omit_retry_count_header( - self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1560,18 +1409,19 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve( - extra_headers={"x-stainless-retry-count": Omit()} - ) + response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': Omit()}) - assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + assert len(response.http_request.headers.get_list('x-stainless-retry-count')) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("onebusaway._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_overwrite_retry_count_header( - self, async_client: AsyncOnebusawaySDK, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOnebusawaySDK, + failures_before_success: int, + respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1586,9 +1436,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.get("/api/where/current-time.json").mock(side_effect=retry_handler) - response = await client.current_time.with_raw_response.retrieve(extra_headers={"x-stainless-retry-count": "42"}) + response = await client.current_time.with_raw_response.retrieve(extra_headers={'x-stainless-retry-count': '42'}) - assert response.http_request.headers.get("x-stainless-retry-count") == "42" + assert response.http_request.headers.get('x-stainless-retry-count') == '42' def test_get_platform(self) -> None: # A previous implementation of asyncify could leave threads unterminated when @@ -1624,13 +1474,17 @@ async def test_main() -> None: return_code = process.poll() if return_code is not None: if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + raise AssertionError( + "calling get_platform using asyncify resulted in a non-zero exit code" + ) # success break if time.monotonic() - start_time > timeout: process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") + raise AssertionError( + "calling get_platform using asyncify resulted in a hung process" + ) time.sleep(0.1) diff --git a/tests/test_models.py b/tests/test_models.py index d3499d2..682ff07 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -520,6 +520,7 @@ class Model(BaseModel): assert m3.to_dict(exclude_none=True) == {} assert m3.to_dict(exclude_defaults=True) == {} + class Model2(BaseModel): created_at: datetime @@ -830,20 +831,20 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(not PYDANTIC_V2, reason='TypeAliasType is not supported in Pydantic v1') def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) class Model(BaseModel): alias: Alias union: Union[int, Alias] - - m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + + m = construct_type(value={'alias': 'foo', 'union': 'bar'}, type_=Model) assert isinstance(m, Model) assert isinstance(m.alias, str) - assert m.alias == "foo" + assert m.alias == 'foo' assert isinstance(m.union, str) - assert m.union == "bar" + assert m.union == 'bar' @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 64498cb..c82ceb3 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -28,7 +28,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_data_missing_event(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_data_missing_event( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b'data: {"foo":true}\n' yield b"\n" @@ -44,7 +46,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_event_missing_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_event_missing_data( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -60,7 +64,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_events( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -82,7 +88,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events_with_data(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_events_with_data( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b'data: {"foo":true}\n' @@ -149,7 +157,9 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_data_lines(sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK) -> None: +async def test_multiple_data_lines( + sync: bool, client: OnebusawaySDK, async_client: AsyncOnebusawaySDK +) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"data: {\n" diff --git a/tests/test_transform.py b/tests/test_transform.py index 352d7ae..ee24d7b 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -191,18 +191,16 @@ async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") tz = "Z" if PYDANTIC_V2 else "+00:00" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] - assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] - assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { - "foo": "2023-02-23" - } # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] @parametrize @@ -392,9 +390,11 @@ def my_iter() -> Iterable[Baz8]: @pytest.mark.asyncio async def test_dictionary_items(use_async: bool) -> None: class DictItems(TypedDict): - foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + foo_baz: Annotated[str, PropertyInfo(alias='fooBaz')] - assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == { + "foo": {"fooBaz": "bar"} + } class TypedDictIterableUnionStr(TypedDict):