onebusaway 1.15.4__py3-none-any.whl → 1.16.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
onebusaway/_types.py CHANGED
@@ -13,10 +13,21 @@ from typing import (
13
13
  Mapping,
14
14
  TypeVar,
15
15
  Callable,
16
+ Iterator,
16
17
  Optional,
17
18
  Sequence,
18
19
  )
19
- from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
20
+ from typing_extensions import (
21
+ Set,
22
+ Literal,
23
+ Protocol,
24
+ TypeAlias,
25
+ TypedDict,
26
+ SupportsIndex,
27
+ overload,
28
+ override,
29
+ runtime_checkable,
30
+ )
20
31
 
21
32
  import httpx
22
33
  import pydantic
@@ -217,3 +228,26 @@ class _GenericAlias(Protocol):
217
228
  class HttpxSendArgs(TypedDict, total=False):
218
229
  auth: httpx.Auth
219
230
  follow_redirects: bool
231
+
232
+
233
+ _T_co = TypeVar("_T_co", covariant=True)
234
+
235
+
236
+ if TYPE_CHECKING:
237
+ # This works because str.__contains__ does not accept object (either in typeshed or at runtime)
238
+ # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
239
+ class SequenceNotStr(Protocol[_T_co]):
240
+ @overload
241
+ def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
242
+ @overload
243
+ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
244
+ def __contains__(self, value: object, /) -> bool: ...
245
+ def __len__(self) -> int: ...
246
+ def __iter__(self) -> Iterator[_T_co]: ...
247
+ def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
248
+ def count(self, value: Any, /) -> int: ...
249
+ def __reversed__(self) -> Iterator[_T_co]: ...
250
+ else:
251
+ # just point this to a normal `Sequence` at runtime to avoid having to special case
252
+ # deserializing our custom sequence type
253
+ SequenceNotStr = Sequence
@@ -38,6 +38,7 @@ from ._typing import (
38
38
  extract_type_arg as extract_type_arg,
39
39
  is_iterable_type as is_iterable_type,
40
40
  is_required_type as is_required_type,
41
+ is_sequence_type as is_sequence_type,
41
42
  is_annotated_type as is_annotated_type,
42
43
  is_type_alias_type as is_type_alias_type,
43
44
  strip_annotated_type as strip_annotated_type,
@@ -16,6 +16,7 @@ from ._utils import (
16
16
  lru_cache,
17
17
  is_mapping,
18
18
  is_iterable,
19
+ is_sequence,
19
20
  )
20
21
  from .._files import is_base64_file_input
21
22
  from ._typing import (
@@ -24,6 +25,7 @@ from ._typing import (
24
25
  extract_type_arg,
25
26
  is_iterable_type,
26
27
  is_required_type,
28
+ is_sequence_type,
27
29
  is_annotated_type,
28
30
  strip_annotated_type,
29
31
  )
@@ -184,6 +186,8 @@ def _transform_recursive(
184
186
  (is_list_type(stripped_type) and is_list(data))
185
187
  # Iterable[T]
186
188
  or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
189
+ # Sequence[T]
190
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
187
191
  ):
188
192
  # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
189
193
  # intended as an iterable, so we don't transform it.
@@ -346,6 +350,8 @@ async def _async_transform_recursive(
346
350
  (is_list_type(stripped_type) and is_list(data))
347
351
  # Iterable[T]
348
352
  or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
353
+ # Sequence[T]
354
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
349
355
  ):
350
356
  # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
351
357
  # intended as an iterable, so we don't transform it.
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
26
26
  return (get_origin(typ) or typ) == list
27
27
 
28
28
 
29
+ def is_sequence_type(typ: type) -> bool:
30
+ origin = get_origin(typ) or typ
31
+ return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
32
+
33
+
29
34
  def is_iterable_type(typ: type) -> bool:
30
35
  """If the given type is `typing.Iterable[T]`"""
31
36
  origin = get_origin(typ) or typ
onebusaway/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "onebusaway"
4
- __version__ = "1.15.4" # x-release-please-version
4
+ __version__ = "1.16.0" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: onebusaway
3
- Version: 1.15.4
3
+ Version: 1.16.0
4
4
  Summary: The official Python library for the onebusaway-sdk API
5
5
  Project-URL: Homepage, https://github.com/OneBusAway/python-sdk
6
6
  Project-URL: Repository, https://github.com/OneBusAway/python-sdk
@@ -10,18 +10,18 @@ onebusaway/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
10
10
  onebusaway/_resource.py,sha256=t-CkWpnm2UyE1uiv87GODlyRcQ_8h5eXmSVoE-1u35w,1142
11
11
  onebusaway/_response.py,sha256=x_FC3ZoD8JnfQRtZibna0wxoBtNzKcVictes8B7N6NQ,28848
12
12
  onebusaway/_streaming.py,sha256=PC8tKxRCeoJn8xKBBxXTlppGSI4TOMYVNfxrabFkRfc,10128
13
- onebusaway/_types.py,sha256=OUYNO_zPft2ZRZXakg0aIsBjCoAJLRet90u8LO8WBB4,6201
14
- onebusaway/_version.py,sha256=H7EMVDnMDyiI2ptyyYVrzOmn3WHOaqwtr19JhVerwW0,163
13
+ onebusaway/_types.py,sha256=uOBvSyMmZxhz550R58Pj4K5NhkwvEojBBuGzz962sKE,7300
14
+ onebusaway/_version.py,sha256=nMz6CP1vVdCfW7-bwWxvHJcSmSWaijKMpqvjXgDEXfY,163
15
15
  onebusaway/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- onebusaway/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
16
+ onebusaway/_utils/__init__.py,sha256=QMTNChOzCs5KF_NTxyb5XpFyyfmHiQASrFovz3dHmK8,2104
17
17
  onebusaway/_utils/_logs.py,sha256=tVIAhl7_vbQL4nJ8QdLAHJ0YzQYbW2gTATmjneY_JxI,790
18
18
  onebusaway/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
19
19
  onebusaway/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
20
20
  onebusaway/_utils/_resources_proxy.py,sha256=sHxSgZ5yyoWhnf-IrEYgRKCJcxzQKHrcR5UNy2iZIa4,609
21
21
  onebusaway/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
22
22
  onebusaway/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
23
- onebusaway/_utils/_transform.py,sha256=n7kskEWz6o__aoNvhFoGVyDoalNe6mJwp-g7BWkdj88,15617
24
- onebusaway/_utils/_typing.py,sha256=D0DbbNu8GnYQTSICnTSHDGsYXj8TcAKyhejb0XcnjtY,4602
23
+ onebusaway/_utils/_transform.py,sha256=Owrq-VLQMnGwPwOYHRLnnRTZTaGn1DJYSD2YROB23CU,15894
24
+ onebusaway/_utils/_typing.py,sha256=UAoN7JEd8A-T32Cju-dL5EyqWKO_ktG4VDQ3KOhzqG0,4787
25
25
  onebusaway/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
26
26
  onebusaway/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
27
27
  onebusaway/resources/__init__.py,sha256=atY4sLhX4z95BUHL6ErtMzhTYClyGZeHvfYjUM7WyBI,15294
@@ -104,7 +104,7 @@ onebusaway/types/vehicles_for_agency_list_response.py,sha256=IUX2zHummRU2ChQsGYt
104
104
  onebusaway/types/shared/__init__.py,sha256=ui9M5r_ahasuyksUJVAHHYtdXvg3L_uxVgJY6LMdiPY,201
105
105
  onebusaway/types/shared/references.py,sha256=By29adWfDkZwH6_80NFuvP5NPKOcz9JUqUzaq-iAjQw,7317
106
106
  onebusaway/types/shared/response_wrapper.py,sha256=0i161M7PC8iPq2RzNt8DxZFlvSvdgD9xBcs0ugER0rY,331
107
- onebusaway-1.15.4.dist-info/METADATA,sha256=n7yXFv-K3LEcp4y_DU91jIAiNRzuBgOhAde1tZoRxac,13687
108
- onebusaway-1.15.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
109
- onebusaway-1.15.4.dist-info/licenses/LICENSE,sha256=czZkEz_7Kzvn7AGsFsY_RUYL132SXtB5Mcrjoq29Vfo,11344
110
- onebusaway-1.15.4.dist-info/RECORD,,
107
+ onebusaway-1.16.0.dist-info/METADATA,sha256=DqcFK6czlYdfNRZjlEvbi_vE4OzvB8pZtqdprCfGhAk,13687
108
+ onebusaway-1.16.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
109
+ onebusaway-1.16.0.dist-info/licenses/LICENSE,sha256=czZkEz_7Kzvn7AGsFsY_RUYL132SXtB5Mcrjoq29Vfo,11344
110
+ onebusaway-1.16.0.dist-info/RECORD,,