otterapi 0.1.2__tar.gz → 0.1.3__tar.gz

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.
Files changed (87) hide show
  1. {otterapi-0.1.2 → otterapi-0.1.3}/PKG-INFO +1 -1
  2. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/ast_utils.py +8 -0
  3. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/client.py +3 -3
  4. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/codegen.py +0 -10
  5. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/endpoints.py +5 -2
  6. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/export.py +2 -2
  7. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_export.py +5 -4
  8. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_pagination.py +48 -49
  9. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/types.py +2 -4
  10. {otterapi-0.1.2 → otterapi-0.1.3}/.gitignore +0 -0
  11. {otterapi-0.1.2 → otterapi-0.1.3}/README.md +0 -0
  12. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/__init__.py +0 -0
  13. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/__main__.py +0 -0
  14. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/cli.py +0 -0
  15. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/__init__.py +0 -0
  16. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/_body_builder.py +0 -0
  17. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/_features.py +0 -0
  18. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/_openapi_adapter.py +0 -0
  19. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/dataframes.py +0 -0
  20. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/pagination.py +0 -0
  21. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/__init__.py +0 -0
  22. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_client_stub.py.tpl +0 -0
  23. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_concurrency.py +0 -0
  24. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_dataframe.py +0 -0
  25. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_models_mixin.py +0 -0
  26. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/runtime/_retry.py +0 -0
  27. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/schema.py +0 -0
  28. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/splitting.py +0 -0
  29. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/codegen/utils.py +0 -0
  30. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/config.py +0 -0
  31. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/exceptions.py +0 -0
  32. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/__init__.py +0 -0
  33. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/constants.py +0 -0
  34. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v2/__init__.py +0 -0
  35. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v2/spec.json +0 -0
  36. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v2/v2.py +0 -0
  37. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3/__init__.py +0 -0
  38. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3/spec.json +0 -0
  39. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3/v3.py +0 -0
  40. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_1/__init__.py +0 -0
  41. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_1/spec.json +0 -0
  42. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_1/v3_1.py +0 -0
  43. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_2/__init__.py +0 -0
  44. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_2/spec.json +0 -0
  45. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/v3_2/v3_2.py +0 -0
  46. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/openapi/warnings.py +0 -0
  47. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/__init__.py +0 -0
  48. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/__init__.py +0 -0
  49. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/constraints/spec.yaml +0 -0
  50. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/dataframe/config.yaml +0 -0
  51. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/dataframe/spec.yaml +0 -0
  52. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/discriminator/spec.yaml +0 -0
  53. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/paginated/config.yaml +0 -0
  54. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/fixtures/golden/paginated/spec.yaml +0 -0
  55. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_ast_utils.py +0 -0
  56. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_body_builder.py +0 -0
  57. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_client_retry_lifecycle.py +0 -0
  58. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_codegen.py +0 -0
  59. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_codegen_structure.py +0 -0
  60. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_concurrency_runtime.py +0 -0
  61. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_config_errors.py +0 -0
  62. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_dataframe.py +0 -0
  63. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_discriminated_unions.py +0 -0
  64. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_exceptions.py +0 -0
  65. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_export.py +0 -0
  66. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_extra_forbid.py +0 -0
  67. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_feature_modules.py +0 -0
  68. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_html_repr.py +0 -0
  69. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_init_scaffold.py +0 -0
  70. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_not_schema.py +0 -0
  71. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_nullable_upgrade.py +0 -0
  72. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_openapi_adapter.py +0 -0
  73. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_openapi_support.py +0 -0
  74. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_openapi_upgrade.py +0 -0
  75. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_pagination.py +0 -0
  76. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_per_status_errors.py +0 -0
  77. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_public_api.py +0 -0
  78. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_regen_script.py +0 -0
  79. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_retry_runtime.py +0 -0
  80. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_runtime_guards.py +0 -0
  81. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_schema_constraints.py +0 -0
  82. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_smoke_generated_client.py +0 -0
  83. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_splitting_config.py +0 -0
  84. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_splitting_integration.py +0 -0
  85. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_splitting_resolver.py +0 -0
  86. {otterapi-0.1.2 → otterapi-0.1.3}/otterapi/tests/test_splitting_tree.py +0 -0
  87. {otterapi-0.1.2 → otterapi-0.1.3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otterapi
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A cute little companion that generates type-safe clients from OpenAPI documents.
5
5
  Project-URL: Source, https://github.com/danplischke/otter
6
6
  Author: Dan Plischke
@@ -16,6 +16,7 @@ __all__ = [
16
16
  '_union_expr',
17
17
  '_optional_expr',
18
18
  '_argument',
19
+ '_ann_assign',
19
20
  '_assign',
20
21
  '_import',
21
22
  '_call',
@@ -76,6 +77,13 @@ def _argument(name: str, value: ast.expr | None = None) -> ast.arg:
76
77
  )
77
78
 
78
79
 
80
+ def _ann_assign(target: ast.expr, annotation: ast.expr, value: ast.expr) -> ast.AnnAssign:
81
+ """Build ``target: annotation = value``."""
82
+ if isinstance(target, ast.Name):
83
+ target = ast.Name(id=target.id, ctx=ast.Store())
84
+ return ast.AnnAssign(target=target, annotation=annotation, value=value, simple=1)
85
+
86
+
79
87
  def _assign(target: ast.expr, value: ast.expr) -> ast.Assign:
80
88
  # Ensure target has Store context
81
89
  if isinstance(target, ast.Name):
@@ -668,7 +668,7 @@ def generate_base_client_class(
668
668
  """
669
669
  imports: ImportDict = {
670
670
  'httpx': {'Client', 'AsyncClient', 'Response', 'TransportError'},
671
- 'typing': {'Any', 'TypeVar'},
671
+ 'typing': {'Any'},
672
672
  'types': {'UnionType'},
673
673
  'pydantic': {'TypeAdapter', 'RootModel'},
674
674
  '._retry': {'_backoff_sleep', '_backoff_sleep_async'},
@@ -1126,7 +1126,7 @@ def _build_parse_response_method(
1126
1126
  args=args,
1127
1127
  body=body,
1128
1128
  decorator_list=[],
1129
- returns=_name('T'),
1129
+ returns=_name('Any'),
1130
1130
  )
1131
1131
  else:
1132
1132
  return ast.FunctionDef(
@@ -1134,7 +1134,7 @@ def _build_parse_response_method(
1134
1134
  args=args,
1135
1135
  body=body,
1136
1136
  decorator_list=[],
1137
- returns=_name('T'),
1137
+ returns=_name('Any'),
1138
1138
  )
1139
1139
 
1140
1140
 
@@ -1666,16 +1666,6 @@ class Codegen(OpenAPIProcessor):
1666
1666
  for import_stmt in import_collector.to_ast():
1667
1667
  body.insert(0, import_stmt)
1668
1668
 
1669
- # Add TypeVar definition: T = TypeVar('T')
1670
- typevar_def = _assign(
1671
- _name('T'),
1672
- _call(
1673
- func=_name('TypeVar'),
1674
- args=[ast.Constant(value='T')],
1675
- ),
1676
- )
1677
- body.append(typevar_def)
1678
-
1679
1669
  # Add __all__ export (include the full per-status error hierarchy
1680
1670
  # so users can ``from .<pkg>._client import NotFoundError`` etc.).
1681
1671
  body.append(_all(sorted([base_client_name, *_exported_error_names()])))
@@ -227,7 +227,9 @@ class FunctionSignatureBuilder:
227
227
  if param.required:
228
228
  self._args.append(arg)
229
229
  else:
230
- self._kwonlyargs.append(arg)
230
+ # Wrap annotation in `| None` so the `= None` default is type-safe.
231
+ optional_annotation = _union_expr([annotation, ast.Constant(value=None)])
232
+ self._kwonlyargs.append(_argument(param.name_sanitized, optional_annotation))
231
233
  self._kw_defaults.append(ast.Constant(value=None))
232
234
 
233
235
  return self
@@ -262,7 +264,8 @@ class FunctionSignatureBuilder:
262
264
  if body.required:
263
265
  self._args.append(body_arg)
264
266
  else:
265
- self._kwonlyargs.append(body_arg)
267
+ optional_body_annotation = _union_expr([body_annotation, ast.Constant(value=None)])
268
+ self._kwonlyargs.append(_argument('body', optional_body_annotation))
266
269
  self._kw_defaults.append(ast.Constant(value=None))
267
270
 
268
271
  return self
@@ -188,8 +188,8 @@ def _format_literal_annotation() -> ast.expr:
188
188
 
189
189
 
190
190
  def _output_path_annotation() -> ast.expr:
191
- """Build the AST for ``str | Path`` (the wrapper's path argument type)."""
192
- return _union_expr([_name('str'), _name('Path')])
191
+ """Build the AST for ``str | Path | None`` (the wrapper's path argument type)."""
192
+ return _union_expr([_name('str'), _name('Path'), ast.Constant(value=None)])
193
193
 
194
194
 
195
195
  def _add_export_kwonly_args(
@@ -23,7 +23,7 @@ from datetime import date, datetime, time
23
23
  from decimal import Decimal
24
24
  from enum import Enum
25
25
  from pathlib import Path
26
- from typing import TYPE_CHECKING, Annotated, Any, Union, get_args, get_origin
26
+ from typing import TYPE_CHECKING, Annotated, Any, TypeAlias, Union, get_args, get_origin
27
27
  from uuid import UUID
28
28
 
29
29
  from pydantic import BaseModel
@@ -32,8 +32,8 @@ from upath import UPath
32
32
  if TYPE_CHECKING:
33
33
  import pyarrow as pa
34
34
 
35
- Row = BaseModel | dict
36
- PathLike = str | Path | UPath
35
+ Row: TypeAlias = BaseModel | dict
36
+ PathLike: TypeAlias = str | Path | UPath
37
37
 
38
38
 
39
39
  # -----------------------------------------------------------------------------
@@ -378,6 +378,7 @@ def _python_type_to_arrow(annotation: Any, pa) -> pa.DataType:
378
378
  origin = get_origin(inner)
379
379
 
380
380
  if isinstance(inner, type) and issubclass(inner, BaseModel):
381
+ model_cls: type[BaseModel] = inner
381
382
  return pa.struct(
382
383
  [
383
384
  pa.field(
@@ -385,7 +386,7 @@ def _python_type_to_arrow(annotation: Any, pa) -> pa.DataType:
385
386
  _python_type_to_arrow(field.annotation, pa),
386
387
  nullable=_is_nullable(field.annotation),
387
388
  )
388
- for name, field in inner.model_fields.items()
389
+ for name, field in model_cls.model_fields.items()
389
390
  ]
390
391
  )
391
392
 
@@ -6,7 +6,6 @@ from dataclasses import dataclass
6
6
  from typing import Any, TypeVar
7
7
 
8
8
  T = TypeVar('T')
9
- PageT = TypeVar('PageT')
10
9
 
11
10
 
12
11
  @dataclass
@@ -118,14 +117,14 @@ def _progress_context(
118
117
 
119
118
 
120
119
  def paginate_offset(
121
- fetch_page: Callable[[int, int], PageT],
122
- extract_items: Callable[[PageT], list[T]],
123
- get_total: Callable[[PageT], int | None] | None = None,
120
+ fetch_page: Callable[[int, int], Any],
121
+ extract_items: Callable[[Any], list[T]],
122
+ get_total: Callable[[Any], int | None] | None = None,
124
123
  *,
125
124
  start_offset: int = 0,
126
125
  page_size: int = 100,
127
126
  max_items: int | None = None,
128
- progress: bool | str = False,
127
+ progress: bool | str = True,
129
128
  ) -> list[T]:
130
129
  """Generic offset-based pagination that returns all items.
131
130
 
@@ -182,14 +181,14 @@ def paginate_offset(
182
181
 
183
182
 
184
183
  async def paginate_offset_async(
185
- fetch_page: Callable[[int, int], Any], # Returns Awaitable[PageT]
186
- extract_items: Callable[[PageT], list[T]],
187
- get_total: Callable[[PageT], int | None] | None = None,
184
+ fetch_page: Callable[[int, int], Any], # Returns Awaitable[Any]
185
+ extract_items: Callable[[Any], list[T]],
186
+ get_total: Callable[[Any], int | None] | None = None,
188
187
  *,
189
188
  start_offset: int = 0,
190
189
  page_size: int = 100,
191
190
  max_items: int | None = None,
192
- progress: bool | str = False,
191
+ progress: bool | str = True,
193
192
  ) -> list[T]:
194
193
  """Async version of paginate_offset."""
195
194
  all_items: list[T] = []
@@ -244,14 +243,14 @@ async def paginate_offset_async(
244
243
 
245
244
 
246
245
  def iterate_offset(
247
- fetch_page: Callable[[int, int], PageT],
248
- extract_items: Callable[[PageT], list[T]],
249
- get_total: Callable[[PageT], int | None] | None = None,
246
+ fetch_page: Callable[[int, int], Any],
247
+ extract_items: Callable[[Any], list[T]],
248
+ get_total: Callable[[Any], int | None] | None = None,
250
249
  *,
251
250
  start_offset: int = 0,
252
251
  page_size: int = 100,
253
252
  max_items: int | None = None,
254
- progress: bool | str = False,
253
+ progress: bool | str = True,
255
254
  ) -> Iterator[T]:
256
255
  """Generic offset-based pagination iterator (streaming).
257
256
 
@@ -309,14 +308,14 @@ def iterate_offset(
309
308
 
310
309
 
311
310
  async def iterate_offset_async(
312
- fetch_page: Callable[[int, int], Any], # Returns Awaitable[PageT]
313
- extract_items: Callable[[PageT], list[T]],
314
- get_total: Callable[[PageT], int | None] | None = None,
311
+ fetch_page: Callable[[int, int], Any], # Returns Awaitable[Any]
312
+ extract_items: Callable[[Any], list[T]],
313
+ get_total: Callable[[Any], int | None] | None = None,
315
314
  *,
316
315
  start_offset: int = 0,
317
316
  page_size: int = 100,
318
317
  max_items: int | None = None,
319
- progress: bool | str = False,
318
+ progress: bool | str = True,
320
319
  ) -> AsyncIterator[T]:
321
320
  """Async version of iterate_offset."""
322
321
  current_offset = start_offset
@@ -376,14 +375,14 @@ async def iterate_offset_async(
376
375
 
377
376
 
378
377
  def paginate_cursor(
379
- fetch_page: Callable[[str | None, int], PageT],
380
- extract_items: Callable[[PageT], list[T]],
381
- get_next_cursor: Callable[[PageT], str | None],
378
+ fetch_page: Callable[[str | None, int], Any],
379
+ extract_items: Callable[[Any], list[T]],
380
+ get_next_cursor: Callable[[Any], str | None],
382
381
  *,
383
382
  start_cursor: str | None = None,
384
383
  page_size: int = 100,
385
384
  max_items: int | None = None,
386
- progress: bool | str = False,
385
+ progress: bool | str = True,
387
386
  ) -> list[T]:
388
387
  """Generic cursor-based pagination that returns all items.
389
388
 
@@ -431,14 +430,14 @@ def paginate_cursor(
431
430
 
432
431
 
433
432
  async def paginate_cursor_async(
434
- fetch_page: Callable[[str | None, int], Any], # Returns Awaitable[PageT]
435
- extract_items: Callable[[PageT], list[T]],
436
- get_next_cursor: Callable[[PageT], str | None],
433
+ fetch_page: Callable[[str | None, int], Any], # Returns Awaitable[Any]
434
+ extract_items: Callable[[Any], list[T]],
435
+ get_next_cursor: Callable[[Any], str | None],
437
436
  *,
438
437
  start_cursor: str | None = None,
439
438
  page_size: int = 100,
440
439
  max_items: int | None = None,
441
- progress: bool | str = False,
440
+ progress: bool | str = True,
442
441
  ) -> list[T]:
443
442
  """Async version of paginate_cursor."""
444
443
  all_items: list[T] = []
@@ -485,14 +484,14 @@ async def paginate_cursor_async(
485
484
 
486
485
 
487
486
  def iterate_cursor(
488
- fetch_page: Callable[[str | None, int], PageT],
489
- extract_items: Callable[[PageT], list[T]],
490
- get_next_cursor: Callable[[PageT], str | None],
487
+ fetch_page: Callable[[str | None, int], Any],
488
+ extract_items: Callable[[Any], list[T]],
489
+ get_next_cursor: Callable[[Any], str | None],
491
490
  *,
492
491
  start_cursor: str | None = None,
493
492
  page_size: int = 100,
494
493
  max_items: int | None = None,
495
- progress: bool | str = False,
494
+ progress: bool | str = True,
496
495
  ) -> Iterator[T]:
497
496
  """Generic cursor-based pagination iterator (streaming).
498
497
 
@@ -537,14 +536,14 @@ def iterate_cursor(
537
536
 
538
537
 
539
538
  async def iterate_cursor_async(
540
- fetch_page: Callable[[str | None, int], Any], # Returns Awaitable[PageT]
541
- extract_items: Callable[[PageT], list[T]],
542
- get_next_cursor: Callable[[PageT], str | None],
539
+ fetch_page: Callable[[str | None, int], Any], # Returns Awaitable[Any]
540
+ extract_items: Callable[[Any], list[T]],
541
+ get_next_cursor: Callable[[Any], str | None],
543
542
  *,
544
543
  start_cursor: str | None = None,
545
544
  page_size: int = 100,
546
545
  max_items: int | None = None,
547
- progress: bool | str = False,
546
+ progress: bool | str = True,
548
547
  ) -> AsyncIterator[T]:
549
548
  """Async version of iterate_cursor."""
550
549
  current_cursor = start_cursor
@@ -593,15 +592,15 @@ async def iterate_cursor_async(
593
592
 
594
593
 
595
594
  def iterate_page(
596
- fetch_page: Callable[[int, int], PageT],
597
- extract_items: Callable[[PageT], list[T]],
598
- get_total_pages: Callable[[PageT], int | None] | None = None,
595
+ fetch_page: Callable[[int, int], Any],
596
+ extract_items: Callable[[Any], list[T]],
597
+ get_total_pages: Callable[[Any], int | None] | None = None,
599
598
  *,
600
599
  start_page: int = 1,
601
600
  page_size: int = 100,
602
601
  max_items: int | None = None,
603
602
  max_pages: int | None = None,
604
- progress: bool | str = False,
603
+ progress: bool | str = True,
605
604
  ) -> Iterator[T]:
606
605
  """Generic page-based pagination iterator (streaming).
607
606
 
@@ -660,15 +659,15 @@ def iterate_page(
660
659
 
661
660
 
662
661
  async def iterate_page_async(
663
- fetch_page: Callable[[int, int], Any], # Returns Awaitable[PageT]
664
- extract_items: Callable[[PageT], list[T]],
665
- get_total_pages: Callable[[PageT], int | None] | None = None,
662
+ fetch_page: Callable[[int, int], Any], # Returns Awaitable[Any]
663
+ extract_items: Callable[[Any], list[T]],
664
+ get_total_pages: Callable[[Any], int | None] | None = None,
666
665
  *,
667
666
  start_page: int = 1,
668
667
  page_size: int = 100,
669
668
  max_items: int | None = None,
670
669
  max_pages: int | None = None,
671
- progress: bool | str = False,
670
+ progress: bool | str = True,
672
671
  ) -> AsyncIterator[T]:
673
672
  """Async version of iterate_page."""
674
673
  current_page = start_page
@@ -723,15 +722,15 @@ async def iterate_page_async(
723
722
 
724
723
 
725
724
  def paginate_page(
726
- fetch_page: Callable[[int, int], PageT],
727
- extract_items: Callable[[PageT], list[T]],
728
- get_total_pages: Callable[[PageT], int | None] | None = None,
725
+ fetch_page: Callable[[int, int], Any],
726
+ extract_items: Callable[[Any], list[T]],
727
+ get_total_pages: Callable[[Any], int | None] | None = None,
729
728
  *,
730
729
  start_page: int = 1,
731
730
  page_size: int = 100,
732
731
  max_items: int | None = None,
733
732
  max_pages: int | None = None,
734
- progress: bool | str = False,
733
+ progress: bool | str = True,
735
734
  ) -> list[T]:
736
735
  """Generic page-based pagination that returns all items.
737
736
 
@@ -788,15 +787,15 @@ def paginate_page(
788
787
 
789
788
 
790
789
  async def paginate_page_async(
791
- fetch_page: Callable[[int, int], Any], # Returns Awaitable[PageT]
792
- extract_items: Callable[[PageT], list[T]],
793
- get_total_pages: Callable[[PageT], int | None] | None = None,
790
+ fetch_page: Callable[[int, int], Any], # Returns Awaitable[Any]
791
+ extract_items: Callable[[Any], list[T]],
792
+ get_total_pages: Callable[[Any], int | None] | None = None,
794
793
  *,
795
794
  start_page: int = 1,
796
795
  page_size: int = 100,
797
796
  max_items: int | None = None,
798
797
  max_pages: int | None = None,
799
- progress: bool | str = False,
798
+ progress: bool | str = True,
800
799
  ) -> list[T]:
801
800
  """Async version of paginate_page."""
802
801
  all_items: list[T] = []
@@ -983,10 +983,8 @@ class TypeGenerator(OpenAPIProcessor):
983
983
 
984
984
  self._attach_model_dependencies(type_, base_bases, field_types)
985
985
 
986
- type_.add_implementation_import(
987
- module=BaseModel.__module__, name=BaseModel.__name__
988
- )
989
- type_.add_implementation_import(module=Field.__module__, name=Field.__name__)
986
+ type_.add_implementation_import(module='pydantic', name=BaseModel.__name__)
987
+ type_.add_implementation_import(module='pydantic', name=Field.__name__)
990
988
  type_.copy_imports_from_sub_types(field_types)
991
989
 
992
990
  type_ = self.add_type(type_, base_name=base_name)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes