diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0a1cf6055..c89043181 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,13 +11,13 @@ jobs: test: strategy: matrix: - python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] + python: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Set up Python - uses: actions/setup-python@v5.3.0 + uses: actions/setup-python@v6.0.0 with: python-version: ${{ matrix.python }} @@ -60,7 +60,7 @@ jobs: if: matrix.os == 'ubuntu-latest' - name: Store coverage report - uses: actions/upload-artifact@v4.5.0 + uses: actions/upload-artifact@v5.0.0 if: matrix.os == 'ubuntu-latest' with: name: coverage-${{ matrix.python }} @@ -74,11 +74,11 @@ jobs: os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Set up Python - uses: actions/setup-python@v5.3.0 + uses: actions/setup-python@v6.0.0 with: - python-version: "3.9" + python-version: "3.10" - name: Get Python Version id: get_python_version @@ -101,9 +101,6 @@ jobs: - name: Run mypy run: pdm mypy --show-error-codes - - name: Lint - run: pdm run ruff check . - - name: Run unit tests only # snapshots are expected to fail run: pdm unit_test @@ -112,12 +109,12 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.2.2 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v5.0.0 + - uses: actions/setup-python@v6 with: python-version: "3.12" - name: Download coverage reports - uses: actions/download-artifact@v4.1.8 + uses: actions/download-artifact@v6.0.0 with: merge-multiple: true @@ -131,18 +128,18 @@ jobs: # Find all of the downloaded coverage reports and combine them .venv/bin/python -m coverage combine - + # Create html report .venv/bin/python -m coverage html --skip-covered --skip-empty - + # Report in Markdown and write to summary. .venv/bin/python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY - + # Report again and fail if under 100%. - .venv/bin/python -m coverage report --fail-under=100 + .venv/bin/python -m coverage report --fail-under=100 - name: Upload HTML report if check failed. - uses: actions/upload-artifact@v4.5.0 + uses: actions/upload-artifact@v5.0.0 with: name: html-report path: htmlcov @@ -153,51 +150,35 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - httpx_version: - - "0.20.0" - - "" + lockfile: + - "pdm.lock" + - "pdm.minimal.lock" services: openapi-test-server: - image: ghcr.io/openapi-generators/openapi-test-server:0.0.1 + image: ghcr.io/openapi-generators/openapi-test-server:0.2.1 ports: - "3000:3000" steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Set up Python - uses: actions/setup-python@v5.3.0 + uses: actions/setup-python@v6.0.0 with: - python-version: "3.9" + python-version: "3.10" - name: Get Python Version id: get_python_version run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: .venv - key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }} - restore-keys: | - ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies - - name: Install dependencies - run: | - pip install pdm - python -m venv .venv - pdm install - name: Cache Generated Client Dependencies uses: actions/cache@v4 with: path: integration-tests/.venv - key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/pdm.lock') }} + key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('integration-tests/pdm*.lock') }} restore-keys: | ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies - - name: Set httpx version - if: matrix.httpx_version != '' - run: | - cd integration-tests - pdm add httpx==${{ matrix.httpx_version }} - name: Install Integration Dependencies run: | cd integration-tests - pdm install + pip install pdm + pdm install -L ${{ matrix.lockfile }} - name: Run Tests run: | cd integration-tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78c3e09da..b948d2ae2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,12 +12,12 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Install Hatchling run: pip install --upgrade hatchling - name: Build run: hatchling build - name: Push to PyPI - uses: pypa/gh-action-pypi-publish@v1.12.3 + uses: pypa/gh-action-pypi-publish@v1.13.0 with: attestations: true diff --git a/.gitignore b/.gitignore index b04b9f514..1cd5f6801 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ htmlcov/ # Generated end to end test data my-test-api-client/ custom-e2e/ -3-1-features-client \ No newline at end of file +3-1-features-client +tests/tmp \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6569f30fb..089e5bd98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,249 @@ Programmatic usage of this project (e.g., importing it as a Python module) and t The 0.x prefix used in versions for this project is to indicate that breaking changes are expected frequently (several times a year). Breaking changes will increment the minor number, all other changes will increment the patch number. You can track the progress toward 1.0 [here](https://github.com/openapi-generators/openapi-python-client/projects/2). +## 0.27.1 (2025-11-03) + +### Fixes + +- Remove non-existent CHANGELOG.md references from UV and Poetry templates (#1344) +- Initialize optional lists as UNSET, not [] (#1346) +- Correct docstring typos in client template (#1347) +- Replace bare except blocks with specific exception types (#1348) + +#### Update `uv_build` to 0.9 + +##1352 by @johnthagen + +`uv` has been in the `0.9.x` release cycle for a while, so update templates to use the corresponding `uv_build` range. + +## 0.27.0 (2025-10-28) + +### Breaking Changes + +#### Drop support for Python 3.9 + +Both `openapi-python-client` itself and any generated clients no longer support Python 3.9. + +#### Generated models now use `from __future__ import annotations` + +This simplifies using forward references with the newer union syntax. + +### Features + +#### Upgrade generated clients to 3.10 union syntax + +All generated types now use the `A | B` syntax instead of `Union[A, B]` or `Optional[A]`. + +### Fixes + +- Drop generated `requires-python` upper bounds for uv and PDM (#1329) + +#### Change default Ruff hook to `--fix-only` + +This should enable `openapi-python-client` to keep auto-fixing lints (like removing unused imports) but _not_ fail to +generate when unfixable lints are violated. + +Since it's now unlikely for breaking changes to affect our usage (and by popular request), the upper bound of `ruff` +has been lifted. Newer versions of `openapi-python-client` should no longer be required to support newer versions of `ruff`. + +### Notes + +- Minimum Typer version is now 0.16 + +## 0.26.2 (2025-10-06) + +### Fixes + +- ambigious tilde specifier requires-python with`--meta=uv` (#1321) + +## 0.26.1 (2025-09-13) + +### Features + +- Reference schema support (#800) (#1307) +- Support Ruff 0.13 + +## 0.26.0 (2025-08-26) + +### Breaking Changes + +#### Change some union variant names + +When creating a union with `oneOf`, `anyOf`, or a list of `type`, the name of each variant used to be `type_{index}` +where the index is based on the order of the types in the union. + +This made some modules difficult to understand, what is a `my_type_type_0` after all? +It also meant that reordering union members, while not a breaking change to the API, _would_ be a breaking change +for generated clients. + +Now, if an individual variant has a `title` attribute, that `title` will be used in the name instead. +This is only an enhancement for documents which use `title` in union variants, and only a breaking change for +_inline models_ (not `#/components/schemas` which should already have used more descriptive names). + +Thanks @wallagib for PR #962! + +### Features + +#### Support patterned and default HTTP statuses + +HTTP statuses like `2XX` and `default` are now supported! + +A big thank you to: +- @PSU3D0 for PR #973 (eons ago 😅) +- @obs-gh-peterkolloch for PR #1300 +- @goodsonjr for PR #1304 + +Closes #1271 and #832 + +> [!NOTE] +> Custom template users: the `endpoint.responses` type has changed quite a bit. Check out #1303 for the changes. + +## 0.25.3 (2025-07-21) + +### Features + +- Add --meta uv for generating astral-sh/uv compatible packages. (#1286) +- Switch to `uv_build` build backend. (#1290) + +## 0.25.2 (2025-07-03) + +### Fixes + +- Import error for `types.FileType` (#1274) (#1278) + +## 0.25.1 (2025-06-19) + +### Fixes + +- Support ruff 0.12 (#1270) + +## 0.25.0 (2025-06-06) + +### Breaking Changes + +- Raise minimum httpx version to 0.23 + +#### Removed ability to set an array as a multipart body + +Previously, when defining a request's body as `multipart/form-data`, the generator would attempt to generate code +for both `object` schemas and `array` schemas. However, most arrays could not generate valid multipart bodies, as +there would be no field names (required to set the `Content-Disposition` headers). + +The code to generate any body for `multipart/form-data` where the schema is `array` has been removed, and any such +bodies will be skipped. This is not _expected_ to be a breaking change in practice, since the code generated would +probably never work. + +If you have a use-case for `multipart/form-data` with an `array` schema, please [open a new discussion](https://github.com/openapi-generators/openapi-python-client/discussions) with an example schema and the desired functional Python code. + +#### Change default multipart array serialization + +Previously, any arrays of values in a `multipart/form-data` body would be serialized as an `application/json` part. +This matches the default behavior specified by OpenAPI and supports arrays of files (`binary` format strings). +However, because this generator doesn't yet support specifying `encoding` per property, this may result in +now-incorrect code when the encoding _was_ explicitly set to `application/json` for arrays of scalar values. + +PR #938 fixes #692. Thanks @micha91 for the fix, @ratgen and @FabianSchurig for testing, and @davidlizeng for the original report... many years ago 😅. + +## 0.24.3 (2025-03-31) + +### Features + +#### Adding support for named integer enums + +##1214 by @barrybarrette + +Adding support for named integer enums via an optional extension, `x-enum-varnames`. + +This extension is added to the schema inline with the `enum` definition: +``` +"MyEnum": { + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 99 + ], + "type": "integer", + "format": "int32", + "x-enum-varnames": [ + "Deinstalled", + "Installed", + "Upcoming_Site", + "Lab_Site", + "Pending_Deinstall", + "Suspended", + "Install_In_Progress", + "Unknown" + ] +} +``` + +The result: +![image](https://github.com/user-attachments/assets/780880b3-2f1f-49be-823b-f9abb713a3e1) + +## 0.24.2 (2025-03-22) + +### Fixes + +#### Make lists of models and enums work correctly in custom templates + +Lists of model and enum classes should be available to custom templates via the Jinja +variables `openapi.models` and `openapi.enums`, but these were being passed in a way that made +them always appear empty. This has been fixed so a custom template can now iterate over them. + +Closes #1188. + +## 0.24.1 (2025-03-15) + +### Features + +- allow Ruff to 0.10 (#1220) +- allow Ruff 0.11 (#1222) +- Allow any `Mapping` in generated `from_dict` functions (#1211) + +### Fixes + +#### Always parse `$ref` as a reference + +If additional attributes were included with a `$ref` (for example `title` or `description`), the property could be +interpreted as a new type instead of a reference, usually resulting in `Any` in the generated code. +Now, any sibling properties to `$ref` will properly be ignored, as per the OpenAPI specification. + +Thanks @nkrishnaswami! + +## 0.24.0 (2025-03-03) + +### Breaking Changes + +#### Support `$ref` in responses + +Previously, using a `$ref` to define a response was ignored, the code to call the endpoint was still generated, but +the response would not be parsed. Now, responses defined with `$ref` will be used to generate the response model, which +will parse the response at runtime. + +If a `$ref` is incorrect or uses a feature that is not supported by the generator, these endpoints will start failing to +generate. + +### Features + +#### Make `config` available in custom templates + +The configuration options object is now exposed as a variable called `config` in Jinja2 templates. + +#### Add `docstrings_on_attributes` config setting + +Setting this option to `true` changes the docstring behavior in model classes: for any attribute that have a non-empty `description`, instead of describing the attribute as part of the class's docstring, the description will appear in an individual docstring for that attribute. + +## 0.23.1 (2025-01-13) + +### Features + +- allow Ruff 0.9 (#1192) + ## 0.23.0 (2024-12-24) ### Breaking Changes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 194f26dcc..e3d9c68ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,26 +50,40 @@ All changes must be tested, I recommend writing the test first, then writing the If you think that some of the added code is not testable (or testing it would add little value), mention that in your PR and we can discuss it. -1. If you're adding support for a new OpenAPI feature or covering a new edge case, add an [end-to-end test](#end-to-end-tests) -2. If you're modifying the way an existing feature works, make sure an existing test generates the _old_ code in `end_to_end_tests/golden-record`. You'll use this to check for the new code once your changes are complete. -3. If you're improving an error or adding a new error, add a [unit test](#unit-tests) +1. If you're adding support for a new OpenAPI feature or covering a new edge case, add [functional tests](#functional-tests), and optionally an [end-to-end snapshot test](#end-to-end-snapshot-tests). +2. If you're modifying the way an existing feature works, make sure functional tests cover this case. Existing end-to-end snapshot tests might also be affected if you have changed what generated model/endpoint code looks like. +3. If you're improving error handling or adding a new error, add [functional tests](#functional-tests). +4. For tests of low-level pieces of code that are fairly self-contained, and not tightly coupled to other internal implementation details, you can use regular [unit tests](#unit-tests). -#### End-to-end tests +#### End-to-end snapshot tests -This project aims to have all "happy paths" (types of code which _can_ be generated) covered by end to end tests (snapshot tests). In order to check code changes against the previous set of snapshots (called a "golden record" here), you can run `pdm e2e`. To regenerate the snapshots, run `pdm regen`. +This project aims to have all "happy paths" (types of code which _can_ be generated) covered by end-to-end tests. There are two types of these: snapshot tests, and functional tests. -There are 4 types of snapshots generated right now, you may have to update only some or all of these depending on the changes you're making. Within the `end_to_end_tets` directory: +Snapshot tests verify that the generated code is identical to a previously-committed set of snapshots (called a "golden record" here). They are basically regression tests to catch any unintended changes in the generator output. + +In order to check code changes against the previous set of snapshots (called a "golden record" here), you can run `pdm e2e`. To regenerate the snapshots, run `pdm regen`. + +There are 4 types of snapshots generated right now, you may have to update only some or all of these depending on the changes you're making. Within the `end_to_end_tests` directory: 1. `baseline_openapi_3.0.json` creates `golden-record` for testing OpenAPI 3.0 features 2. `baseline_openapi_3.1.yaml` is checked against `golden-record` for testing OpenAPI 3.1 features (and ensuring consistency with 3.0) 3. `test_custom_templates` are used with `baseline_openapi_3.0.json` to generate `custom-templates-golden-record` for testing custom templates 4. `3.1_specific.openapi.yaml` is used to generate `test-3-1-golden-record` and test 3.1-specific features (things which do not have a 3.0 equivalent) +#### Functional tests + +These are black-box tests that verify the runtime behavior of generated code, as well as the generator's validation behavior. They are also end-to-end tests, since they run the generator as a shell command. + +This can sometimes identify issues with error handling, validation logic, module imports, etc., that might be harder to diagnose via the snapshot tests, especially during development of a new feature. For instance, they can verify that JSON data is correctly decoded into model class attributes, or that the generator will emit an appropriate warning or error for an invalid spec. + +See [`end_to_end_tests/functional_tests`](./end_to_end_tests/functional_tests). + #### Unit tests -> **NOTE**: Several older-style unit tests using mocks exist in this project. These should be phased out rather than updated, as the tests are brittle and difficult to maintain. Only error cases should be tests with unit tests going forward. +These include: -In some cases, we need to test things which cannot be generated—like validating that errors are caught and handled correctly. These should be tested via unit tests in the `tests` directory, using the `pytest` framework. +* Regular unit tests of basic pieces of fairly self-contained low-level functionality, such as helper functions. These are implemented in the `tests` directory, using the `pytest` framework. +* Older-style unit tests of low-level functions like `property_from_data` that have complex behavior. These are brittle and difficult to maintain, and should not be used going forward. Instead, they should be migrated to functional tests. ### Creating a Pull Request diff --git a/README.md b/README.md index a184be377..4a886d299 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,16 @@ class_overrides: The easiest way to find what needs to be overridden is probably to generate your client and go look at everything in the `models` folder. +### docstrings_on_attributes + +By default, when `openapi-python-client` generates a model class, it includes a list of attributes and their +descriptions in the docstring for the class. If you set this option to `true`, then the attribute descriptions +will be put in docstrings for the attributes themselves, and will not be in the class docstring. + +```yaml +docstrings_on_attributes: true +``` + ### literal_enums By default, `openapi-python-client` generates classes inheriting for `Enum` for enums. It can instead use `Literal` @@ -156,7 +166,7 @@ In the config file, there's an easy way to tell `openapi-python-client` to run a ```yaml post_hooks: - - "ruff check . --fix" + - "ruff check . --fix-only" - "ruff format ." ``` @@ -182,6 +192,39 @@ content_type_overrides: application/zip: application/octet-stream ``` +## Supported Extensions + +### x-enum-varnames + +This extension has been adopted by similar projects such as [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator/pull/917). +It is intended to provide user-friendly names for integer Enum members that get generated. +It is critical that the length of the array matches that of the enum values. + +``` +"Colors": { + "type": "integer", + "format": "int32", + "enum": [ + 0, + 1, + 2 + ], + "x-enum-varnames": [ + "Red", + "Green", + "Blue" + ] +} +``` + +Results in: +``` +class Color(IntEnum): + RED = 0 + GREEN = 1 + BLUE = 2 +``` + [changelog.md]: CHANGELOG.md [poetry]: https://python-poetry.org/ [PDM]: https://pdm-project.org/latest/ diff --git a/end_to_end_tests/__init__.py b/end_to_end_tests/__init__.py index 1bf33f63f..3793e0395 100644 --- a/end_to_end_tests/__init__.py +++ b/end_to_end_tests/__init__.py @@ -1 +1,5 @@ """ Generate a complete client and verify that it is correct """ +import pytest + +pytest.register_assert_rewrite("end_to_end_tests.end_to_end_test_helpers") +pytest.register_assert_rewrite("end_to_end_tests.functional_tests.helpers") diff --git a/end_to_end_tests/__snapshots__/test_end_to_end.ambr b/end_to_end_tests/__snapshots__/test_end_to_end.ambr index 525f8baf2..6f4a9f2d2 100644 --- a/end_to_end_tests/__snapshots__/test_end_to_end.ambr +++ b/end_to_end_tests/__snapshots__/test_end_to_end.ambr @@ -2,11 +2,11 @@ # name: test_documents_with_errors[bad-status-code] ''' Generating /test-documents-with-errors - Warning(s) encountered while generating. Client was generated, but some pieces may be missing + Warning(s) encountered while generating. Client was generated, but some pieces may be missing WARNING parsing GET / within default. - Invalid response status code abcdef (not a valid HTTP status code), response will be omitted from generated client + Invalid response status code pattern: abcdef, response will be omitted from generated client If you believe this was a mistake or this tool is missing a feature you need, please open an issue at https://github.com/openapi-generators/openapi-python-client/issues/new/choose @@ -16,8 +16,8 @@ # name: test_documents_with_errors[circular-body-ref] ''' Generating /test-documents-with-errors - Warning(s) encountered while generating. Client was generated, but some pieces may be missing + Warning(s) encountered while generating. Client was generated, but some pieces may be missing WARNING parsing POST / within default. Endpoint will not be generated. Circular $ref in request body @@ -30,8 +30,8 @@ # name: test_documents_with_errors[invalid-uuid-defaults] ''' Generating /test-documents-with-errors - Warning(s) encountered while generating. Client was generated, but some pieces may be missing + Warning(s) encountered while generating. Client was generated, but some pieces may be missing WARNING parsing PUT / within default. Endpoint will not be generated. cannot parse parameter of endpoint put_: Invalid UUID value: 3 @@ -49,8 +49,8 @@ # name: test_documents_with_errors[missing-body-ref] ''' Generating /test-documents-with-errors - Warning(s) encountered while generating. Client was generated, but some pieces may be missing + Warning(s) encountered while generating. Client was generated, but some pieces may be missing WARNING parsing POST / within default. Endpoint will not be generated. Could not resolve $ref #/components/requestBodies/body in request body @@ -63,8 +63,8 @@ # name: test_documents_with_errors[optional-path-param] ''' Generating /test-documents-with-errors - Warning(s) encountered while generating. Client was generated, but some pieces may be missing + Warning(s) encountered while generating. Client was generated, but some pieces may be missing WARNING parsing GET /{optional} within default. Endpoint will not be generated. Path parameter must be required diff --git a/end_to_end_tests/baseline_openapi_3.0.json b/end_to_end_tests/baseline_openapi_3.0.json index dc2092dfe..f3ce912c9 100644 --- a/end_to_end_tests/baseline_openapi_3.0.json +++ b/end_to_end_tests/baseline_openapi_3.0.json @@ -394,52 +394,15 @@ "content": { "multipart/form-data": { "schema": { - "$ref": "#/components/schemas/Body_upload_file_tests_upload_post" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - } - } - }, - "/tests/upload/multiple": { - "post": { - "tags": [ - "tests" - ], - "summary": "Upload multiple files", - "description": "Upload several files in the same request", - "operationId": "upload_multiple_files_tests_upload_post", - "parameters": [], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "array", - "items": { - "type": "string", - "format": "binary" - } + "$ref": "#/components/schemas/Body_upload_file_tests_upload_post", + "title": "Body_upload_file_tests_upload_post", + "required": [ + "some_file", + "some_object", + "some_nullable_object", + "some_required_number" + ], + "properties": {} } } }, @@ -767,7 +730,13 @@ "content": { "application/json": { "schema": { - "type": "string" + "type": "object", + "properties": { + "data": { + "type": "string", + "format": "binary" + } + } } } } @@ -991,6 +960,138 @@ } } }, + "/responses/reference": { + "get": { + "tags": [ + "responses" + ], + "summary": "Endpoint using predefined response", + "operationId": "reference_response", + "responses": { + "200": { + "$ref": "#/components/responses/AResponse" + } + } + } + }, + "/responses/status-codes/default": { + "get": { + "tags": [ + "responses" + ], + "summary": "Default Status Code Only", + "operationId": "default_status_code", + "responses": { + "default": { + "description": "Default response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/response/status-codes/patterns": { + "get": { + "tags": [ + "responses" + ], + "summary": "Status Code Patterns", + "operationId": "status_code_patterns", + "responses": { + "2XX": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "success", + "failure" + ] + } + } + } + } + } + }, + "4XX": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/response/status-codes/precedence": { + "get": { + "operationId": "status_code_precedence", + "tags": [ + "responses" + ], + "summary": "Status Codes Precedence", + "description": "Verify that specific status codes are always checked first, then ranges, then default", + "responses": { + "default": { + "description": "Default Response Should Be Last", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "description": "Pattern should be after specific codes", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, "/auth/token_with_cookie": { "get": { "tags": [ @@ -1149,7 +1250,10 @@ }, "/tag_with_number": { "get": { - "tags": ["1", "2"], + "tags": [ + "1", + "2" + ], "responses": { "200": { "description": "Success" @@ -1684,7 +1788,9 @@ "type": "string" } }, - "required": ["type"] + "required": [ + "type" + ] }, { "type": "object", @@ -1696,7 +1802,9 @@ "type": "string" } }, - "required": ["type"] + "required": [ + "type" + ] } ] } @@ -2187,6 +2295,7 @@ "oneOf": [ { "type": "object", + "title": "Apples", "properties": { "apples": { "type": "string" @@ -2195,6 +2304,7 @@ }, { "type": "object", + "title": "Bananas", "properties": { "bananas": { "type": "string" @@ -2969,6 +3079,18 @@ } } } + }, + "responses": { + "AResponse": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AModel" + } + } + } + } } } } diff --git a/end_to_end_tests/baseline_openapi_3.1.yaml b/end_to_end_tests/baseline_openapi_3.1.yaml index 42d5b7384..74b85229d 100644 --- a/end_to_end_tests/baseline_openapi_3.1.yaml +++ b/end_to_end_tests/baseline_openapi_3.1.yaml @@ -418,51 +418,6 @@ info: } } }, - "/tests/upload/multiple": { - "post": { - "tags": [ - "tests" - ], - "summary": "Upload multiple files", - "description": "Upload several files in the same request", - "operationId": "upload_multiple_files_tests_upload_post", - "parameters": [ ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "array", - "items": { - "type": "string", - "format": "binary" - } - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - } - } - }, "/tests/json_body": { "post": { "tags": [ @@ -759,7 +714,13 @@ info: "content": { "application/json": { "schema": { - "type": "string" + "type": "object", + "properties": { + "data": { + "type": "string", + "format": "binary" + } + } } } } @@ -983,6 +944,129 @@ info: } } }, + "/responses/reference": { + "get": { + "tags": [ + "responses" + ], + "summary": "Endpoint using predefined response", + "operationId": "reference_response", + "responses": { + "200": { + "$ref": "#/components/responses/AResponse" + } + } + } + }, + "/responses/status-codes/default": { + "get": { + "tags": ["responses"], + "summary": "Default Status Code Only", + "operationId": "default_status_code", + "responses": { + "default": { + "description": "Default response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/response/status-codes/patterns": { + "get": { + "tags": ["responses"], + "summary": "Status Code Patterns", + "operationId": "status_code_patterns", + "responses": { + "2XX": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": ["success", "failure"] + } + } + } + } + } + }, + "4XX": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/response/status-codes/precedence": { + "get": { + "operationId": "status_code_precedence", + "tags": ["responses"], + "summary": "Status Codes Precedence", + "description": "Verify that specific status codes are always checked first, then ranges, then default", + "responses": { + "default": { + "description": "Default Response Should Be Last", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "description": "Pattern should be after specific codes", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, "/auth/token_with_cookie": { "get": { "tags": [ @@ -1141,7 +1225,7 @@ info: }, "/tag_with_number": { "get": { - "tags": ["1", "2"], + "tags": [ "1", "2" ], "responses": { "200": { "description": "Success" @@ -1674,7 +1758,7 @@ info: "type": "string" } }, - "required": ["type"] + "required": [ "type" ] }, { "type": "object", @@ -1686,7 +1770,7 @@ info: "type": "string" } }, - "required": ["type"] + "required": [ "type" ] } ] } @@ -2182,6 +2266,7 @@ info: "oneOf": [ { "type": "object", + "title": "Apples", "properties": { "apples": { "type": "string" @@ -2190,6 +2275,7 @@ info: }, { "type": "object", + "title": "Bananas", "properties": { "bananas": { "type": "string" @@ -2960,3 +3046,10 @@ info: "application/json": "schema": "$ref": "#/components/schemas/AModel" + responses: + AResponse: + description: OK + content: + "application/json": + "schema": + "$ref": "#/components/schemas/AModel" diff --git a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/responses/__init__.py b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/responses/__init__.py index 6000bd0e7..d1361e311 100644 --- a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/responses/__init__.py +++ b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/responses/__init__.py @@ -2,7 +2,14 @@ import types -from . import post_responses_unions_simple_before_complex, text_response +from . import ( + default_status_code, + post_responses_unions_simple_before_complex, + reference_response, + status_code_patterns, + status_code_precedence, + text_response, +) class ResponsesEndpoints: @@ -19,3 +26,31 @@ def text_response(cls) -> types.ModuleType: Text Response """ return text_response + + @classmethod + def reference_response(cls) -> types.ModuleType: + """ + Endpoint using predefined response + """ + return reference_response + + @classmethod + def default_status_code(cls) -> types.ModuleType: + """ + Default Status Code Only + """ + return default_status_code + + @classmethod + def status_code_patterns(cls) -> types.ModuleType: + """ + Status Code Patterns + """ + return status_code_patterns + + @classmethod + def status_code_precedence(cls) -> types.ModuleType: + """ + Verify that specific status codes are always checked first, then ranges, then default + """ + return status_code_precedence diff --git a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/tests/__init__.py b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/tests/__init__.py index 1b91acc98..d7ef5cd7c 100644 --- a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/tests/__init__.py +++ b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/tests/__init__.py @@ -21,7 +21,6 @@ token_with_cookie_auth_token_with_cookie_get, unsupported_content_tests_unsupported_content_get, upload_file_tests_upload_post, - upload_multiple_files_tests_upload_post, ) @@ -82,13 +81,6 @@ def upload_file_tests_upload_post(cls) -> types.ModuleType: """ return upload_file_tests_upload_post - @classmethod - def upload_multiple_files_tests_upload_post(cls) -> types.ModuleType: - """ - Upload several files in the same request - """ - return upload_multiple_files_tests_upload_post - @classmethod def json_body_tests_json_body_post(cls) -> types.ModuleType: """ diff --git a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/models/__init__.py b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/models/__init__.py new file mode 100644 index 000000000..611ed15f6 --- /dev/null +++ b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/models/__init__.py @@ -0,0 +1,16 @@ +# Testing that we can access model-related information via Jinja variables. + +# To avoid having to update this file in the golden record every time the test specs are changed, +# we won't include all the classes in this output - we'll just look for one of them. + +# Using "alls" +# AModel + +# Using "imports" +# from .a_model import AModel + +# Using "openapi.models" +# AModel (a_model) + +# Using "openapi.enums" +# AnEnum (an_enum) diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/.gitignore b/end_to_end_tests/docstrings-on-attributes-golden-record/.gitignore new file mode 100644 index 000000000..79a2c3d73 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/.gitignore @@ -0,0 +1,23 @@ +__pycache__/ +build/ +dist/ +*.egg-info/ +.pytest_cache/ + +# pyenv +.python-version + +# Environments +.env +.venv + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# JetBrains +.idea/ + +/coverage.xml +/.coverage diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/README.md b/end_to_end_tests/docstrings-on-attributes-golden-record/README.md new file mode 100644 index 000000000..79b20f411 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/README.md @@ -0,0 +1,124 @@ +# my-test-api-client +A client library for accessing My Test API + +## Usage +First, create a client: + +```python +from my_test_api_client import Client + +client = Client(base_url="https://api.example.com") +``` + +If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead: + +```python +from my_test_api_client import AuthenticatedClient + +client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken") +``` + +Now call your endpoint and use your models: + +```python +from my_test_api_client.models import MyDataModel +from my_test_api_client.api.my_tag import get_my_data_model +from my_test_api_client.types import Response + +with client as client: + my_data: MyDataModel = get_my_data_model.sync(client=client) + # or if you need more info (e.g. status_code) + response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client) +``` + +Or do the same thing with an async version: + +```python +from my_test_api_client.models import MyDataModel +from my_test_api_client.api.my_tag import get_my_data_model +from my_test_api_client.types import Response + +async with client as client: + my_data: MyDataModel = await get_my_data_model.asyncio(client=client) + response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client) +``` + +By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle. + +```python +client = AuthenticatedClient( + base_url="https://internal_api.example.com", + token="SuperSecretToken", + verify_ssl="/path/to/certificate_bundle.pem", +) +``` + +You can also disable certificate validation altogether, but beware that **this is a security risk**. + +```python +client = AuthenticatedClient( + base_url="https://internal_api.example.com", + token="SuperSecretToken", + verify_ssl=False +) +``` + +Things to know: +1. Every path/method combo becomes a Python module with four functions: + 1. `sync`: Blocking request that returns parsed data (if successful) or `None` + 1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful. + 1. `asyncio`: Like `sync` but async instead of blocking + 1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking + +1. All path/query params, and bodies become method arguments. +1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above) +1. Any endpoint which did not have a tag will be in `my_test_api_client.api.default` + +## Advanced customizations + +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): + +```python +from my_test_api_client import Client + +def log_request(request): + print(f"Request event hook: {request.method} {request.url} - Waiting for response") + +def log_response(response): + request = response.request + print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}") + +client = Client( + base_url="https://api.example.com", + httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, +) + +# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +``` + +You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): + +```python +import httpx +from my_test_api_client import Client + +client = Client( + base_url="https://api.example.com", +) +# Note that base_url needs to be re-set, as would any shared cookies, headers, etc. +client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +``` + +## Building / publishing this package +This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics: +1. Update the metadata in pyproject.toml (e.g. authors, version) +1. If you're using a private repository, configure it with Poetry + 1. `poetry config repositories. ` + 1. `poetry config http-basic. ` +1. Publish the client with `poetry publish --build -r ` or, if for public PyPI, just `poetry publish --build` + +If you want to install this client into another project without publishing it (e.g. for development) then: +1. If that project **is using Poetry**, you can simply do `poetry add ` from that project +1. If that project is not using Poetry: + 1. Build a wheel with `poetry build -f wheel` + 1. Install that wheel from the other project `pip install ` diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/__init__.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/__init__.py new file mode 100644 index 000000000..3747245da --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/__init__.py @@ -0,0 +1,8 @@ +"""A client library for accessing My Test API""" + +from .client import AuthenticatedClient, Client + +__all__ = ( + "AuthenticatedClient", + "Client", +) diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/api/__init__.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/api/__init__.py new file mode 100644 index 000000000..81f9fa241 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/api/__init__.py @@ -0,0 +1 @@ +"""Contains methods for accessing the API""" diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/client.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/client.py new file mode 100644 index 000000000..190510bac --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/client.py @@ -0,0 +1,260 @@ +import ssl +from typing import Any + +import httpx +from attrs import define, evolve, field + + +@define +class Client: + """A class for keeping track of data related to the API + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + """Whether or not to raise an errors.UnexpectedStatus if the API returns a status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.""" + _base_url: str = field(alias="base_url") + _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) + + def with_headers(self, headers: dict[str, str]) -> "Client": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: dict[str, str]) -> "Client": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "Client": + """Get a new client matching this one with a new timeout configuration""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "Client": + """Manually set the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "Client": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": + """Manually set the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "Client": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) + + +@define +class AuthenticatedClient: + """A Client which has been authenticated for use on secured endpoints + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + """Whether or not to raise an errors.UnexpectedStatus if the API returns a status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.""" + _base_url: str = field(alias="base_url") + _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) + + token: str + """The token to use for authentication""" + prefix: str = "Bearer" + """The prefix to use for the Authorization header""" + auth_header_name: str = "Authorization" + """The name of the Authorization header""" + + def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + """Get a new client matching this one with a new timeout configuration""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient": + """Manually set the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "AuthenticatedClient": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": + """Manually set the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "AuthenticatedClient": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/errors.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/errors.py new file mode 100644 index 000000000..5f92e76ac --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/errors.py @@ -0,0 +1,16 @@ +"""Contains shared errors types that can be raised from API functions""" + + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__( + f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" + ) + + +__all__ = ["UnexpectedStatus"] diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/__init__.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/__init__.py new file mode 100644 index 000000000..3f5aca91f --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/__init__.py @@ -0,0 +1,9 @@ +"""Contains all the data models used in inputs/outputs""" + +from .model_with_description import ModelWithDescription +from .model_with_no_description import ModelWithNoDescription + +__all__ = ( + "ModelWithDescription", + "ModelWithNoDescription", +) diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_description.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_description.py new file mode 100644 index 000000000..b0be6a72c --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_description.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ModelWithDescription") + + +@_attrs_define +class ModelWithDescription: + """This is a nice model.""" + + prop_with_no_desc: str | Unset = UNSET + prop_with_desc: str | Unset = UNSET + """ This is a nice property. """ + prop_with_long_desc: str | Unset = UNSET + """ It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of + foolishness, + it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of + darkness, it was the spring of hope, it was the winter of despair. + """ + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + prop_with_no_desc = self.prop_with_no_desc + + prop_with_desc = self.prop_with_desc + + prop_with_long_desc = self.prop_with_long_desc + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if prop_with_no_desc is not UNSET: + field_dict["propWithNoDesc"] = prop_with_no_desc + if prop_with_desc is not UNSET: + field_dict["propWithDesc"] = prop_with_desc + if prop_with_long_desc is not UNSET: + field_dict["propWithLongDesc"] = prop_with_long_desc + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + prop_with_no_desc = d.pop("propWithNoDesc", UNSET) + + prop_with_desc = d.pop("propWithDesc", UNSET) + + prop_with_long_desc = d.pop("propWithLongDesc", UNSET) + + model_with_description = cls( + prop_with_no_desc=prop_with_no_desc, + prop_with_desc=prop_with_desc, + prop_with_long_desc=prop_with_long_desc, + ) + + model_with_description.additional_properties = d + return model_with_description + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_no_description.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_no_description.py new file mode 100644 index 000000000..0a020f657 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/models/model_with_no_description.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ModelWithNoDescription") + + +@_attrs_define +class ModelWithNoDescription: + prop_with_no_desc: str | Unset = UNSET + prop_with_desc: str | Unset = UNSET + """ This is a nice property. """ + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + prop_with_no_desc = self.prop_with_no_desc + + prop_with_desc = self.prop_with_desc + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if prop_with_no_desc is not UNSET: + field_dict["propWithNoDesc"] = prop_with_no_desc + if prop_with_desc is not UNSET: + field_dict["propWithDesc"] = prop_with_desc + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + prop_with_no_desc = d.pop("propWithNoDesc", UNSET) + + prop_with_desc = d.pop("propWithDesc", UNSET) + + model_with_no_description = cls( + prop_with_no_desc=prop_with_no_desc, + prop_with_desc=prop_with_desc, + ) + + model_with_no_description.additional_properties = d + return model_with_no_description + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/py.typed b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/py.typed new file mode 100644 index 000000000..1aad32711 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561 \ No newline at end of file diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/types.py b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/types.py new file mode 100644 index 000000000..b64af0952 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/types.py @@ -0,0 +1,54 @@ +"""Contains some shared types for properties""" + +from collections.abc import Mapping, MutableMapping +from http import HTTPStatus +from typing import IO, BinaryIO, Generic, Literal, TypeVar + +from attrs import define + + +class Unset: + def __bool__(self) -> Literal[False]: + return False + + +UNSET: Unset = Unset() + +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] + + +@define +class File: + """Contains information for file uploads""" + + payload: BinaryIO + file_name: str | None = None + mime_type: str | None = None + + def to_tuple(self) -> FileTypes: + """Return a tuple representation that httpx will accept for multipart/form-data""" + return self.file_name, self.payload, self.mime_type + + +T = TypeVar("T") + + +@define +class Response(Generic[T]): + """A response from an endpoint""" + + status_code: HTTPStatus + content: bytes + headers: MutableMapping[str, str] + parsed: T | None + + +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/end_to_end_tests/docstrings-on-attributes-golden-record/pyproject.toml b/end_to_end_tests/docstrings-on-attributes-golden-record/pyproject.toml new file mode 100644 index 000000000..d3fd8e4d7 --- /dev/null +++ b/end_to_end_tests/docstrings-on-attributes-golden-record/pyproject.toml @@ -0,0 +1,26 @@ +[tool.poetry] +name = "my-test-api-client" +version = "0.1.0" +description = "A client library for accessing My Test API" +authors = [] +readme = "README.md" +packages = [ + { include = "my_test_api_client" }, +] +include = ["my_test_api_client/py.typed"] + +[tool.poetry.dependencies] +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" +attrs = ">=22.2.0" +python-dateutil = "^2.8.0" + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = ["F", "I", "UP"] diff --git a/end_to_end_tests/docstrings_on_attributes.config.yml b/end_to_end_tests/docstrings_on_attributes.config.yml new file mode 100644 index 000000000..0b21ad0b5 --- /dev/null +++ b/end_to_end_tests/docstrings_on_attributes.config.yml @@ -0,0 +1 @@ +docstrings_on_attributes: true diff --git a/end_to_end_tests/docstrings_on_attributes.yml b/end_to_end_tests/docstrings_on_attributes.yml new file mode 100644 index 000000000..22e6e227d --- /dev/null +++ b/end_to_end_tests/docstrings_on_attributes.yml @@ -0,0 +1,32 @@ +openapi: 3.1.0 +info: + title: My Test API + description: An API for testing docstrings_on_attributes behavior + version: 0.1.0 +paths: + {} +components: + schemas: + ModelWithDescription: + type: object + description: This is a nice model. + properties: + propWithNoDesc: + type: string + propWithDesc: + type: string + description: This is a nice property. + propWithLongDesc: + type: string + description: | + It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, + it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of + darkness, it was the spring of hope, it was the winter of despair. + ModelWithNoDescription: + type: object + properties: + propWithNoDesc: + type: string + propWithDesc: + type: string + description: This is a nice property. diff --git a/end_to_end_tests/functional_tests/README.md b/end_to_end_tests/functional_tests/README.md new file mode 100644 index 000000000..1008527c5 --- /dev/null +++ b/end_to_end_tests/functional_tests/README.md @@ -0,0 +1,75 @@ +## The `functional_tests` module + +These are end-to-end tests which run the client generator against many small API documents that are specific to various test cases. + +Rather than testing low-level implementation details (like the unit tests in `tests`), or making assertions about the exact content of the generated code (like the "golden record"-based end-to-end tests), these treat both the generator and the generated code as black boxes and make assertions about their behavior. + +The tests are in two submodules: + +# `generated_code_execution` + +These tests use valid API specs, and after running the generator, they _import and execute_ pieces of the generated code to verify that it actually works at runtime. + +Each test class follows this pattern: + +- Use the decorator `@with_generated_client_fixture`, providing an inline API spec (JSON or YAML) that contains whatever schemas/paths/etc. are relevant to this test class. + - The spec can omit the `openapi:`, `info:`, and `paths:`, blocks, unless those are relevant to the test. + - The decorator creates a temporary file for the inline spec and a temporary directory for the generated code, and runs the client generator. + - It creates a `GeneratedClientContext` object (defined in `end_to_end_test_helpers.py`) to keep track of things like the location of the generated code and the output of the generator command. + - This object is injected into the test class as a fixture called `generated_client`, although most tests will not need to reference the fixture directly. + - `sys.path` is temporarily changed, for the scope of this test class, to allow imports from the generated code. +- Use the decorator `@with_generated_code_imports` or `@with_generated_code_import` to make classes or functions from the generated code available to the tests. + - `@with_generated_code_imports(".models.MyModel1", ".models.MyModel2)` would execute `from [package name].models import MyModel1, MyModel2` and inject the imported classes into the test class as fixtures called `MyModel1` and `MyModel2`. + - `@with_generated_code_import(".api.my_operation.sync", alias="endpoint_method")` would execute `from [package name].api.my_operation import sync`, but the fixture would be named `endpoint_method`. + - After the test class finishes, these imports are discarded. + +Example: + +```python +@with_generated_client_fixture( +""" +components: + schemas: + MyModel: + type: object + properties: + stringProp: {"type": "string"} +""") +@with_generated_code_import(".models.MyModel") +class TestSimpleJsonObject: + def test_encoding(self, MyModel): + instance = MyModel(string_prop="abc") + assert instance.to_dict() == {"stringProp": "abc"} +``` + +# `generator_failure_cases` + +These run the generator with an invalid API spec and make assertions about the warning/error output. Some of these invalid conditions are expected to only produce warnings about the affected schemas, while others are expected to produce fatal errors that terminate the generator. + +For warning conditions, each test class uses `@with_generated_client_fixture` as above, then uses `assert_bad_schema` to parse the output and check for a specific warning message for a specific schema name. + +```python +@with_generated_client_fixture( +""" +components: + schemas: + MyModel: + # some kind of invalid schema +""") +class TestBadSchema: + def test_encoding(self, generated_client): + assert_bad_schema(generated_client, "MyModel", "some expected warning text") +``` + +Or, for fatal error conditions: + +- Call `inline_spec_should_fail`, providing an inline API spec (JSON or YAML). + +```python +class TestBadSpec: + def test_some_spec_error(self): + result = inline_spec_should_fail(""" +# some kind of invalid spec +""") + assert "some expected error text" in result.output +``` diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py b/end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py new file mode 100644 index 000000000..aaf33d906 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_arrays.py @@ -0,0 +1,143 @@ +from end_to_end_tests.functional_tests.helpers import ( + assert_model_decode_encode, + assert_model_property_type_hint, + with_generated_client_fixture, + with_generated_code_imports, +) + + +@with_generated_client_fixture( +""" +components: + schemas: + SimpleObject: + type: object + properties: + name: {"type": "string"} + ModelWithArrayOfAny: + properties: + arrayProp: + type: array + items: {} + ModelWithArrayOfInts: + properties: + arrayProp: + type: array + items: {"type": "integer"} + ModelWithArrayOfObjects: + properties: + arrayProp: + type: array + items: {"$ref": "#/components/schemas/SimpleObject"} +""") +@with_generated_code_imports( + ".models.ModelWithArrayOfAny", + ".models.ModelWithArrayOfInts", + ".models.ModelWithArrayOfObjects", + ".models.SimpleObject", +) +class TestArraySchemas: + def test_array_of_any(self, ModelWithArrayOfAny): + assert_model_decode_encode( + ModelWithArrayOfAny, + {"arrayProp": ["a", 1]}, + ModelWithArrayOfAny(array_prop=["a", 1]), + ) + + def test_array_of_int(self, ModelWithArrayOfInts): + assert_model_decode_encode( + ModelWithArrayOfInts, + {"arrayProp": [1, 2]}, + ModelWithArrayOfInts(array_prop=[1, 2]), + ) + + def test_array_of_object(self, ModelWithArrayOfObjects, SimpleObject): + assert_model_decode_encode( + ModelWithArrayOfObjects, + {"arrayProp": [{"name": "a"}, {"name": "b"}]}, + ModelWithArrayOfObjects(array_prop=[SimpleObject(name="a"), SimpleObject(name="b")]), + ) + + def test_type_hints(self, ModelWithArrayOfAny, ModelWithArrayOfInts, ModelWithArrayOfObjects): + assert_model_property_type_hint(ModelWithArrayOfAny, "array_prop", "list[Any] | Unset") + assert_model_property_type_hint(ModelWithArrayOfInts, "array_prop", "list[int] | Unset") + assert_model_property_type_hint(ModelWithArrayOfObjects, "array_prop", "list[SimpleObject] | Unset") + + +@with_generated_client_fixture( +""" +components: + schemas: + SimpleObject: + type: object + properties: + name: {"type": "string"} + ModelWithSinglePrefixItem: + type: object + properties: + arrayProp: + type: array + prefixItems: + - type: string + ModelWithPrefixItems: + type: object + properties: + arrayProp: + type: array + prefixItems: + - $ref: "#/components/schemas/SimpleObject" + - type: string + ModelWithMixedItems: + type: object + properties: + arrayProp: + type: array + prefixItems: + - $ref: "#/components/schemas/SimpleObject" + items: + type: string +""") +@with_generated_code_imports( + ".models.ModelWithSinglePrefixItem", + ".models.ModelWithPrefixItems", + ".models.ModelWithMixedItems", + ".models.SimpleObject", +) +class TestArraysWithPrefixItems: + def test_single_prefix_item(self, ModelWithSinglePrefixItem): + assert_model_decode_encode( + ModelWithSinglePrefixItem, + {"arrayProp": ["a"]}, + ModelWithSinglePrefixItem(array_prop=["a"]), + ) + + def test_prefix_items(self, ModelWithPrefixItems, SimpleObject): + assert_model_decode_encode( + ModelWithPrefixItems, + {"arrayProp": [{"name": "a"}, "b"]}, + ModelWithPrefixItems(array_prop=[SimpleObject(name="a"), "b"]), + ) + + def test_prefix_items_and_regular_items(self, ModelWithMixedItems, SimpleObject): + assert_model_decode_encode( + ModelWithMixedItems, + {"arrayProp": [{"name": "a"}, "b"]}, + ModelWithMixedItems(array_prop=[SimpleObject(name="a"), "b"]), + ) + + def test_type_hints(self, ModelWithSinglePrefixItem, ModelWithPrefixItems, ModelWithMixedItems): + assert_model_property_type_hint(ModelWithSinglePrefixItem, "array_prop", "list[str] | Unset") + assert_model_property_type_hint( + ModelWithPrefixItems, + "array_prop", + "list[SimpleObject | str] | Unset", + ) + assert_model_property_type_hint( + ModelWithMixedItems, + "array_prop", + "list[SimpleObject | str] | Unset", + ) + # Note, this test is asserting the current behavior which, due to limitations of the implementation + # (see: https://github.com/openapi-generators/openapi-python-client/pull/1130), is not really doing + # tuple type validation-- the ordering of prefixItems is ignored, and instead all of the types are + # simply treated as a union. diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_defaults.py b/end_to_end_tests/functional_tests/generated_code_execution/test_defaults.py new file mode 100644 index 000000000..5f8affb25 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_defaults.py @@ -0,0 +1,114 @@ +import datetime +import uuid + +from end_to_end_tests.functional_tests.helpers import ( + with_generated_client_fixture, + with_generated_code_imports, +) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyModel: + type: object + properties: + booleanProp: {"type": "boolean", "default": true} + stringProp: {"type": "string", "default": "a"} + numberProp: {"type": "number", "default": 1.5} + intProp: {"type": "integer", "default": 2} + dateProp: {"type": "string", "format": "date", "default": "2024-01-02"} + dateTimeProp: {"type": "string", "format": "date-time", "default": "2024-01-02T03:04:05Z"} + uuidProp: {"type": "string", "format": "uuid", "default": "07EF8B4D-AA09-4FFA-898D-C710796AFF41"} + anyPropWithString: {"default": "b"} + anyPropWithInt: {"default": 3} + booleanWithStringTrue1: {"type": "boolean", "default": "True"} + booleanWithStringTrue2: {"type": "boolean", "default": "true"} + booleanWithStringFalse1: {"type": "boolean", "default": "False"} + booleanWithStringFalse2: {"type": "boolean", "default": "false"} + intWithStringValue: {"type": "integer", "default": "4"} + numberWithIntValue: {"type": "number", "default": 5} + numberWithStringValue: {"type": "number", "default": "5.5"} + stringWithNumberValue: {"type": "string", "default": 6} + stringConst: {"type": "string", "const": "always", "default": "always"} + unionWithValidDefaultForType1: + anyOf: [{"type": "boolean"}, {"type": "integer"}] + default: true + unionWithValidDefaultForType2: + anyOf: [{"type": "boolean"}, {"type": "integer"}] + default: 3 +""") +@with_generated_code_imports(".models.MyModel") +class TestSimpleDefaults: + # Note, the null/None type is not covered here due to a known bug: + # https://github.com/openapi-generators/openapi-python-client/issues/1162 + def test_defaults_in_initializer(self, MyModel): + instance = MyModel() + assert instance == MyModel( + boolean_prop=True, + string_prop="a", + number_prop=1.5, + int_prop=2, + date_prop=datetime.date(2024, 1, 2), + date_time_prop=datetime.datetime(2024, 1, 2, 3, 4, 5, tzinfo=datetime.timezone.utc), + uuid_prop=uuid.UUID("07EF8B4D-AA09-4FFA-898D-C710796AFF41"), + any_prop_with_string="b", + any_prop_with_int=3, + boolean_with_string_true_1=True, + boolean_with_string_true_2=True, + boolean_with_string_false_1=False, + boolean_with_string_false_2=False, + int_with_string_value=4, + number_with_int_value=5, + number_with_string_value=5.5, + string_with_number_value="6", + string_const="always", + union_with_valid_default_for_type_1=True, + union_with_valid_default_for_type_2=3, + ) + + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "b"] + MyModel: + type: object + properties: + enumProp: + allOf: + - $ref: "#/components/schemas/MyEnum" + default: "a" + +""") +@with_generated_code_imports(".models.MyEnum", ".models.MyModel") +class TestEnumDefaults: + def test_enum_default(self, MyEnum, MyModel): + assert MyModel().enum_prop == MyEnum.A + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "A"] + MyModel: + properties: + enumProp: + allOf: + - $ref: "#/components/schemas/MyEnum" + default: A +""", + config="literal_enums: true", +) +@with_generated_code_imports(".models.MyModel") +class TestLiteralEnumDefaults: + def test_default_value(self, MyModel): + assert MyModel().enum_prop == "A" diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py b/end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py new file mode 100644 index 000000000..b49599a93 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_docstrings.py @@ -0,0 +1,163 @@ +from typing import Any + +from end_to_end_tests.functional_tests.helpers import ( + with_generated_code_import, + with_generated_client_fixture, +) + + +class DocstringParser: + lines: list[str] + + def __init__(self, item: Any): + self.lines = [line.lstrip() for line in item.__doc__.split("\n")] + + def get_section(self, header_line: str) -> list[str]: + lines = self.lines[self.lines.index(header_line)+1:] + return lines[0:lines.index("")] + + +@with_generated_client_fixture( +""" +components: + schemas: + MyModel: + description: I like this type. + type: object + properties: + reqStr: + type: string + description: This is necessary. + optStr: + type: string + description: This isn't necessary. + undescribedProp: + type: string + required: ["reqStr", "undescribedProp"] +""") +@with_generated_code_import(".models.MyModel") +class TestSchemaDocstrings: + def test_model_description(self, MyModel): + assert DocstringParser(MyModel).lines[0] == "I like this type." + + def test_model_properties(self, MyModel): + assert set(DocstringParser(MyModel).get_section("Attributes:")) == { + "req_str (str): This is necessary.", + "opt_str (str | Unset): This isn't necessary.", + "undescribed_prop (str):", + } + + +@with_generated_client_fixture( +""" +tags: + - name: service1 +paths: + "/simple": + get: + operationId: getSimpleThing + description: Get a simple thing. + responses: + "200": + description: Success! + content: + application/json: + schema: + $ref: "#/components/schemas/GoodResponse" + tags: + - service1 + post: + operationId: postSimpleThing + description: Post a simple thing. + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" + responses: + "200": + description: Success! + content: + application/json: + schema: + $ref: "#/components/schemas/GoodResponse" + "400": + description: Failure!! + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + tags: + - service1 + "/simple/{id}/{index}": + get: + operationId: getAttributeByIndex + description: Get a simple thing's attribute. + parameters: + - name: id + in: path + required: true + schema: + type: string + description: Which one. + - name: index + in: path + required: true + schema: + type: integer + - name: fries + in: query + required: false + schema: + type: boolean + description: Do you want fries with that? + responses: + "200": + description: Success! + content: + application/json: + schema: + $ref: "#/components/schemas/GoodResponse" + tags: + - service1 + +components: + schemas: + GoodResponse: + type: object + ErrorResponse: + type: object + Thing: + type: object + description: The thing. +""") +@with_generated_code_import(".api.service1.get_simple_thing.sync", alias="get_simple_thing_sync") +@with_generated_code_import(".api.service1.post_simple_thing.sync", alias="post_simple_thing_sync") +@with_generated_code_import(".api.service1.get_attribute_by_index.sync", alias="get_attribute_by_index_sync") +class TestEndpointDocstrings: + def test_description(self, get_simple_thing_sync): + assert DocstringParser(get_simple_thing_sync).lines[0] == "Get a simple thing." + + def test_response_single_type(self, get_simple_thing_sync): + assert DocstringParser(get_simple_thing_sync).get_section("Returns:") == [ + "GoodResponse", + ] + + def test_response_union_type(self, post_simple_thing_sync): + returns_line = DocstringParser(post_simple_thing_sync).get_section("Returns:")[0] + assert returns_line in ( + "GoodResponse | ErrorResponse", + "ErrorResponse | GoodResponse", + ) + + def test_request_body(self, post_simple_thing_sync): + assert DocstringParser(post_simple_thing_sync).get_section("Args:") == [ + "body (Thing): The thing." + ] + + def test_params(self, get_attribute_by_index_sync): + assert DocstringParser(get_attribute_by_index_sync).get_section("Args:") == [ + "id (str): Which one.", + "index (int):", + "fries (bool | Unset): Do you want fries with that?", + ] diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py b/end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py new file mode 100644 index 000000000..4bd0b2c81 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py @@ -0,0 +1,363 @@ +from typing import Literal +import pytest + +from end_to_end_tests.functional_tests.helpers import ( + assert_model_decode_encode, + assert_model_property_type_hint, + with_generated_client_fixture, + with_generated_code_imports, +) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "B", "a23", "123", "1bc", "a Thing WIth spaces", ""] + MyModel: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + inlineEnumProp: + type: string + enum: ["a", "b"] + MyModelWithRequired: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + required: ["enumProp"] +""") +@with_generated_code_imports( + ".models.MyEnum", + ".models.MyModel", + ".models.MyModelInlineEnumProp", + ".models.MyModelWithRequired", +) +class TestStringEnumClass: + @pytest.mark.parametrize( + "expected_name,expected_value", + [ + ("A", "a"), + ("B", "B"), + ("A23", "a23"), + ("VALUE_3", "123"), + ("VALUE_4", "1bc"), + ("A_THING_WITH_SPACES", "a Thing WIth spaces"), + ("VALUE_6", ""), + ], + ) + def test_enum_values(self, MyEnum, expected_name, expected_value): + assert getattr(MyEnum, expected_name) == MyEnum(expected_value) + + def test_enum_prop_in_object(self, MyEnum, MyModel, MyModelInlineEnumProp): + assert_model_decode_encode(MyModel, {"enumProp": "B"}, MyModel(enum_prop=MyEnum.B)) + assert_model_decode_encode( + MyModel, + {"inlineEnumProp": "a"}, + MyModel(inline_enum_prop=MyModelInlineEnumProp.A), + ) + + def test_type_hints(self, MyModel, MyModelWithRequired): + optional_type = "MyEnum | Unset" + assert_model_property_type_hint(MyModel,"enum_prop", optional_type) + assert_model_property_type_hint(MyModelWithRequired, "enum_prop", "MyEnum") + + def test_invalid_values(self, MyModel): + with pytest.raises(ValueError): + MyModel.from_dict({"enumProp": "c"}) + with pytest.raises(ValueError): + MyModel.from_dict({"enumProp": "A"}) + with pytest.raises(ValueError): + MyModel.from_dict({"enumProp": 2}) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: integer + enum: [2, 3, -4] + MyModel: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + inlineEnumProp: + type: string + enum: [2, 3] + MyModelWithRequired: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + required: ["enumProp"] +""") +@with_generated_code_imports( + ".models.MyEnum", + ".models.MyModel", + ".models.MyModelInlineEnumProp", + ".models.MyModelWithRequired", +) +class TestIntEnumClass: + @pytest.mark.parametrize( + "expected_name,expected_value", + [ + ("VALUE_2", 2), + ("VALUE_3", 3), + ("VALUE_NEGATIVE_4", -4), + ], + ) + def test_enum_values(self, MyEnum, expected_name, expected_value): + assert getattr(MyEnum, expected_name) == MyEnum(expected_value) + + def test_enum_prop_in_object(self, MyEnum, MyModel, MyModelInlineEnumProp): + assert_model_decode_encode(MyModel, {"enumProp": 2}, MyModel(enum_prop=MyEnum.VALUE_2)) + assert_model_decode_encode( + MyModel, + {"inlineEnumProp": 2}, + MyModel(inline_enum_prop=MyModelInlineEnumProp.VALUE_2), + ) + + def test_type_hints(self, MyModel, MyModelWithRequired): + optional_type = "MyEnum | Unset" + assert_model_property_type_hint(MyModel,"enum_prop", optional_type) + assert_model_property_type_hint(MyModelWithRequired, "enum_prop", "MyEnum") + + def test_invalid_values(self, MyModel): + with pytest.raises(ValueError): + MyModel.from_dict({"enumProp": 5}) + with pytest.raises(ValueError): + MyModel.from_dict({"enumProp": "a"}) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: integer + enum: [2, 3, -4] + x-enum-varnames: [ + "Two", + "Three", + "Negative Four" + ] +""") +@with_generated_code_imports( + ".models.MyEnum", +) +class TestIntEnumVarNameExtensions: + @pytest.mark.parametrize( + "expected_name,expected_value", + [ + ("TWO", 2), + ("THREE", 3), + ("NEGATIVE_FOUR", -4), + ], + ) + def test_enum_values(self, MyEnum, expected_name, expected_value): + assert getattr(MyEnum, expected_name) == MyEnum(expected_value) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "b"] + MyEnumIncludingNull: + type: ["string", "null"] + enum: ["a", "b", null] + MyNullOnlyEnum: + enum: [null] + MyModel: + properties: + nullableEnumProp: + oneOf: + - {"$ref": "#/components/schemas/MyEnum"} + - type: "null" + enumIncludingNullProp: {"$ref": "#/components/schemas/MyEnumIncludingNull"} + nullOnlyEnumProp: {"$ref": "#/components/schemas/MyNullOnlyEnum"} +""") +@with_generated_code_imports( + ".models.MyEnum", + ".models.MyEnumIncludingNullType1", # see comment in test_nullable_enum_prop + ".models.MyModel", +) +class TestNullableEnums: + def test_nullable_enum_prop(self, MyModel, MyEnum, MyEnumIncludingNullType1): + # Note, MyEnumIncludingNullType1 should be named just MyEnumIncludingNull - + # known bug: https://github.com/openapi-generators/openapi-python-client/issues/1120 + assert_model_decode_encode(MyModel, {"nullableEnumProp": "b"}, MyModel(nullable_enum_prop=MyEnum.B)) + assert_model_decode_encode(MyModel, {"nullableEnumProp": None}, MyModel(nullable_enum_prop=None)) + assert_model_decode_encode( + MyModel, + {"enumIncludingNullProp": "a"}, + MyModel(enum_including_null_prop=MyEnumIncludingNullType1.A), + ) + assert_model_decode_encode( MyModel, {"enumIncludingNullProp": None}, MyModel(enum_including_null_prop=None)) + assert_model_decode_encode(MyModel, {"nullOnlyEnumProp": None}, MyModel(null_only_enum_prop=None)) + + def test_type_hints(self, MyModel): + expected_type = "MyEnum | None | Unset" + assert_model_property_type_hint(MyModel, "nullable_enum_prop", expected_type) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyModel: + properties: + mustBeErnest: + const: Ernest + mustBeThirty: + const: 30 +""", +) +@with_generated_code_imports(".models.MyModel") +class TestConst: + def test_valid_string(self, MyModel): + assert_model_decode_encode( + MyModel, + {"mustBeErnest": "Ernest"}, + MyModel(must_be_ernest="Ernest"), + ) + + def test_valid_int(self, MyModel): + assert_model_decode_encode( + MyModel, + {"mustBeThirty": 30}, + MyModel(must_be_thirty=30), + ) + + def test_invalid_string(self, MyModel): + with pytest.raises(ValueError): + MyModel.from_dict({"mustBeErnest": "Jack"}) + + def test_invalid_int(self, MyModel): + with pytest.raises(ValueError): + MyModel.from_dict({"mustBeThirty": 29}) + + +# The following tests of literal enums use basically the same specs as the tests above, but +# the "literal_enums" option is enabled in the test configuration. + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "A", "b"] + MyModel: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + inlineEnumProp: + type: string + enum: ["a", "b"] + MyModelWithRequired: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + required: ["enumProp"] +""", + config="literal_enums: true", +) +@with_generated_code_imports( + ".models.MyModel", + ".models.MyModelWithRequired", + ".models.MyEnum", +) +class TestStringLiteralEnum: + def test_enum_prop(self, MyModel): + assert_model_decode_encode(MyModel, {"enumProp": "a"}, MyModel(enum_prop="a")) + assert_model_decode_encode(MyModel, {"enumProp": "A"}, MyModel(enum_prop="A")) + assert_model_decode_encode(MyModel, {"inlineEnumProp": "a"}, MyModel(inline_enum_prop="a")) + + def test_type_hints(self, MyModel, MyModelWithRequired, MyEnum): + optional_type = "MyEnum | Unset" + assert_model_property_type_hint(MyModel, "enum_prop", optional_type) + assert_model_property_type_hint(MyModelWithRequired, "enum_prop", "MyEnum") + assert MyEnum == Literal["a", "A", "b"] + + def test_invalid_values(self, MyModel): + with pytest.raises(TypeError): + MyModel.from_dict({"enumProp": "c"}) + with pytest.raises(TypeError): + MyModel.from_dict({"enumProp": 2}) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: integer + enum: [2, 3, -4] + MyModel: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + inlineEnumProp: + type: string + enum: [2, 3] + MyModelWithRequired: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + required: ["enumProp"] +""", + config="literal_enums: true", +) +@with_generated_code_imports( + ".models.MyModel", + ".models.MyModelWithRequired", + ".models.MyEnum", +) +class TestIntLiteralEnum: + def test_enum_prop(self, MyModel): + assert_model_decode_encode(MyModel, {"enumProp": 2}, MyModel(enum_prop=2)) + assert_model_decode_encode(MyModel, {"enumProp": -4}, MyModel(enum_prop=-4)) + assert_model_decode_encode(MyModel, {"inlineEnumProp": 2}, MyModel(inline_enum_prop=2)) + + def test_type_hints(self, MyModel, MyModelWithRequired, MyEnum): + optional_type = "MyEnum | Unset" + assert_model_property_type_hint(MyModel, "enum_prop", optional_type) + assert_model_property_type_hint(MyModelWithRequired, "enum_prop", "MyEnum") + assert MyEnum == Literal[2, 3, -4] + + def test_invalid_values(self, MyModel): + with pytest.raises(TypeError): + MyModel.from_dict({"enumProp": 4}) + with pytest.raises(TypeError): + MyModel.from_dict({"enumProp": "a"}) + + +@with_generated_client_fixture( +""" +components: + schemas: + MyEnum: + type: string + enum: ["a", "A"] + MyEnumIncludingNull: + type: ["string", "null"] + enum: ["a", "b", null] + MyNullOnlyEnum: + enum: [null] + MyModel: + properties: + enumProp: {"$ref": "#/components/schemas/MyEnum"} + nullableEnumProp: + oneOf: + - {"$ref": "#/components/schemas/MyEnum"} + - type: "null" + enumIncludingNullProp: {"$ref": "#/components/schemas/MyEnumIncludingNull"} + nullOnlyEnumProp: {"$ref": "#/components/schemas/MyNullOnlyEnum"} +""", + config="literal_enums: true", +) +@with_generated_code_imports(".models.MyModel") +class TestNullableLiteralEnum: + def test_nullable_enum_prop(self, MyModel): + assert_model_decode_encode(MyModel, {"nullableEnumProp": "B"}, MyModel(nullable_enum_prop="B")) + assert_model_decode_encode(MyModel, {"nullableEnumProp": None}, MyModel(nullable_enum_prop=None)) + assert_model_decode_encode(MyModel, {"enumIncludingNullProp": "a"}, MyModel(enum_including_null_prop="a")) + assert_model_decode_encode(MyModel, {"enumIncludingNullProp": None}, MyModel(enum_including_null_prop=None)) + assert_model_decode_encode(MyModel, {"nullOnlyEnumProp": None}, MyModel(null_only_enum_prop=None)) diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py b/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py new file mode 100644 index 000000000..694788d96 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_path_parameters.py @@ -0,0 +1,151 @@ +from unittest.mock import MagicMock + +import httpx +import pytest + +from end_to_end_tests.functional_tests.helpers import ( + with_generated_client_fixture, + with_generated_code_import, +) + + +@with_generated_client_fixture( +""" +paths: + "/items/{item_id}/details/{detail_id}": + get: + operationId: getItemDetail + parameters: + - name: item_id + in: path + required: true + schema: + type: string + - name: detail_id + in: path + required: true + schema: + type: string + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + properties: + id: + type: string +""") +@with_generated_code_import(".api.default.get_item_detail.sync_detailed") +@with_generated_code_import(".client.Client") +class TestPathParameterEncoding: + """Test that path parameters are properly URL-encoded""" + + def test_path_params_with_normal_chars_work(self, sync_detailed, Client): + """Test that normal alphanumeric path parameters still work correctly""" + mock_httpx_client = MagicMock(spec=httpx.Client) + mock_response = MagicMock(spec=httpx.Response) + mock_response.status_code = 200 + mock_response.json.return_value = {"id": "test"} + mock_response.content = b'{"id": "test"}' + mock_response.headers = {} + mock_httpx_client.request.return_value = mock_response + + client = Client(base_url="https://api.example.com") + client.set_httpx_client(mock_httpx_client) + + sync_detailed( + item_id="item123", + detail_id="detail456", + client=client, + ) + + mock_httpx_client.request.assert_called_once() + call_kwargs = mock_httpx_client.request.call_args[1] + + # Normal characters should remain unchanged + expected_url = "/items/item123/details/detail456" + assert call_kwargs["url"] == expected_url + + def test_path_params_with_reserved_chars_are_encoded(self, sync_detailed, Client): + """Test that path parameters with reserved characters are properly URL-encoded""" + # Create a mock httpx client + mock_httpx_client = MagicMock(spec=httpx.Client) + mock_response = MagicMock(spec=httpx.Response) + mock_response.status_code = 200 + mock_response.json.return_value = {"id": "test"} + mock_response.content = b'{"id": "test"}' + mock_response.headers = {} + mock_httpx_client.request.return_value = mock_response + + # Create a client with the mock httpx client + client = Client(base_url="https://api.example.com") + client.set_httpx_client(mock_httpx_client) + + # Call the endpoint with path parameters containing reserved characters + sync_detailed( + item_id="item/with/slashes", + detail_id="detail?with=query&chars", + client=client, + ) + + # Verify the request was made with properly encoded URL + mock_httpx_client.request.assert_called_once() + call_kwargs = mock_httpx_client.request.call_args[1] + + # The URL should have encoded slashes and query characters + expected_url = "/items/item%2Fwith%2Fslashes/details/detail%3Fwith%3Dquery%26chars" + assert call_kwargs["url"] == expected_url + + def test_path_params_with_spaces_are_encoded(self, sync_detailed, Client): + """Test that path parameters with spaces are properly URL-encoded""" + mock_httpx_client = MagicMock(spec=httpx.Client) + mock_response = MagicMock(spec=httpx.Response) + mock_response.status_code = 200 + mock_response.json.return_value = {"id": "test"} + mock_response.content = b'{"id": "test"}' + mock_response.headers = {} + mock_httpx_client.request.return_value = mock_response + + client = Client(base_url="https://api.example.com") + client.set_httpx_client(mock_httpx_client) + + sync_detailed( + item_id="item with spaces", + detail_id="detail with spaces", + client=client, + ) + + mock_httpx_client.request.assert_called_once() + call_kwargs = mock_httpx_client.request.call_args[1] + + # Spaces should be encoded as %20 + expected_url = "/items/item%20with%20spaces/details/detail%20with%20spaces" + assert call_kwargs["url"] == expected_url + + def test_path_params_with_hash_are_encoded(self, sync_detailed, Client): + """Test that path parameters with hash/fragment characters are properly URL-encoded""" + mock_httpx_client = MagicMock(spec=httpx.Client) + mock_response = MagicMock(spec=httpx.Response) + mock_response.status_code = 200 + mock_response.json.return_value = {"id": "test"} + mock_response.content = b'{"id": "test"}' + mock_response.headers = {} + mock_httpx_client.request.return_value = mock_response + + client = Client(base_url="https://api.example.com") + client.set_httpx_client(mock_httpx_client) + + sync_detailed( + item_id="item#1", + detail_id="detail#id", + client=client, + ) + + mock_httpx_client.request.assert_called_once() + call_kwargs = mock_httpx_client.request.call_args[1] + + # Hash should be encoded as %23 + expected_url = "/items/item%231/details/detail%23id" + assert call_kwargs["url"] == expected_url diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_properties.py b/end_to_end_tests/functional_tests/generated_code_execution/test_properties.py new file mode 100644 index 000000000..948293bba --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_properties.py @@ -0,0 +1,242 @@ +import datetime +import uuid +import pytest + +from end_to_end_tests.functional_tests.helpers import ( + assert_model_decode_encode, + assert_model_property_type_hint, + with_generated_client_fixture, + with_generated_code_imports, +) + + +@with_generated_client_fixture( + """ +components: + schemas: + MyModel: + type: object + properties: + req1: {"type": "string"} + req2: {"type": "string"} + opt: {"type": "string"} + required: ["req1", "req2"] + DerivedModel: + allOf: + - $ref: "#/components/schemas/MyModel" + - type: object + properties: + req3: {"type": "string"} + required: ["req3"] +""" +) +@with_generated_code_imports( + ".models.MyModel", + ".models.DerivedModel", + ".types.Unset", +) +class TestRequiredAndOptionalProperties: + def test_required_ok(self, MyModel, DerivedModel): + assert_model_decode_encode( + MyModel, + {"req1": "a", "req2": "b"}, + MyModel(req1="a", req2="b"), + ) + assert_model_decode_encode( + DerivedModel, + {"req1": "a", "req2": "b", "req3": "c"}, + DerivedModel(req1="a", req2="b", req3="c"), + ) + + def test_required_and_optional(self, MyModel, DerivedModel): + assert_model_decode_encode( + MyModel, + {"req1": "a", "req2": "b", "opt": "c"}, + MyModel(req1="a", req2="b", opt="c"), + ) + assert_model_decode_encode( + DerivedModel, + {"req1": "a", "req2": "b", "req3": "c", "opt": "d"}, + DerivedModel(req1="a", req2="b", req3="c", opt="d"), + ) + + def test_required_missing(self, MyModel, DerivedModel): + with pytest.raises(KeyError): + MyModel.from_dict({"req1": "a"}) + with pytest.raises(KeyError): + MyModel.from_dict({"req2": "b"}) + with pytest.raises(KeyError): + DerivedModel.from_dict({"req1": "a", "req2": "b"}) + + def test_type_hints(self, MyModel): + assert_model_property_type_hint(MyModel, "req1", "str") + assert_model_property_type_hint(MyModel, "opt", "str | Unset") + + +@with_generated_client_fixture( + """ +components: + schemas: + MyModel: + type: object + properties: + booleanProp: {"type": "boolean"} + stringProp: {"type": "string"} + numberProp: {"type": "number"} + intProp: {"type": "integer"} + anyObjectProp: {"$ref": "#/components/schemas/AnyObject"} + nullProp: {"type": "null"} + anyProp: {} + AnyObject: + type: object +""" +) +@with_generated_code_imports( + ".models.MyModel", + ".models.AnyObject", +) +class TestBasicModelProperties: + def test_decode_encode(self, MyModel, AnyObject): + json_data = { + "booleanProp": True, + "stringProp": "a", + "numberProp": 1.5, + "intProp": 2, + "anyObjectProp": {"d": 3}, + "nullProp": None, + "anyProp": "e", + } + expected_any_object = AnyObject() + expected_any_object.additional_properties = {"d": 3} + assert_model_decode_encode( + MyModel, + json_data, + MyModel( + boolean_prop=True, + string_prop="a", + number_prop=1.5, + int_prop=2, + any_object_prop=expected_any_object, + null_prop=None, + any_prop="e", + ), + ) + + @pytest.mark.parametrize( + "bad_data", + ["a", True, 2, None], + ) + def test_decode_error_not_object(self, bad_data, MyModel): + with pytest.raises(Exception): + # Exception is overly broad, but unfortunately in the current implementation, the error + # being raised is AttributeError (because it tries to call bad_data.copy()) which isn't + # very meaningful + MyModel.from_dict(bad_data) + + def test_type_hints(self, MyModel): + assert_model_property_type_hint(MyModel, "boolean_prop", "bool | Unset") + assert_model_property_type_hint(MyModel, "string_prop", "str | Unset") + assert_model_property_type_hint(MyModel, "number_prop", "float | Unset") + assert_model_property_type_hint(MyModel, "int_prop", "int | Unset") + assert_model_property_type_hint(MyModel, "any_object_prop", "AnyObject | Unset") + assert_model_property_type_hint(MyModel, "null_prop", "None | Unset") + assert_model_property_type_hint(MyModel, "any_prop", "Any | Unset") + + +@with_generated_client_fixture( + """ +components: + schemas: + MyModel: + type: object + properties: + dateProp: {"type": "string", "format": "date"} + dateTimeProp: {"type": "string", "format": "date-time"} + uuidProp: {"type": "string", "format": "uuid"} + unknownFormatProp: {"type": "string", "format": "weird"} +""" +) +@with_generated_code_imports( + ".models.MyModel", +) +class TestSpecialStringFormats: + def test_date(self, MyModel): + date_value = datetime.date.today() + json_data = {"dateProp": date_value.isoformat()} + assert_model_decode_encode(MyModel, json_data, MyModel(date_prop=date_value)) + + def test_date_time(self, MyModel): + date_time_value = datetime.datetime.now(datetime.timezone.utc) + json_data = {"dateTimeProp": date_time_value.isoformat()} + assert_model_decode_encode(MyModel, json_data, MyModel(date_time_prop=date_time_value)) + + def test_uuid(self, MyModel): + uuid_value = uuid.uuid1() + json_data = {"uuidProp": str(uuid_value)} + assert_model_decode_encode(MyModel, json_data, MyModel(uuid_prop=uuid_value)) + + def test_unknown_format(self, MyModel): + json_data = {"unknownFormatProp": "whatever"} + assert_model_decode_encode(MyModel, json_data, MyModel(unknown_format_prop="whatever")) + + def test_type_hints(self, MyModel): + assert_model_property_type_hint(MyModel, "date_prop", "datetime.date | Unset") + assert_model_property_type_hint(MyModel, "date_time_prop", "datetime.datetime | Unset") + assert_model_property_type_hint(MyModel, "uuid_prop", "UUID | Unset") + assert_model_property_type_hint(MyModel, "unknown_format_prop", "str | Unset") + + +@with_generated_client_fixture( + """ +components: + schemas: + MyModel: + type: object + properties: + booleanProp: {"type": "boolean"} + stringProp: {"type": "string"} + numberProp: {"type": "number"} + intProp: {"type": "integer"} + anyObjectProp: {"$ref": "#/components/schemas/AnyObject"} + nullProp: {"type": "null"} + anyProp: {} + AnyObject: + $ref: "#/components/schemas/OtherObject" + OtherObject: + $ref: "#/components/schemas/AnotherObject" + AnotherObject: + type: object + properties: + booleanProp: {"type": "boolean"} + +""" +) +@with_generated_code_imports( + ".models.MyModel", + ".models.AnyObject", + ".types.Unset", +) +class TestReferenceSchemaProperties: + def test_decode_encode(self, MyModel, AnyObject): + json_data = { + "booleanProp": True, + "stringProp": "a", + "numberProp": 1.5, + "intProp": 2, + "anyObjectProp": {"booleanProp": False}, + "nullProp": None, + "anyProp": "e", + } + assert_model_decode_encode( + MyModel, + json_data, + MyModel( + boolean_prop=True, + string_prop="a", + number_prop=1.5, + int_prop=2, + any_object_prop=AnyObject(boolean_prop=False), + null_prop=None, + any_prop="e", + ), + ) diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_unions.py b/end_to_end_tests/functional_tests/generated_code_execution/test_unions.py new file mode 100644 index 000000000..27dc7430e --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_unions.py @@ -0,0 +1,146 @@ +from end_to_end_tests.functional_tests.helpers import ( + assert_model_decode_encode, + assert_model_property_type_hint, + with_generated_client_fixture, + with_generated_code_imports, +) + + +@with_generated_client_fixture( +""" +components: + schemas: + StringOrInt: + type: ["string", "integer"] + MyModel: + type: object + properties: + stringOrIntProp: + type: ["string", "integer"] +""" +) +@with_generated_code_imports( + ".models.MyModel", +) +class TestSimpleTypeList: + def test_decode_encode(self, MyModel): + assert_model_decode_encode(MyModel, {"stringOrIntProp": "a"}, MyModel(string_or_int_prop="a")) + assert_model_decode_encode(MyModel, {"stringOrIntProp": 1}, MyModel(string_or_int_prop=1)) + + def test_type_hints(self, MyModel): + assert_model_property_type_hint(MyModel, "string_or_int_prop", "int | str | Unset") + + +@with_generated_client_fixture( +""" +components: + schemas: + ThingA: + type: object + properties: + propA: { type: "string" } + required: ["propA"] + ThingB: + type: object + properties: + propB: { type: "string" } + required: ["propB"] + ThingAOrB: + oneOf: + - $ref: "#/components/schemas/ThingA" + - $ref: "#/components/schemas/ThingB" + ModelWithUnion: + type: object + properties: + thing: {"$ref": "#/components/schemas/ThingAOrB"} + thingOrString: + oneOf: + - $ref: "#/components/schemas/ThingA" + - type: string + ModelWithRequiredUnion: + type: object + properties: + thing: {"$ref": "#/components/schemas/ThingAOrB"} + required: ["thing"] + ModelWithNestedUnion: + type: object + properties: + thingOrValue: + oneOf: + - "$ref": "#/components/schemas/ThingAOrB" + - oneOf: + - type: string + - type: number + ModelWithUnionOfOne: + type: object + properties: + thing: + oneOf: + - $ref: "#/components/schemas/ThingA" + requiredThing: + oneOf: + - $ref: "#/components/schemas/ThingA" + required: ["requiredThing"] +""") +@with_generated_code_imports( + ".models.ThingA", + ".models.ThingB", + ".models.ModelWithUnion", + ".models.ModelWithRequiredUnion", + ".models.ModelWithNestedUnion", + ".models.ModelWithUnionOfOne", +) +class TestOneOf: + def test_disambiguate_objects_via_required_properties(self, ThingA, ThingB, ModelWithUnion): + assert_model_decode_encode( + ModelWithUnion, + {"thing": {"propA": "x"}}, + ModelWithUnion(thing=ThingA(prop_a="x")), + ) + assert_model_decode_encode( + ModelWithUnion, + {"thing": {"propB": "x"}}, + ModelWithUnion(thing=ThingB(prop_b="x")), + ) + + def test_disambiguate_object_and_non_object(self, ThingA, ModelWithUnion): + assert_model_decode_encode( + ModelWithUnion, + {"thingOrString": {"propA": "x"}}, + ModelWithUnion(thing_or_string=ThingA(prop_a="x")), + ) + assert_model_decode_encode( + ModelWithUnion, + {"thingOrString": "x"}, + ModelWithUnion(thing_or_string="x"), + ) + + def test_disambiguate_nested_union(self, ThingA, ThingB, ModelWithNestedUnion): + assert_model_decode_encode( + ModelWithNestedUnion, + {"thingOrValue": {"propA": "x"}}, + ModelWithNestedUnion(thing_or_value=ThingA(prop_a="x")), + ) + assert_model_decode_encode( + ModelWithNestedUnion, + {"thingOrValue": 3}, + ModelWithNestedUnion(thing_or_value=3), + ) + + def test_type_hints(self, ModelWithUnion, ModelWithRequiredUnion, ModelWithUnionOfOne, ThingA): + assert_model_property_type_hint( + ModelWithUnion, + "thing", + "ThingA | ThingB | Unset", + ) + assert_model_property_type_hint( + ModelWithRequiredUnion, + "thing", + "ThingA | ThingB", + ) + assert_model_property_type_hint( + ModelWithUnionOfOne, "thing", "ThingA | Unset" + ) + assert_model_property_type_hint( + ModelWithUnionOfOne, "required_thing", "ThingA" + ) diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_arrays.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_arrays.py new file mode 100644 index 000000000..e4ef0cffd --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_arrays.py @@ -0,0 +1,23 @@ +import pytest + +from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture + + +@with_generated_client_fixture( +""" +components: + schemas: + ArrayWithNoItems: + type: array + ArrayWithInvalidItemsRef: + type: array + items: + $ref: "#/components/schemas/DoesntExist" +""" +) +class TestArrayInvalidSchemas: + def test_no_items(self, generated_client): + assert_bad_schema(generated_client, "ArrayWithNoItems", "must have items or prefixItems defined") + + def test_invalid_items_ref(self, generated_client): + assert_bad_schema(generated_client, "ArrayWithInvalidItemsRef", "invalid data in items of array") diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_defaults.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_defaults.py new file mode 100644 index 000000000..93f5e11d4 --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_defaults.py @@ -0,0 +1,88 @@ +import pytest + +from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture + + +@with_generated_client_fixture( +""" +components: + schemas: + WithBadBoolean: + properties: + badBoolean: {"type": "boolean", "default": "not a boolean"} + WithBadIntAsString: + properties: + badInt: {"type": "integer", "default": "not an int"} + WithBadIntAsOther: + properties: + badInt: {"type": "integer", "default": true} + WithBadFloatAsString: + properties: + badInt: {"type": "number", "default": "not a number"} + WithBadFloatAsOther: + properties: + badInt: {"type": "number", "default": true} + WithBadDateAsString: + properties: + badDate: {"type": "string", "format": "date", "default": "xxx"} + WithBadDateAsOther: + properties: + badDate: {"type": "string", "format": "date", "default": 3} + WithBadDateTimeAsString: + properties: + badDate: {"type": "string", "format": "date-time", "default": "xxx"} + WithBadDateTimeAsOther: + properties: + badDate: {"type": "string", "format": "date-time", "default": 3} + WithBadUuidAsString: + properties: + badUuid: {"type": "string", "format": "uuid", "default": "xxx"} + WithBadUuidAsOther: + properties: + badUuid: {"type": "string", "format": "uuid", "default": 3} + WithBadEnum: + properties: + badEnum: {"type": "string", "enum": ["a", "b"], "default": "x"} + GoodEnum: + type: string + enum: ["a", "b"] + OverriddenEnumWithBadDefault: + properties: + badEnum: + allOf: + - $ref: "#/components/schemas/GoodEnum" + default: "x" + UnionWithNoValidDefault: + properties: + badBoolOrInt: + anyOf: + - type: boolean + - type: integer + default: "xxx" +""" +) +class TestInvalidDefaultValues: + # Note, the null/None type, and binary strings (files), are not covered here due to a known bug: + # https://github.com/openapi-generators/openapi-python-client/issues/1162 + + @pytest.mark.parametrize( + ("model_name", "message"), + [ + ("WithBadBoolean", "Invalid boolean value"), + ("WithBadIntAsString", "Invalid int value"), + ("WithBadIntAsOther", "Invalid int value"), + ("WithBadFloatAsString", "Invalid float value"), + ("WithBadFloatAsOther", "Cannot convert True to a float"), + ("WithBadDateAsString", "Invalid date"), + ("WithBadDateAsOther", "Cannot convert 3 to a date"), + ("WithBadDateTimeAsString", "Invalid datetime"), + ("WithBadDateTimeAsOther", "Cannot convert 3 to a datetime"), + ("WithBadUuidAsString", "Invalid UUID value"), + ("WithBadUuidAsOther", "Invalid UUID value"), + ("WithBadEnum", "Value x is not valid for enum"), + ("OverriddenEnumWithBadDefault", "Value x is not valid for enum"), + ("UnionWithNoValidDefault", "Invalid int value"), + ] + ) + def test_bad_default_warning(self, model_name, message, generated_client): + assert_bad_schema(generated_client, model_name, message) diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py new file mode 100644 index 000000000..7f1586f29 --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_enums_and_consts.py @@ -0,0 +1,128 @@ +from end_to_end_tests.functional_tests.helpers import ( + assert_bad_schema, + inline_spec_should_fail, + with_generated_client_fixture, +) + + +@with_generated_client_fixture( +""" +components: + schemas: + WithBadDefaultValue: + enum: ["A"] + default: "B" + WithBadDefaultType: + enum: ["A"] + default: 123 + WithMixedTypes: + enum: ["A", 1] + WithUnsupportedType: + enum: [1.4, 1.5] + DefaultNotMatchingConst: + const: "aaa" + default: "bbb" + WithConflictingInlineNames: + type: object + properties: + "12": + enum: ["a", "b"] + WithConflictingInlineNames1: + type: object + properties: + "2": + enum: ["c", "d"] +""" +) +class TestEnumAndConstInvalidSchemas: + def test_enum_bad_default_value(self, generated_client): + assert_bad_schema(generated_client, "WithBadDefaultValue", "Value B is not valid") + + def test_enum_bad_default_type(self, generated_client): + assert_bad_schema(generated_client, "WithBadDefaultType", "Cannot convert 123 to enum") + + def test_enum_mixed_types(self, generated_client): + assert_bad_schema(generated_client, "WithMixedTypes", "Enum values must all be the same type") + + def test_enum_unsupported_type(self, generated_client): + assert_bad_schema(generated_client, "WithUnsupportedType", "Unsupported enum type") + + def test_const_default_not_matching(self, generated_client): + assert_bad_schema(generated_client, "DefaultNotMatchingConst", "Invalid value for const") + + def test_conflicting_inline_class_names(self, generated_client): + assert "Found conflicting enums named WithConflictingInlineNames12 with incompatible values" in generated_client.generator_result.output + + def test_enum_duplicate_values(self): + # This one currently causes a full generator failure rather than a warning + result = inline_spec_should_fail( +""" +components: + schemas: + WithDuplicateValues: + enum: ["x", "x"] +""" + ) + assert "Duplicate key X in enum" in str(result.exception) + + +@with_generated_client_fixture( +""" +components: + schemas: + WithBadDefaultValue: + enum: ["A"] + default: "B" + WithBadDefaultType: + enum: ["A"] + default: 123 + WithMixedTypes: + enum: ["A", 1] + WithUnsupportedType: + enum: [1.4, 1.5] + DefaultNotMatchingConst: + const: "aaa" + default: "bbb" + WithConflictingInlineNames: + type: object + properties: + "12": + enum: ["a", "b"] + WithConflictingInlineNames1: + type: object + properties: + "2": + enum: ["c", "d"] +""", + config="literal_enums: true", +) +class TestLiteralEnumInvalidSchemas: + def test_literal_enum_bad_default_value(self, generated_client): + assert_bad_schema(generated_client, "WithBadDefaultValue", "Value B is not valid") + + def test_literal_enum_bad_default_type(self, generated_client): + assert_bad_schema(generated_client, "WithBadDefaultType", "Cannot convert 123 to enum") + + def test_literal_enum_mixed_types(self, generated_client): + assert_bad_schema(generated_client, "WithMixedTypes", "Enum values must all be the same type") + + def test_literal_enum_unsupported_type(self, generated_client): + assert_bad_schema(generated_client, "WithUnsupportedType", "Unsupported enum type") + + def test_const_default_not_matching(self, generated_client): + assert_bad_schema(generated_client, "DefaultNotMatchingConst", "Invalid value for const") + + def test_conflicting_inline_literal_enum_names(self, generated_client): + assert "Found conflicting enums named WithConflictingInlineNames12 with incompatible values" in generated_client.generator_result.output + + def test_literal_enum_duplicate_values(self): + # This one currently causes a full generator failure rather than a warning + result = inline_spec_should_fail( +""" +components: + schemas: + WithDuplicateValues: + enum: ["x", "x"] +""" + ) + assert "Duplicate key X in enum" in str(result.exception) diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_references.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_references.py new file mode 100644 index 000000000..9f609eef2 --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_references.py @@ -0,0 +1,29 @@ +import pytest + +from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture + + +@with_generated_client_fixture( + """ +components: + schemas: + MyModel: + type: object + properties: + booleanProp: {"type": "boolean"} + stringProp: {"type": "string"} + numberProp: {"type": "number"} + intProp: {"type": "integer"} + anyObjectProp: {"$ref": "#/components/schemas/AnyObject"} + nullProp: {"type": "null"} + anyProp: {} + AnyObject: + $ref: "#/components/schemas/OtherObject" + OtherObject: + $ref: "#/components/schemas/AnyObject" + +""" +) +class TestReferenceSchemaProperties: + def test_decode_encode(self, generated_client): + assert "Circular schema references found" in generated_client.generator_result.stderr diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_spec_format.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_spec_format.py new file mode 100644 index 000000000..2b0dfdda9 --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_spec_format.py @@ -0,0 +1,86 @@ +import pytest +from end_to_end_tests.functional_tests.helpers import ( + inline_spec_should_fail, +) + + +class TestInvalidSpecFormats: + @pytest.mark.parametrize( + ("filename_suffix", "content", "expected_error"), + ( + (".yaml", "not a valid openapi document", "Failed to parse OpenAPI document"), + (".json", "Invalid JSON", "Invalid JSON"), + (".yaml", "{", "Invalid YAML"), + ), + ids=("invalid_openapi", "invalid_json", "invalid_yaml"), + ) + def test_unparseable_file(self, filename_suffix, content, expected_error): + result = inline_spec_should_fail(content, filename_suffix=filename_suffix, add_missing_sections=False) + assert expected_error in result.output + + def test_missing_openapi_version(self): + result = inline_spec_should_fail( +""" +info: + title: My API + version: "1.0" +paths: {} +""", + add_missing_sections=False, + ) + for text in ["Failed to parse OpenAPI document", "1 validation error", "openapi"]: + assert text in result.output + + def test_missing_title(self): + result = inline_spec_should_fail( +""" +info: + version: "1.0" +openapi: "3.1.0" +paths: {} +""", + add_missing_sections=False, + ) + for text in ["Failed to parse OpenAPI document", "1 validation error", "title"]: + assert text in result.output + + def test_missing_version(self): + result = inline_spec_should_fail( +""" +info: + title: My API +openapi: "3.1.0" +paths: {} +""", + add_missing_sections=False, + ) + for text in ["Failed to parse OpenAPI document", "1 validation error", "version"]: + assert text in result.output + + def test_missing_paths(self): + result = inline_spec_should_fail( +""" +info: + title: My API + version: "1.0" +openapi: "3.1.0" +""", + add_missing_sections=False, + ) + for text in ["Failed to parse OpenAPI document", "1 validation error", "paths"]: + assert text in result.output + + def test_swagger_unsupported(self): + result = inline_spec_should_fail( +""" +swagger: "2.0" +info: + title: My API + version: "1.0" +openapi: "3.1" +paths: {} +components: {} +""", + add_missing_sections=False, + ) + assert "You may be trying to use a Swagger document; this is not supported by this project." in result.output diff --git a/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py new file mode 100644 index 000000000..75621a094 --- /dev/null +++ b/end_to_end_tests/functional_tests/generator_failure_cases/test_invalid_unions.py @@ -0,0 +1,28 @@ +from end_to_end_tests.functional_tests.helpers import assert_bad_schema, with_generated_client_fixture + + +@with_generated_client_fixture( +""" +components: + schemas: + UnionWithInvalidReference: + anyOf: + - $ref: "#/components/schemas/DoesntExist" + UnionWithInvalidDefault: + type: ["number", "integer"] + default: aaa + UnionWithMalformedVariant: + anyOf: + - type: string + - type: array # invalid because no items +""" +) +class TestUnionInvalidSchemas: + def test_invalid_reference(self, generated_client): + assert_bad_schema(generated_client, "UnionWithInvalidReference", "Could not find reference") + + def test_invalid_default(self, generated_client): + assert_bad_schema(generated_client, "UnionWithInvalidDefault", "Invalid int value: aaa") + + def test_invalid_property(self, generated_client): + assert_bad_schema(generated_client, "UnionWithMalformedVariant", "Invalid property in union") diff --git a/end_to_end_tests/functional_tests/helpers.py b/end_to_end_tests/functional_tests/helpers.py new file mode 100644 index 000000000..54aefffe1 --- /dev/null +++ b/end_to_end_tests/functional_tests/helpers.py @@ -0,0 +1,134 @@ +from typing import Any, Dict +import re + +from click.testing import Result +import pytest + +from end_to_end_tests.generated_client import generate_client_from_inline_spec, GeneratedClientContext + + +def with_generated_client_fixture( + openapi_spec: str, + name: str="generated_client", + config: str="", + extra_args: list[str] = [], +): + """Decorator to apply to a test class to create a fixture inside it called 'generated_client'. + + The fixture value will be a GeneratedClientContext created by calling + generate_client_from_inline_spec(). + """ + def _decorator(cls): + def generated_client(self): + with generate_client_from_inline_spec(openapi_spec, extra_args=extra_args, config=config) as g: + print(g.generator_result.stdout) # so we'll see the output if a test failed + yield g + + setattr(cls, name, pytest.fixture(scope="class")(generated_client)) + return cls + + return _decorator + + +def with_generated_code_import(import_path: str, alias: str | None = None): + """Decorator to apply to a test class to create a fixture from a generated code import. + + The 'generated_client' fixture must also be present. + + If import_path is "a.b.c", then the fixture's value is equal to "from a.b import c", and + its name is "c" unless you specify a different name with the alias parameter. + """ + parts = import_path.split(".") + module_name = ".".join(parts[0:-1]) + import_name = parts[-1] + + def _decorator(cls): + nonlocal alias + + def _func(self, generated_client): + return generated_client.import_symbol(module_name, import_name) + + alias = alias or import_name + _func.__name__ = alias + setattr(cls, alias, pytest.fixture(scope="class")(_func)) + return cls + + return _decorator + + +def with_generated_code_imports(*import_paths: str): + def _decorator(cls): + decorated = cls + for import_path in import_paths: + decorated = with_generated_code_import(import_path)(decorated) + return decorated + + return _decorator + + +def assert_model_decode_encode(model_class: Any, json_data: dict, expected_instance: Any) -> None: + instance = model_class.from_dict(json_data) + assert instance == expected_instance + assert instance.to_dict() == json_data + + +def assert_model_property_type_hint(model_class: Any, name: str, expected_type_hint: Any) -> None: + assert model_class.__annotations__[name] == expected_type_hint + + +def inline_spec_should_fail( + openapi_spec: str, + extra_args: list[str] = [], + config: str = "", + filename_suffix: str = "", + add_missing_sections = True, +) -> Result: + """Asserts that the generator could not process the spec. + + Returns the command result, which could include stdout data or an exception. + """ + with generate_client_from_inline_spec( + openapi_spec, + extra_args, + config, + filename_suffix=filename_suffix, + add_missing_sections=add_missing_sections, + raise_on_error=False, + ) as generated_client: + assert generated_client.generator_result.exit_code != 0 + return generated_client.generator_result + + +def assert_bad_schema( + generated_client: GeneratedClientContext, + schema_name: str, + expected_message_str: str, +) -> None: + warnings = _GeneratorWarningsParser(generated_client) + assert schema_name in warnings.by_schema, f"Did not find warning for schema {schema_name} in output: {warnings.output}" + assert expected_message_str in warnings.by_schema[schema_name] + + +class _GeneratorWarningsParser: + output: str + by_schema: Dict[str, str] + + def __init__(self, generated_client: GeneratedClientContext) -> None: + """Runs the generator, asserts that it printed warnings, and parses the warnings.""" + + assert generated_client.generator_result.exit_code == 0 + output = generated_client.generator_result.stdout + generated_client.generator_result.stderr + assert "Warning(s) encountered while generating" in output + self.by_schema = {} + self.output = output + bad_schema_regex = "Unable to (parse|process) schema /components/schemas/(\\w*)" + last_name = "" + while True: + if not (match := re.search(bad_schema_regex, output)): + break + if last_name: + self.by_schema[last_name] = output[0:match.start()] + output = output[match.end():] + last_name = match.group(2) + if last_name: + self.by_schema[last_name] = output diff --git a/end_to_end_tests/generated_client.py b/end_to_end_tests/generated_client.py new file mode 100644 index 000000000..6aa81975d --- /dev/null +++ b/end_to_end_tests/generated_client.py @@ -0,0 +1,156 @@ +import importlib +import os +import re +import shutil +from pathlib import Path +import sys +import tempfile +from typing import Any + +from attrs import define +import pytest +from click.testing import Result +from typer.testing import CliRunner + +from openapi_python_client.cli import app + + +@define +class GeneratedClientContext: + """A context manager with helpers for tests that run against generated client code. + + On entering this context, sys.path is changed to include the root directory of the + generated code, so its modules can be imported. On exit, the original sys.path is + restored, and any modules that were loaded within the context are removed. + """ + + output_path: Path + generator_result: Result + base_module: str + monkeypatch: pytest.MonkeyPatch + old_modules: set[str] | None = None + + def __enter__(self) -> "GeneratedClientContext": + self.monkeypatch.syspath_prepend(self.output_path) + self.old_modules = set(sys.modules.keys()) + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.monkeypatch.undo() + for module_name in set(sys.modules.keys()) - self.old_modules: + del sys.modules[module_name] + shutil.rmtree(self.output_path, ignore_errors=True) + + def import_module(self, module_path: str) -> Any: + """Attempt to import a module from the generated code.""" + return importlib.import_module(f"{self.base_module}{module_path}") + + def import_symbol(self, module_path: str, name: str) -> Any: + module = self.import_module(module_path) + try: + return getattr(module, name) + except AttributeError: + existing = ", ".join(name for name in dir(module) if not name.startswith("_")) + assert False, ( + f"Couldn't find import \"{name}\" in \"{self.base_module}{module_path}\".\n" + f"Available imports in that module are: {existing}\n" + f"Output from generator was: {self.generator_result.stdout}" + ) + +def _run_command( + command: str, + extra_args: list[str] | None = None, + openapi_document: str | None = None, + url: str | None = None, + config_path: Path | None = None, + raise_on_error: bool = True, +) -> Result: + """Generate a client from an OpenAPI document and return the result of the command.""" + runner = CliRunner() + if openapi_document is not None: + openapi_path = Path(__file__).parent / openapi_document + source_arg = f"--path={openapi_path}" + else: + source_arg = f"--url={url}" + config_path = config_path or (Path(__file__).parent / "config.yml") + args = [command, f"--config={config_path}", source_arg] + if extra_args: + args.extend(extra_args) + result = runner.invoke(app, args) + if result.exit_code != 0 and raise_on_error: + message = f"{result.stdout}\n{result.exception}" if result.exception else result.stdout + raise Exception(message) + return result + + +def generate_client( + openapi_document: str, + extra_args: list[str] = [], + output_path: str = "my-test-api-client", + base_module: str = "my_test_api_client", + specify_output_path_explicitly: bool = True, + overwrite: bool = True, + raise_on_error: bool = True, +) -> GeneratedClientContext: + """Run the generator and return a GeneratedClientContext for accessing the generated code.""" + full_output_path = Path.cwd() / output_path + if not overwrite: + shutil.rmtree(full_output_path, ignore_errors=True) + args = extra_args + if specify_output_path_explicitly: + args = [*args, "--output-path", str(full_output_path)] + if overwrite: + args = [*args, "--overwrite"] + generator_result = _run_command("generate", args, openapi_document, raise_on_error=raise_on_error) + return GeneratedClientContext( + full_output_path, + generator_result, + base_module, + pytest.MonkeyPatch(), + ) + + +def generate_client_from_inline_spec( + openapi_spec: str, + extra_args: list[str] = [], + config: str = "", + filename_suffix: str | None = None, + base_module: str = "testapi_client", + add_missing_sections = True, + raise_on_error: bool = True, +) -> GeneratedClientContext: + """Run the generator on a temporary file created with the specified contents. + + You can also optionally tell it to create a temporary config file. + """ + if add_missing_sections: + if not re.search("^openapi:", openapi_spec, re.MULTILINE): + openapi_spec += "\nopenapi: '3.1.0'\n" + if not re.search("^info:", openapi_spec, re.MULTILINE): + openapi_spec += "\ninfo: {'title': 'testapi', 'description': 'my test api', 'version': '0.0.1'}\n" + if not re.search("^paths:", openapi_spec, re.MULTILINE): + openapi_spec += "\npaths: {}\n" + + output_path = tempfile.mkdtemp() + file = tempfile.NamedTemporaryFile(suffix=filename_suffix, delete=False) + file.write(openapi_spec.encode('utf-8')) + file.close() + + if config: + config_file = tempfile.NamedTemporaryFile(delete=False) + config_file.write(config.encode('utf-8')) + config_file.close() + extra_args = [*extra_args, "--config", config_file.name] + + generated_client = generate_client( + file.name, + extra_args, + output_path, + base_module, + raise_on_error=raise_on_error, + ) + os.unlink(file.name) + if config: + os.unlink(config_file.name) + + return generated_client diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/json_like.py b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/json_like.py index 626bacfa6..4b22b6030 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/json_like.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/json_like.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,25 +20,25 @@ def _get_kwargs( "url": "/bodies/json-like", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/vnd+json" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: JsonLikeBody, ) -> Response[Any]: """A content type that works like json but isn't application/json @@ -78,7 +78,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: JsonLikeBody, ) -> Response[Any]: """A content type that works like json but isn't application/json diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/post_bodies_multiple.py b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/post_bodies_multiple.py index 84ec8eee0..cbc2651c0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/post_bodies_multiple.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/post_bodies_multiple.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -13,12 +13,7 @@ def _get_kwargs( *, - body: Union[ - PostBodiesMultipleJsonBody, - File, - PostBodiesMultipleDataBody, - PostBodiesMultipleFilesBody, - ], + body: PostBodiesMultipleJsonBody | File | PostBodiesMultipleDataBody | PostBodiesMultipleFilesBody, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -28,40 +23,37 @@ def _get_kwargs( } if isinstance(body, PostBodiesMultipleJsonBody): - _json_body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _json_body headers["Content-Type"] = "application/json" if isinstance(body, File): - _content_body = body.payload + _kwargs["content"] = body.payload - _kwargs["content"] = _content_body headers["Content-Type"] = "application/octet-stream" if isinstance(body, PostBodiesMultipleDataBody): - _data_body = body.to_dict() + _kwargs["data"] = body.to_dict() - _kwargs["data"] = _data_body headers["Content-Type"] = "application/x-www-form-urlencoded" if isinstance(body, PostBodiesMultipleFilesBody): - _files_body = body.to_multipart() + _kwargs["files"] = body.to_multipart() - _kwargs["files"] = _files_body headers["Content-Type"] = "multipart/form-data" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,13 +64,8 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], - body: Union[ - PostBodiesMultipleJsonBody, - File, - PostBodiesMultipleDataBody, - PostBodiesMultipleFilesBody, - ], + client: AuthenticatedClient | Client, + body: PostBodiesMultipleJsonBody | File | PostBodiesMultipleDataBody | PostBodiesMultipleFilesBody, ) -> Response[Any]: """Test multiple bodies @@ -109,13 +96,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], - body: Union[ - PostBodiesMultipleJsonBody, - File, - PostBodiesMultipleDataBody, - PostBodiesMultipleFilesBody, - ], + client: AuthenticatedClient | Client, + body: PostBodiesMultipleJsonBody | File | PostBodiesMultipleDataBody | PostBodiesMultipleFilesBody, ) -> Response[Any]: """Test multiple bodies diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/refs.py b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/refs.py index a79cf178a..548dee8fa 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/bodies/refs.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/bodies/refs.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,25 +20,25 @@ def _get_kwargs( "url": "/bodies/refs", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, ) -> Response[Any]: """Test request body defined via ref @@ -78,7 +78,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, ) -> Response[Any]: """Test request body defined via ref diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/config/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/config/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/config/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/config/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/config/content_type_override.py b/end_to_end_tests/golden-record/my_test_api_client/api/config/content_type_override.py index 2bd74aac4..667605270 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/config/content_type_override.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/config/content_type_override.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -19,26 +19,26 @@ def _get_kwargs( "url": "/config/content-type-override", } - _body = body + _kwargs["json"] = body - _kwargs["json"] = _body headers["Content-Type"] = "openapi/python/client" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[str]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, ) -> Response[str]: """Content Type Override @@ -78,9 +78,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Optional[str]: +) -> str | None: """Content Type Override Args: @@ -102,7 +102,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, ) -> Response[str]: """Content Type Override @@ -129,9 +129,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Optional[str]: +) -> str | None: """Content Type Override Args: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index 7de222f55..1fe9e78a0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -10,7 +10,7 @@ def _get_kwargs( *, - common: Union[Unset, str] = UNSET, + common: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -27,16 +27,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,12 +48,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], - common: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + common: str | Unset = UNSET, ) -> Response[Any]: """ Args: - common (Union[Unset, str]): + common (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -75,12 +76,12 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], - common: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + common: str | Unset = UNSET, ) -> Response[Any]: """ Args: - common (Union[Unset, str]): + common (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_allof.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_allof.py index 9d837acd6..073ce1e6b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_allof.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_allof.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -19,12 +19,13 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[GetModelsAllofResponse200]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> GetModelsAllofResponse200 | None: if response.status_code == 200: response_200 = GetModelsAllofResponse200.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -32,7 +33,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[GetModelsAllofResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -44,7 +45,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[GetModelsAllofResponse200]: """ Raises: @@ -66,8 +67,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[GetModelsAllofResponse200]: + client: AuthenticatedClient | Client, +) -> GetModelsAllofResponse200 | None: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -84,7 +85,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[GetModelsAllofResponse200]: """ Raises: @@ -104,8 +105,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[GetModelsAllofResponse200]: + client: AuthenticatedClient | Client, +) -> GetModelsAllofResponse200 | None: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py index 85f68fb7c..3401cf323 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_models_oneof_with_required_const.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -24,24 +24,20 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: if response.status_code == 200: def _parse_response_200( data: object, - ) -> Union[ - "GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1" - ]: + ) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1: try: if not isinstance(data, dict): raise TypeError() response_200_type_0 = GetModelsOneofWithRequiredConstResponse200Type0.from_dict(data) return response_200_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() @@ -52,6 +48,7 @@ def _parse_response_200( response_200 = _parse_response_200(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,10 +56,8 @@ def _parse_response_200( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,17 +68,15 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], -) -> Response[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + client: AuthenticatedClient | Client, +) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union['GetModelsOneofWithRequiredConstResponse200Type0', 'GetModelsOneofWithRequiredConstResponse200Type1']] + Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1] """ kwargs = _get_kwargs() @@ -97,17 +90,15 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + client: AuthenticatedClient | Client, +) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union['GetModelsOneofWithRequiredConstResponse200Type0', 'GetModelsOneofWithRequiredConstResponse200Type1'] + GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 """ return sync_detailed( @@ -117,17 +108,15 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], -) -> Response[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + client: AuthenticatedClient | Client, +) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union['GetModelsOneofWithRequiredConstResponse200Type0', 'GetModelsOneofWithRequiredConstResponse200Type1']] + Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1] """ kwargs = _get_kwargs() @@ -139,17 +128,15 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[ - Union["GetModelsOneofWithRequiredConstResponse200Type0", "GetModelsOneofWithRequiredConstResponse200Type1"] -]: + client: AuthenticatedClient | Client, +) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union['GetModelsOneofWithRequiredConstResponse200Type0', 'GetModelsOneofWithRequiredConstResponse200Type1'] + GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index 5bd941c69..14bab0778 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -10,7 +10,7 @@ def _get_kwargs( *, - common: Union[Unset, str] = UNSET, + common: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -27,16 +27,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,12 +48,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], - common: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + common: str | Unset = UNSET, ) -> Response[Any]: """ Args: - common (Union[Unset, str]): + common (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -75,12 +76,12 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], - common: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + common: str | Unset = UNSET, ) -> Response[Any]: """ Args: - common (Union[Unset, str]): + common (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/reserved_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/reserved_parameters.py index fe7adf04c..990c945b0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/reserved_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/reserved_parameters.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -30,16 +30,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -50,7 +51,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, client_query: str, url_query: str, ) -> Response[Any]: @@ -81,7 +82,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, client_query: str, url_query: str, ) -> Response[Any]: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/defaults/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/defaults/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/defaults/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/defaults/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/defaults/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/defaults/defaults_tests_defaults_post.py index ffc9b535e..6cadc465a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/defaults/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/defaults/defaults_tests_defaults_post.py @@ -1,6 +1,6 @@ import datetime from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx from dateutil.parser import isoparse @@ -23,11 +23,11 @@ def _get_kwargs( int_prop: int = 7, boolean_prop: bool = False, list_prop: list[AnEnum], - union_prop: Union[float, str] = "not a float", - union_prop_with_ref: Union[AnEnum, Unset, float] = 0.6, + union_prop: float | str = "not a float", + union_prop_with_ref: AnEnum | float | Unset = 0.6, enum_prop: AnEnum, - model_prop: "ModelWithUnionProperty", - required_model_prop: "ModelWithUnionProperty", + model_prop: ModelWithUnionProperty, + required_model_prop: ModelWithUnionProperty, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -53,11 +53,11 @@ def _get_kwargs( params["list_prop"] = json_list_prop - json_union_prop: Union[float, str] + json_union_prop: float | str json_union_prop = union_prop params["union_prop"] = json_union_prop - json_union_prop_with_ref: Union[Unset, float, str] + json_union_prop_with_ref: float | str | Unset if isinstance(union_prop_with_ref, Unset): json_union_prop_with_ref = UNSET elif isinstance(union_prop_with_ref, AnEnum): @@ -87,15 +87,17 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -103,8 +105,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -115,7 +117,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = isoparse("1010-10-10").date(), @@ -124,12 +126,12 @@ def sync_detailed( int_prop: int = 7, boolean_prop: bool = False, list_prop: list[AnEnum], - union_prop: Union[float, str] = "not a float", - union_prop_with_ref: Union[AnEnum, Unset, float] = 0.6, + union_prop: float | str = "not a float", + union_prop_with_ref: AnEnum | float | Unset = 0.6, enum_prop: AnEnum, - model_prop: "ModelWithUnionProperty", - required_model_prop: "ModelWithUnionProperty", -) -> Response[Union[Any, HTTPValidationError]]: + model_prop: ModelWithUnionProperty, + required_model_prop: ModelWithUnionProperty, +) -> Response[Any | HTTPValidationError]: """Defaults Args: @@ -141,8 +143,8 @@ def sync_detailed( int_prop (int): Default: 7. boolean_prop (bool): Default: False. list_prop (list[AnEnum]): - union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, Unset, float]): Default: 0.6. + union_prop (float | str): Default: 'not a float'. + union_prop_with_ref (AnEnum | float | Unset): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -152,7 +154,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -180,7 +182,7 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = isoparse("1010-10-10").date(), @@ -189,12 +191,12 @@ def sync( int_prop: int = 7, boolean_prop: bool = False, list_prop: list[AnEnum], - union_prop: Union[float, str] = "not a float", - union_prop_with_ref: Union[AnEnum, Unset, float] = 0.6, + union_prop: float | str = "not a float", + union_prop_with_ref: AnEnum | float | Unset = 0.6, enum_prop: AnEnum, - model_prop: "ModelWithUnionProperty", - required_model_prop: "ModelWithUnionProperty", -) -> Optional[Union[Any, HTTPValidationError]]: + model_prop: ModelWithUnionProperty, + required_model_prop: ModelWithUnionProperty, +) -> Any | HTTPValidationError | None: """Defaults Args: @@ -206,8 +208,8 @@ def sync( int_prop (int): Default: 7. boolean_prop (bool): Default: False. list_prop (list[AnEnum]): - union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, Unset, float]): Default: 0.6. + union_prop (float | str): Default: 'not a float'. + union_prop_with_ref (AnEnum | float | Unset): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -217,7 +219,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return sync_detailed( @@ -240,7 +242,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = isoparse("1010-10-10").date(), @@ -249,12 +251,12 @@ async def asyncio_detailed( int_prop: int = 7, boolean_prop: bool = False, list_prop: list[AnEnum], - union_prop: Union[float, str] = "not a float", - union_prop_with_ref: Union[AnEnum, Unset, float] = 0.6, + union_prop: float | str = "not a float", + union_prop_with_ref: AnEnum | float | Unset = 0.6, enum_prop: AnEnum, - model_prop: "ModelWithUnionProperty", - required_model_prop: "ModelWithUnionProperty", -) -> Response[Union[Any, HTTPValidationError]]: + model_prop: ModelWithUnionProperty, + required_model_prop: ModelWithUnionProperty, +) -> Response[Any | HTTPValidationError]: """Defaults Args: @@ -266,8 +268,8 @@ async def asyncio_detailed( int_prop (int): Default: 7. boolean_prop (bool): Default: False. list_prop (list[AnEnum]): - union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, Unset, float]): Default: 0.6. + union_prop (float | str): Default: 'not a float'. + union_prop_with_ref (AnEnum | float | Unset): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -277,7 +279,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -303,7 +305,7 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = isoparse("1010-10-10").date(), @@ -312,12 +314,12 @@ async def asyncio( int_prop: int = 7, boolean_prop: bool = False, list_prop: list[AnEnum], - union_prop: Union[float, str] = "not a float", - union_prop_with_ref: Union[AnEnum, Unset, float] = 0.6, + union_prop: float | str = "not a float", + union_prop_with_ref: AnEnum | float | Unset = 0.6, enum_prop: AnEnum, - model_prop: "ModelWithUnionProperty", - required_model_prop: "ModelWithUnionProperty", -) -> Optional[Union[Any, HTTPValidationError]]: + model_prop: ModelWithUnionProperty, + required_model_prop: ModelWithUnionProperty, +) -> Any | HTTPValidationError | None: """Defaults Args: @@ -329,8 +331,8 @@ async def asyncio( int_prop (int): Default: 7. boolean_prop (bool): Default: False. list_prop (list[AnEnum]): - union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, Unset, float]): Default: 0.6. + union_prop (float | str): Default: 'not a float'. + union_prop_with_ref (AnEnum | float | Unset): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -340,7 +342,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/enums/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/enums/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/enums/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/enums/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 52385855c..4ed5ff6ee 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -27,16 +27,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,7 +48,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, bool_enum: bool, ) -> Response[Any]: """Bool Enum @@ -76,7 +77,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, bool_enum: bool, ) -> Response[Any]: """Bool Enum diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py index 26c3729fe..8ebc2b95f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -29,16 +29,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +50,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, int_enum: AnIntEnum, ) -> Response[Any]: """Int Enum @@ -78,7 +79,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, int_enum: AnIntEnum, ) -> Response[Any]: """Int Enum diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py index ad9428a72..20c2db527 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -12,12 +12,12 @@ def _get_kwargs( *, - boolean_header: Union[Unset, bool] = UNSET, - string_header: Union[Unset, str] = UNSET, - number_header: Union[Unset, float] = UNSET, - integer_header: Union[Unset, int] = UNSET, - int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET, + boolean_header: bool | Unset = UNSET, + string_header: str | Unset = UNSET, + number_header: float | Unset = UNSET, + integer_header: int | Unset = UNSET, + int_enum_header: GetLocationHeaderTypesIntEnumHeader | Unset = UNSET, + string_enum_header: GetLocationHeaderTypesStringEnumHeader | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} if not isinstance(boolean_header, Unset): @@ -47,16 +47,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,22 +68,22 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], - boolean_header: Union[Unset, bool] = UNSET, - string_header: Union[Unset, str] = UNSET, - number_header: Union[Unset, float] = UNSET, - integer_header: Union[Unset, int] = UNSET, - int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET, + client: AuthenticatedClient | Client, + boolean_header: bool | Unset = UNSET, + string_header: str | Unset = UNSET, + number_header: float | Unset = UNSET, + integer_header: int | Unset = UNSET, + int_enum_header: GetLocationHeaderTypesIntEnumHeader | Unset = UNSET, + string_enum_header: GetLocationHeaderTypesStringEnumHeader | Unset = UNSET, ) -> Response[Any]: """ Args: - boolean_header (Union[Unset, bool]): - string_header (Union[Unset, str]): - number_header (Union[Unset, float]): - integer_header (Union[Unset, int]): - int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]): - string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]): + boolean_header (bool | Unset): + string_header (str | Unset): + number_header (float | Unset): + integer_header (int | Unset): + int_enum_header (GetLocationHeaderTypesIntEnumHeader | Unset): + string_enum_header (GetLocationHeaderTypesStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -110,22 +111,22 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], - boolean_header: Union[Unset, bool] = UNSET, - string_header: Union[Unset, str] = UNSET, - number_header: Union[Unset, float] = UNSET, - integer_header: Union[Unset, int] = UNSET, - int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET, + client: AuthenticatedClient | Client, + boolean_header: bool | Unset = UNSET, + string_header: str | Unset = UNSET, + number_header: float | Unset = UNSET, + integer_header: int | Unset = UNSET, + int_enum_header: GetLocationHeaderTypesIntEnumHeader | Unset = UNSET, + string_enum_header: GetLocationHeaderTypesStringEnumHeader | Unset = UNSET, ) -> Response[Any]: """ Args: - boolean_header (Union[Unset, bool]): - string_header (Union[Unset, str]): - number_header (Union[Unset, float]): - integer_header (Union[Unset, int]): - int_enum_header (Union[Unset, GetLocationHeaderTypesIntEnumHeader]): - string_enum_header (Union[Unset, GetLocationHeaderTypesStringEnumHeader]): + boolean_header (bool | Unset): + string_header (str | Unset): + number_header (float | Unset): + integer_header (int | Unset): + int_enum_header (GetLocationHeaderTypesIntEnumHeader | Unset): + string_enum_header (GetLocationHeaderTypesStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index e28e37a36..e454a50a9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -1,6 +1,6 @@ import datetime from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -12,23 +12,23 @@ def _get_kwargs( *, not_null_required: datetime.datetime, - null_required: Union[None, datetime.datetime], - null_not_required: Union[None, Unset, datetime.datetime] = UNSET, - not_null_not_required: Union[Unset, datetime.datetime] = UNSET, + null_required: datetime.datetime | None, + null_not_required: datetime.datetime | None | Unset = UNSET, + not_null_not_required: datetime.datetime | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} json_not_null_required = not_null_required.isoformat() params["not_null_required"] = json_not_null_required - json_null_required: Union[None, str] + json_null_required: None | str if isinstance(null_required, datetime.datetime): json_null_required = null_required.isoformat() else: json_null_required = null_required params["null_required"] = json_null_required - json_null_not_required: Union[None, Unset, str] + json_null_not_required: None | str | Unset if isinstance(null_not_required, Unset): json_null_not_required = UNSET elif isinstance(null_not_required, datetime.datetime): @@ -37,7 +37,7 @@ def _get_kwargs( json_null_not_required = null_not_required params["null_not_required"] = json_null_not_required - json_not_null_not_required: Union[Unset, str] = UNSET + json_not_null_not_required: str | Unset = UNSET if not isinstance(not_null_not_required, Unset): json_not_null_not_required = not_null_not_required.isoformat() params["not_null_not_required"] = json_not_null_not_required @@ -53,16 +53,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,18 +74,18 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, not_null_required: datetime.datetime, - null_required: Union[None, datetime.datetime], - null_not_required: Union[None, Unset, datetime.datetime] = UNSET, - not_null_not_required: Union[Unset, datetime.datetime] = UNSET, + null_required: datetime.datetime | None, + null_not_required: datetime.datetime | None | Unset = UNSET, + not_null_not_required: datetime.datetime | Unset = UNSET, ) -> Response[Any]: """ Args: not_null_required (datetime.datetime): - null_required (Union[None, datetime.datetime]): - null_not_required (Union[None, Unset, datetime.datetime]): - not_null_not_required (Union[Unset, datetime.datetime]): + null_required (datetime.datetime | None): + null_not_required (datetime.datetime | None | Unset): + not_null_not_required (datetime.datetime | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -110,18 +111,18 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, not_null_required: datetime.datetime, - null_required: Union[None, datetime.datetime], - null_not_required: Union[None, Unset, datetime.datetime] = UNSET, - not_null_not_required: Union[Unset, datetime.datetime] = UNSET, + null_required: datetime.datetime | None, + null_not_required: datetime.datetime | None | Unset = UNSET, + not_null_not_required: datetime.datetime | Unset = UNSET, ) -> Response[Any]: """ Args: not_null_required (datetime.datetime): - null_required (Union[None, datetime.datetime]): - null_not_required (Union[None, Unset, datetime.datetime]): - not_null_not_required (Union[Unset, datetime.datetime]): + null_required (datetime.datetime | None): + null_not_required (datetime.datetime | None | Unset): + not_null_not_required (datetime.datetime | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/naming/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/naming/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/naming/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/naming/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/naming/hyphen_in_path.py b/end_to_end_tests/golden-record/my_test_api_client/api/naming/hyphen_in_path.py index a0caba2d6..a31e2e093 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/naming/hyphen_in_path.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/naming/hyphen_in_path.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,22 +14,25 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/naming/{hyphen_in_path}", + "url": "/naming/{hyphen_in_path}".format( + hyphen_in_path=quote(str(hyphen_in_path), safe=""), + ), } return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -40,7 +44,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( hyphen_in_path: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Args: @@ -68,7 +72,7 @@ def sync_detailed( async def asyncio_detailed( hyphen_in_path: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Args: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/naming/mixed_case.py b/end_to_end_tests/golden-record/my_test_api_client/api/naming/mixed_case.py index 7df2d318f..78c119a3b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/naming/mixed_case.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/naming/mixed_case.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,13 +31,12 @@ def _get_kwargs( return _kwargs -def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[MixedCaseResponse200]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> MixedCaseResponse200 | None: if response.status_code == 200: response_200 = MixedCaseResponse200.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -45,7 +44,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[MixedCaseResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -57,7 +56,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, mixed_case: str, mixedCase: str, ) -> Response[MixedCaseResponse200]: @@ -88,10 +87,10 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, mixed_case: str, mixedCase: str, -) -> Optional[MixedCaseResponse200]: +) -> MixedCaseResponse200 | None: """ Args: mixed_case (str): @@ -114,7 +113,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, mixed_case: str, mixedCase: str, ) -> Response[MixedCaseResponse200]: @@ -143,10 +142,10 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, mixed_case: str, mixedCase: str, -) -> Optional[MixedCaseResponse200]: +) -> MixedCaseResponse200 | None: """ Args: mixed_case (str): diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py b/end_to_end_tests/golden-record/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py index 3bb8b698b..daf214f76 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -23,9 +23,8 @@ def _get_kwargs( "url": "/naming/property-conflict-with-import", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -33,12 +32,13 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[PostNamingPropertyConflictWithImportResponse200]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> PostNamingPropertyConflictWithImportResponse200 | None: if response.status_code == 200: response_200 = PostNamingPropertyConflictWithImportResponse200.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -46,7 +46,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[PostNamingPropertyConflictWithImportResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -58,7 +58,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostNamingPropertyConflictWithImportBody, ) -> Response[PostNamingPropertyConflictWithImportResponse200]: """ @@ -86,9 +86,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostNamingPropertyConflictWithImportBody, -) -> Optional[PostNamingPropertyConflictWithImportResponse200]: +) -> PostNamingPropertyConflictWithImportResponse200 | None: """ Args: body (PostNamingPropertyConflictWithImportBody): @@ -109,7 +109,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostNamingPropertyConflictWithImportBody, ) -> Response[PostNamingPropertyConflictWithImportResponse200]: """ @@ -135,9 +135,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostNamingPropertyConflictWithImportBody, -) -> Optional[PostNamingPropertyConflictWithImportResponse200]: +) -> PostNamingPropertyConflictWithImportResponse200 | None: """ Args: body (PostNamingPropertyConflictWithImportBody): diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py index e7a8e2712..801929db9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -11,10 +12,10 @@ def _get_kwargs( path_param: str, *, - string_param: Union[Unset, str] = UNSET, - integer_param: Union[Unset, int] = 0, - header_param: Union[None, Unset, str] = UNSET, - cookie_param: Union[Unset, str] = UNSET, + string_param: str | Unset = UNSET, + integer_param: int | Unset = 0, + header_param: None | str | Unset = UNSET, + cookie_param: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} if not isinstance(header_param, Unset): @@ -34,7 +35,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/parameter-references/{path_param}", + "url": "/parameter-references/{path_param}".format( + path_param=quote(str(path_param), safe=""), + ), "params": params, "cookies": cookies, } @@ -43,16 +46,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,20 +68,20 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( path_param: str, *, - client: Union[AuthenticatedClient, Client], - string_param: Union[Unset, str] = UNSET, - integer_param: Union[Unset, int] = 0, - header_param: Union[None, Unset, str] = UNSET, - cookie_param: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + string_param: str | Unset = UNSET, + integer_param: int | Unset = 0, + header_param: None | str | Unset = UNSET, + cookie_param: str | Unset = UNSET, ) -> Response[Any]: """Test different types of parameter references Args: path_param (str): - string_param (Union[Unset, str]): - integer_param (Union[Unset, int]): Default: 0. - header_param (Union[None, Unset, str]): - cookie_param (Union[Unset, str]): + string_param (str | Unset): + integer_param (int | Unset): Default: 0. + header_param (None | str | Unset): + cookie_param (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -105,20 +109,20 @@ def sync_detailed( async def asyncio_detailed( path_param: str, *, - client: Union[AuthenticatedClient, Client], - string_param: Union[Unset, str] = UNSET, - integer_param: Union[Unset, int] = 0, - header_param: Union[None, Unset, str] = UNSET, - cookie_param: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + string_param: str | Unset = UNSET, + integer_param: int | Unset = 0, + header_param: None | str | Unset = UNSET, + cookie_param: str | Unset = UNSET, ) -> Response[Any]: """Test different types of parameter references Args: path_param (str): - string_param (Union[Unset, str]): - integer_param (Union[Unset, int]): Default: 0. - header_param (Union[None, Unset, str]): - cookie_param (Union[Unset, str]): + string_param (str | Unset): + integer_param (int | Unset): Default: 0. + header_param (None | str | Unset): + cookie_param (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 704996107..1415a8cb4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -11,7 +12,7 @@ def _get_kwargs( param_path: str, *, - param_query: Union[Unset, str] = UNSET, + param_query: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -21,23 +22,26 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "delete", - "url": f"/common_parameters_overriding/{param_path}", + "url": "/common_parameters_overriding/{param_path}".format( + param_path=quote(str(param_path), safe=""), + ), "params": params, } return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,13 +53,13 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], - param_query: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + param_query: str | Unset = UNSET, ) -> Response[Any]: """ Args: param_path (str): - param_query (Union[Unset, str]): + param_query (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -80,13 +84,13 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], - param_query: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + param_query: str | Unset = UNSET, ) -> Response[Any]: """ Args: param_path (str): - param_query (Union[Unset, str]): + param_query (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index b6efbba9b..4f2c5056f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -21,23 +22,26 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/common_parameters_overriding/{param_path}", + "url": "/common_parameters_overriding/{param_path}".format( + param_path=quote(str(param_path), safe=""), + ), "params": params, } return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +53,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, param_query: str = "overridden_in_GET", ) -> Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code @@ -82,7 +86,7 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, param_query: str = "overridden_in_GET", ) -> Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index 6a7ed7fd5..dd11f68ca 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -11,9 +12,9 @@ def _get_kwargs( param_path: str, *, - param_query: Union[Unset, str] = UNSET, - param_header: Union[Unset, str] = UNSET, - param_cookie: Union[Unset, str] = UNSET, + param_query: str | Unset = UNSET, + param_header: str | Unset = UNSET, + param_cookie: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} if not isinstance(param_header, Unset): @@ -31,7 +32,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/same-name-multiple-locations/{param_path}", + "url": "/same-name-multiple-locations/{param_path}".format( + param_path=quote(str(param_path), safe=""), + ), "params": params, "cookies": cookies, } @@ -40,16 +43,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,17 +65,17 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], - param_query: Union[Unset, str] = UNSET, - param_header: Union[Unset, str] = UNSET, - param_cookie: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + param_query: str | Unset = UNSET, + param_header: str | Unset = UNSET, + param_cookie: str | Unset = UNSET, ) -> Response[Any]: """ Args: param_path (str): - param_query (Union[Unset, str]): - param_header (Union[Unset, str]): - param_cookie (Union[Unset, str]): + param_query (str | Unset): + param_header (str | Unset): + param_cookie (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -98,17 +102,17 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: Union[AuthenticatedClient, Client], - param_query: Union[Unset, str] = UNSET, - param_header: Union[Unset, str] = UNSET, - param_cookie: Union[Unset, str] = UNSET, + client: AuthenticatedClient | Client, + param_query: str | Unset = UNSET, + param_header: str | Unset = UNSET, + param_cookie: str | Unset = UNSET, ) -> Response[Any]: """ Args: param_path (str): - param_query (Union[Unset, str]): - param_header (Union[Unset, str]): - param_cookie (Union[Unset, str]): + param_query (str | Unset): + param_header (str | Unset): + param_cookie (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index 44345aa26..3b11674f5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -16,22 +17,28 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/multiple-path-parameters/{param4}/something/{param2}/{param1}/{param3}", + "url": "/multiple-path-parameters/{param4}/something/{param2}/{param1}/{param3}".format( + param4=quote(str(param4), safe=""), + param2=quote(str(param2), safe=""), + param1=quote(str(param1), safe=""), + param3=quote(str(param3), safe=""), + ), } return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -46,7 +53,7 @@ def sync_detailed( param1: str, param3: int, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Args: @@ -83,7 +90,7 @@ async def asyncio_detailed( param1: str, param3: int, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Args: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/responses/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/default_status_code.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/default_status_code.py new file mode 100644 index 000000000..f2af5e3b3 --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/default_status_code.py @@ -0,0 +1,114 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/responses/status-codes/default", + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: + response_default = response.text + return response_default + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[str]: + """Default Status Code Only + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[str] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, +) -> str | None: + """Default Status Code Only + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + str + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[str]: + """Default Status Code Only + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[str] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, +) -> str | None: + """Default Status Code Only + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + str + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py index cf0599306..1b098950e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,12 +21,13 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[PostResponsesUnionsSimpleBeforeComplexResponse200]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: if response.status_code == 200: response_200 = PostResponsesUnionsSimpleBeforeComplexResponse200.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -34,7 +35,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -46,7 +47,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: """Regression test for #603 @@ -69,8 +70,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[PostResponsesUnionsSimpleBeforeComplexResponse200]: + client: AuthenticatedClient | Client, +) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: """Regression test for #603 Raises: @@ -88,7 +89,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: """Regression test for #603 @@ -109,8 +110,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[PostResponsesUnionsSimpleBeforeComplexResponse200]: + client: AuthenticatedClient | Client, +) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: """Regression test for #603 Raises: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/reference_response.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/reference_response.py new file mode 100644 index 000000000..4e96030ae --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/reference_response.py @@ -0,0 +1,123 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.a_model import AModel +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/responses/reference", + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AModel | None: + if response.status_code == 200: + response_200 = AModel.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AModel]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[AModel]: + """Endpoint using predefined response + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AModel] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, +) -> AModel | None: + """Endpoint using predefined response + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AModel + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[AModel]: + """Endpoint using predefined response + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AModel] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, +) -> AModel | None: + """Endpoint using predefined response + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AModel + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_patterns.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_patterns.py new file mode 100644 index 000000000..4e3d501d4 --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_patterns.py @@ -0,0 +1,133 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.status_code_patterns_response_2xx import StatusCodePatternsResponse2XX +from ...models.status_code_patterns_response_4xx import StatusCodePatternsResponse4XX +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/response/status-codes/patterns", + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: + if 200 <= response.status_code <= 299: + response_2xx = StatusCodePatternsResponse2XX.from_dict(response.json()) + + return response_2xx + + if 400 <= response.status_code <= 499: + response_4xx = StatusCodePatternsResponse4XX.from_dict(response.json()) + + return response_4xx + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + """Status Code Patterns + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, +) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: + """Status Code Patterns + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + """Status Code Patterns + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, +) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: + """Status Code Patterns + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_precedence.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_precedence.py new file mode 100644 index 000000000..9f86c2997 --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/status_code_precedence.py @@ -0,0 +1,134 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/response/status-codes/precedence", + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: + if response.status_code == 200: + response_200 = response.text + return response_200 + + if response.status_code == 404: + response_404 = response.text + return response_404 + + if 400 <= response.status_code <= 499: + response_4xx = response.text + return response_4xx + + response_default = response.text + return response_default + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[str]: + """Status Codes Precedence + + Verify that specific status codes are always checked first, then ranges, then default + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[str] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, +) -> str | None: + """Status Codes Precedence + + Verify that specific status codes are always checked first, then ranges, then default + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + str + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, +) -> Response[str]: + """Status Codes Precedence + + Verify that specific status codes are always checked first, then ranges, then default + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[str] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, +) -> str | None: + """Status Codes Precedence + + Verify that specific status codes are always checked first, then ranges, then default + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + str + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/text_response.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/text_response.py index 057ceb2de..978ad84d1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/responses/text_response.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/text_response.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,17 +17,18 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[str]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = response.text return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -38,7 +39,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[str]: """Text Response @@ -61,8 +62,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[str]: + client: AuthenticatedClient | Client, +) -> str | None: """Text Response Raises: @@ -80,7 +81,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[str]: """Text Response @@ -101,8 +102,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[str]: + client: AuthenticatedClient | Client, +) -> str | None: """Text Response Raises: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py index 62631355f..f2c767fa3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,16 +17,17 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -37,7 +38,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Raises: @@ -59,7 +60,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Raises: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag2/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag2/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag2/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag2/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag2/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag2/get_tag_with_number.py index 62631355f..f2c767fa3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag2/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag2/get_tag_with_number.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,16 +17,17 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -37,7 +38,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Raises: @@ -59,7 +60,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """ Raises: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py index 0852815d2..e806fe60c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/tests/callback", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -31,15 +30,17 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -47,8 +48,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,9 +60,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Path with callback Try sending a request related to a callback @@ -74,7 +75,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -90,9 +91,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Path with callback Try sending a request related to a callback @@ -105,7 +106,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return sync_detailed( @@ -116,9 +117,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Path with callback Try sending a request related to a callback @@ -131,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -145,9 +146,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Path with callback Try sending a request related to a callback @@ -160,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/description_with_backslash.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/description_with_backslash.py index e7cd44f70..f33456e97 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/description_with_backslash.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/description_with_backslash.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,16 +17,17 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -37,7 +38,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: r""" Test description with \ @@ -62,7 +63,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: r""" Test description with \ diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 147eed3a7..08ddea77d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -17,18 +17,19 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list[bool]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[bool] | None: if response.status_code == 200: response_200 = cast(list[bool], response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list[bool]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[bool]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -39,7 +40,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[bool]]: """Get Basic List Of Booleans @@ -64,8 +65,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[bool]]: + client: AuthenticatedClient | Client, +) -> list[bool] | None: """Get Basic List Of Booleans Get a list of booleans @@ -85,7 +86,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[bool]]: """Get Basic List Of Booleans @@ -108,8 +109,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[bool]]: + client: AuthenticatedClient | Client, +) -> list[bool] | None: """Get Basic List Of Booleans Get a list of booleans diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py index 02b3abb1f..35310a218 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -17,18 +17,19 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list[float]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[float] | None: if response.status_code == 200: response_200 = cast(list[float], response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list[float]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[float]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -39,7 +40,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[float]]: """Get Basic List Of Floats @@ -64,8 +65,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[float]]: + client: AuthenticatedClient | Client, +) -> list[float] | None: """Get Basic List Of Floats Get a list of floats @@ -85,7 +86,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[float]]: """Get Basic List Of Floats @@ -108,8 +109,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[float]]: + client: AuthenticatedClient | Client, +) -> list[float] | None: """Get Basic List Of Floats Get a list of floats diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py index e71537363..2f0526e41 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -17,18 +17,19 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list[int]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[int] | None: if response.status_code == 200: response_200 = cast(list[int], response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list[int]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[int]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -39,7 +40,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[int]]: """Get Basic List Of Integers @@ -64,8 +65,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[int]]: + client: AuthenticatedClient | Client, +) -> list[int] | None: """Get Basic List Of Integers Get a list of integers @@ -85,7 +86,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[int]]: """Get Basic List Of Integers @@ -108,8 +109,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[int]]: + client: AuthenticatedClient | Client, +) -> list[int] | None: """Get Basic List Of Integers Get a list of integers diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py index 70f153829..a4b401eb2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -17,18 +17,19 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list[str]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[str] | None: if response.status_code == 200: response_200 = cast(list[str], response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list[str]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[str]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -39,7 +40,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[str]]: """Get Basic List Of Strings @@ -64,8 +65,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[str]]: + client: AuthenticatedClient | Client, +) -> list[str] | None: """Get Basic List Of Strings Get a list of strings @@ -85,7 +86,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[list[str]]: """Get Basic List Of Strings @@ -108,8 +109,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[list[str]]: + client: AuthenticatedClient | Client, +) -> list[str] | None: """Get Basic List Of Strings Get a list of strings diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index a708cf71d..5d027ecd7 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -1,6 +1,6 @@ import datetime from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -16,9 +16,9 @@ def _get_kwargs( *, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - some_date: Union[datetime.date, datetime.datetime], + some_date: datetime.date | datetime.datetime, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -31,7 +31,7 @@ def _get_kwargs( json_an_enum_value_with_null = [] for an_enum_value_with_null_item_data in an_enum_value_with_null: - an_enum_value_with_null_item: Union[None, str] + an_enum_value_with_null_item: None | str if isinstance(an_enum_value_with_null_item_data, AnEnumWithNull): an_enum_value_with_null_item = an_enum_value_with_null_item_data.value else: @@ -64,8 +64,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[HTTPValidationError, list["AModel"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -75,14 +75,17 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if response.status_code == 423: response_423 = HTTPValidationError.from_dict(response.json()) return response_423 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -90,8 +93,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[HTTPValidationError, list["AModel"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -102,28 +105,28 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - some_date: Union[datetime.date, datetime.datetime], -) -> Response[Union[HTTPValidationError, list["AModel"]]]: + some_date: datetime.date | datetime.datetime, +) -> Response[HTTPValidationError | list[AModel]]: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - some_date (Union[datetime.date, datetime.datetime]): + some_date (datetime.date | datetime.datetime): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, list['AModel']]] + Response[HTTPValidationError | list[AModel]] """ kwargs = _get_kwargs( @@ -142,28 +145,28 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - some_date: Union[datetime.date, datetime.datetime], -) -> Optional[Union[HTTPValidationError, list["AModel"]]]: + some_date: datetime.date | datetime.datetime, +) -> HTTPValidationError | list[AModel] | None: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - some_date (Union[datetime.date, datetime.datetime]): + some_date (datetime.date | datetime.datetime): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, list['AModel']] + HTTPValidationError | list[AModel] """ return sync_detailed( @@ -177,28 +180,28 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - some_date: Union[datetime.date, datetime.datetime], -) -> Response[Union[HTTPValidationError, list["AModel"]]]: + some_date: datetime.date | datetime.datetime, +) -> Response[HTTPValidationError | list[AModel]]: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - some_date (Union[datetime.date, datetime.datetime]): + some_date (datetime.date | datetime.datetime): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, list['AModel']]] + Response[HTTPValidationError | list[AModel]] """ kwargs = _get_kwargs( @@ -215,28 +218,28 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - some_date: Union[datetime.date, datetime.datetime], -) -> Optional[Union[HTTPValidationError, list["AModel"]]]: + some_date: datetime.date | datetime.datetime, +) -> HTTPValidationError | list[AModel] | None: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - some_date (Union[datetime.date, datetime.datetime]): + some_date (datetime.date | datetime.datetime): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, list['AModel']] + HTTPValidationError | list[AModel] """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index f33a23dc7..5be950c77 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/tests/json_body", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -31,15 +30,17 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -47,8 +48,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,9 +60,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Json Body Try sending a JSON body @@ -74,7 +75,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -90,9 +91,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Json Body Try sending a JSON body @@ -105,7 +106,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return sync_detailed( @@ -116,9 +117,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Json Body Try sending a JSON body @@ -131,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -145,9 +146,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AModel, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Json Body Try sending a JSON body @@ -160,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py index 586947f49..59c746613 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,16 +17,17 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -37,7 +38,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """No Response @@ -60,7 +61,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """No Response diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index efb0f4ae5..36fab061c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -1,6 +1,6 @@ from http import HTTPStatus from io import BytesIO -from typing import Any, Optional, Union +from typing import Any import httpx @@ -18,18 +18,19 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[File]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> File | None: if response.status_code == 200: response_200 = File(payload=BytesIO(response.content)) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[File]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[File]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -40,7 +41,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[File]: """Octet Stream @@ -63,8 +64,8 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[File]: + client: AuthenticatedClient | Client, +) -> File | None: """Octet Stream Raises: @@ -82,7 +83,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[File]: """Octet Stream @@ -103,8 +104,8 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], -) -> Optional[File]: + client: AuthenticatedClient | Client, +) -> File | None: """Octet Stream Raises: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py index ea0cbd65a..a0e9bbac0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py @@ -1,11 +1,12 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any import httpx from ... import errors from ...client import AuthenticatedClient, Client from ...models.http_validation_error import HTTPValidationError +from ...models.octet_stream_tests_octet_stream_post_response_200 import OctetStreamTestsOctetStreamPostResponse200 from ...types import File, Response @@ -20,9 +21,8 @@ def _get_kwargs( "url": "/tests/octet_stream", } - _body = body.payload + _kwargs["content"] = body.payload - _kwargs["content"] = _body headers["Content-Type"] = "application/octet-stream" _kwargs["headers"] = headers @@ -30,15 +30,18 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[HTTPValidationError, str]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: if response.status_code == 200: - response_200 = cast(str, response.json()) + response_200 = OctetStreamTestsOctetStreamPostResponse200.from_dict(response.json()) + return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -46,8 +49,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[HTTPValidationError, str]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,9 +61,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: File, -) -> Response[Union[HTTPValidationError, str]]: +) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: """Binary (octet stream) request body Args: @@ -71,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, str]] + Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200] """ kwargs = _get_kwargs( @@ -87,9 +90,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: File, -) -> Optional[Union[HTTPValidationError, str]]: +) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: """Binary (octet stream) request body Args: @@ -100,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, str] + HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 """ return sync_detailed( @@ -111,9 +114,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: File, -) -> Response[Union[HTTPValidationError, str]]: +) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: """Binary (octet stream) request body Args: @@ -124,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, str]] + Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200] """ kwargs = _get_kwargs( @@ -138,9 +141,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: File, -) -> Optional[Union[HTTPValidationError, str]]: +) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: """Binary (octet stream) request body Args: @@ -151,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, str] + HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py index ec65d0363..82f464276 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,25 +20,25 @@ def _get_kwargs( "url": "/tests/post_form_data", } - _body = body.to_dict() + _kwargs["data"] = body.to_dict() - _kwargs["data"] = _body headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AFormData, ) -> Response[Any]: """Post form data @@ -80,7 +80,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: AFormData, ) -> Response[Any]: """Post form data diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py index bc5ad7cc4..e15881947 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -20,25 +20,25 @@ def _get_kwargs( "url": "/tests/post_form_data_inline", } - _body = body.to_dict() + _kwargs["data"] = body.to_dict() - _kwargs["data"] = _body headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +49,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostFormDataInlineBody, ) -> Response[Any]: """Post form data (inline schema) @@ -80,7 +80,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostFormDataInlineBody, ) -> Response[Any]: """Post form data (inline schema) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py index ba40de26f..498d0572e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -20,9 +20,8 @@ def _get_kwargs( "url": "/tests/json_body/string", } - _body = body + _kwargs["json"] = body - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -30,15 +29,17 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[HTTPValidationError, str]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -46,8 +47,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[HTTPValidationError, str]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,9 +59,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Response[Union[HTTPValidationError, str]]: +) -> Response[HTTPValidationError | str]: """Json Body Which is String Args: @@ -71,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, str]] + Response[HTTPValidationError | str] """ kwargs = _get_kwargs( @@ -87,9 +88,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Optional[Union[HTTPValidationError, str]]: +) -> HTTPValidationError | str | None: """Json Body Which is String Args: @@ -100,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, str] + HTTPValidationError | str """ return sync_detailed( @@ -111,9 +112,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Response[Union[HTTPValidationError, str]]: +) -> Response[HTTPValidationError | str]: """Json Body Which is String Args: @@ -124,7 +125,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[HTTPValidationError, str]] + Response[HTTPValidationError | str] """ kwargs = _get_kwargs( @@ -138,9 +139,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: str, -) -> Optional[Union[HTTPValidationError, str]]: +) -> HTTPValidationError | str | None: """Json Body Which is String Args: @@ -151,7 +152,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[HTTPValidationError, str] + HTTPValidationError | str """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index 287ea4a1a..ea2e45c94 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/tests/inline_objects", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -31,12 +30,13 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[TestInlineObjectsResponse200]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> TestInlineObjectsResponse200 | None: if response.status_code == 200: response_200 = TestInlineObjectsResponse200.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -44,7 +44,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[TestInlineObjectsResponse200]: return Response( status_code=HTTPStatus(response.status_code), @@ -56,7 +56,7 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: TestInlineObjectsBody, ) -> Response[TestInlineObjectsResponse200]: """Test Inline Objects @@ -85,9 +85,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: TestInlineObjectsBody, -) -> Optional[TestInlineObjectsResponse200]: +) -> TestInlineObjectsResponse200 | None: """Test Inline Objects Args: @@ -109,7 +109,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: TestInlineObjectsBody, ) -> Response[TestInlineObjectsResponse200]: """Test Inline Objects @@ -136,9 +136,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: TestInlineObjectsBody, -) -> Optional[TestInlineObjectsResponse200]: +) -> TestInlineObjectsResponse200 | None: """Test Inline Objects Args: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 22ac00650..0c7f73b45 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -24,18 +24,20 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if response.status_code == 401: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -46,7 +48,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, my_token: str, ) -> Response[Any]: """TOKEN_WITH_COOKIE @@ -77,7 +79,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, my_token: str, ) -> Response[Any]: """TOKEN_WITH_COOKIE diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index 61e8434e6..794c38b98 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -17,16 +17,17 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -37,7 +38,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """Unsupported Content @@ -60,7 +61,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, ) -> Response[Any]: """Unsupported Content diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 9f1864ec3..7498e9aee 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,24 +21,24 @@ def _get_kwargs( "url": "/tests/upload", } - _body = body.to_multipart() - - _kwargs["files"] = _body + _kwargs["files"] = body.to_multipart() _kwargs["headers"] = headers return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() return response_200 + if response.status_code == 422: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -46,8 +46,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, HTTPValidationError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,9 +58,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: BodyUploadFileTestsUploadPost, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Upload File Upload a file @@ -73,7 +73,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -89,9 +89,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: BodyUploadFileTestsUploadPost, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Upload File Upload a file @@ -104,7 +104,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return sync_detailed( @@ -115,9 +115,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: BodyUploadFileTestsUploadPost, -) -> Response[Union[Any, HTTPValidationError]]: +) -> Response[Any | HTTPValidationError]: """Upload File Upload a file @@ -130,7 +130,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, HTTPValidationError]] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -144,9 +144,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: BodyUploadFileTestsUploadPost, -) -> Optional[Union[Any, HTTPValidationError]]: +) -> Any | HTTPValidationError | None: """Upload File Upload a file @@ -159,7 +159,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, HTTPValidationError] + Any | HTTPValidationError """ return ( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py deleted file mode 100644 index 3f8edc817..000000000 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ /dev/null @@ -1,173 +0,0 @@ -from http import HTTPStatus -from typing import Any, Optional, Union - -import httpx - -from ... import errors -from ...client import AuthenticatedClient, Client -from ...models.http_validation_error import HTTPValidationError -from ...types import File, Response - - -def _get_kwargs( - *, - body: list[File], -) -> dict[str, Any]: - headers: dict[str, Any] = {} - - _kwargs: dict[str, Any] = { - "method": "post", - "url": "/tests/upload/multiple", - } - - _body = [] - for body_item_data in body: - body_item = body_item_data.to_tuple() - - _body.append(body_item) - - _kwargs["files"] = _body - - _kwargs["headers"] = headers - return _kwargs - - -def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: - response_200 = response.json() - return response_200 - if response.status_code == 422: - response_422 = HTTPValidationError.from_dict(response.json()) - - return response_422 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, HTTPValidationError]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - *, - client: Union[AuthenticatedClient, Client], - body: list[File], -) -> Response[Union[Any, HTTPValidationError]]: - """Upload multiple files - - Upload several files in the same request - - Args: - body (list[File]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, HTTPValidationError]] - """ - - kwargs = _get_kwargs( - body=body, - ) - - response = client.get_httpx_client().request( - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - *, - client: Union[AuthenticatedClient, Client], - body: list[File], -) -> Optional[Union[Any, HTTPValidationError]]: - """Upload multiple files - - Upload several files in the same request - - Args: - body (list[File]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, HTTPValidationError] - """ - - return sync_detailed( - client=client, - body=body, - ).parsed - - -async def asyncio_detailed( - *, - client: Union[AuthenticatedClient, Client], - body: list[File], -) -> Response[Union[Any, HTTPValidationError]]: - """Upload multiple files - - Upload several files in the same request - - Args: - body (list[File]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, HTTPValidationError]] - """ - - kwargs = _get_kwargs( - body=body, - ) - - response = await client.get_async_httpx_client().request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - *, - client: Union[AuthenticatedClient, Client], - body: list[File], -) -> Optional[Union[Any, HTTPValidationError]]: - """Upload multiple files - - Upload several files in the same request - - Args: - body (list[File]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, HTTPValidationError] - """ - - return ( - await asyncio_detailed( - client=client, - body=body, - ) - ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index b46550153..825672fbd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -27,16 +27,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,7 +48,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, import_: str, ) -> Response[Any]: """ @@ -75,7 +76,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, import_: str, ) -> Response[Any]: """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/client.py b/end_to_end_tests/golden-record/my_test_api_client/client.py index e80446f10..1b7055ab8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/client.py +++ b/end_to_end_tests/golden-record/my_test_api_client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/__init__.py b/end_to_end_tests/golden-record/my_test_api_client/models/__init__.py index f354c31c7..da9b57b85 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/__init__.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/__init__.py @@ -72,9 +72,10 @@ from .model_with_recursive_ref_in_additional_properties import ModelWithRecursiveRefInAdditionalProperties from .model_with_union_property import ModelWithUnionProperty from .model_with_union_property_inlined import ModelWithUnionPropertyInlined -from .model_with_union_property_inlined_fruit_type_0 import ModelWithUnionPropertyInlinedFruitType0 -from .model_with_union_property_inlined_fruit_type_1 import ModelWithUnionPropertyInlinedFruitType1 +from .model_with_union_property_inlined_apples import ModelWithUnionPropertyInlinedApples +from .model_with_union_property_inlined_bananas import ModelWithUnionPropertyInlinedBananas from .none import None_ +from .octet_stream_tests_octet_stream_post_response_200 import OctetStreamTestsOctetStreamPostResponse200 from .post_bodies_multiple_data_body import PostBodiesMultipleDataBody from .post_bodies_multiple_files_body import PostBodiesMultipleFilesBody from .post_bodies_multiple_json_body import PostBodiesMultipleJsonBody @@ -85,6 +86,9 @@ from .post_responses_unions_simple_before_complex_response_200a_type_1 import ( PostResponsesUnionsSimpleBeforeComplexResponse200AType1, ) +from .status_code_patterns_response_2xx import StatusCodePatternsResponse2XX +from .status_code_patterns_response_2xx_status import StatusCodePatternsResponse2XXStatus +from .status_code_patterns_response_4xx import StatusCodePatternsResponse4XX from .test_inline_objects_body import TestInlineObjectsBody from .test_inline_objects_response_200 import TestInlineObjectsResponse200 from .validation_error import ValidationError @@ -154,9 +158,10 @@ "ModelWithRecursiveRefInAdditionalProperties", "ModelWithUnionProperty", "ModelWithUnionPropertyInlined", - "ModelWithUnionPropertyInlinedFruitType0", - "ModelWithUnionPropertyInlinedFruitType1", + "ModelWithUnionPropertyInlinedApples", + "ModelWithUnionPropertyInlinedBananas", "None_", + "OctetStreamTestsOctetStreamPostResponse200", "PostBodiesMultipleDataBody", "PostBodiesMultipleFilesBody", "PostBodiesMultipleJsonBody", @@ -165,6 +170,9 @@ "PostNamingPropertyConflictWithImportResponse200", "PostResponsesUnionsSimpleBeforeComplexResponse200", "PostResponsesUnionsSimpleBeforeComplexResponse200AType1", + "StatusCodePatternsResponse2XX", + "StatusCodePatternsResponse2XXStatus", + "StatusCodePatternsResponse4XX", "TestInlineObjectsBody", "TestInlineObjectsResponse200", "ValidationError", diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_1.py index efdee8d2b..635661b7b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_1.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class ADiscriminatedUnionType1: """ Attributes: - model_type (Union[Unset, str]): + model_type (str | Unset): """ - model_type: Union[Unset, str] = UNSET + model_type: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_type = d.pop("modelType", UNSET) a_discriminated_union_type_1 = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_2.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_2.py index 02f4870e6..0797af899 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_2.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_discriminated_union_type_2.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class ADiscriminatedUnionType2: """ Attributes: - model_type (Union[Unset, str]): + model_type (str | Unset): """ - model_type: Union[Unset, str] = UNSET + model_type: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_type = d.pop("modelType", UNSET) a_discriminated_union_type_2 = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py index 12c57c3bc..257054eb2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,11 +16,11 @@ class AFormData: """ Attributes: an_required_field (str): - an_optional_field (Union[Unset, str]): + an_optional_field (str | Unset): """ an_required_field: str - an_optional_field: Union[Unset, str] = UNSET + an_optional_field: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,8 +41,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) an_required_field = d.pop("an_required_field") an_optional_field = d.pop("an_optional_field", UNSET) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py index 5a81e6365..b9c2c362b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py @@ -1,5 +1,8 @@ +from __future__ import annotations + import datetime -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from uuid import UUID from attrs import define as _attrs_define @@ -25,58 +28,58 @@ class AModel: Attributes: an_enum_value (AnEnum): For testing Enums in all the ways they can be used an_allof_enum_with_overridden_default (AnAllOfEnum): Default: AnAllOfEnum.OVERRIDDEN_DEFAULT. - a_camel_date_time (Union[datetime.date, datetime.datetime]): + a_camel_date_time (datetime.date | datetime.datetime): a_date (datetime.date): - a_nullable_date (Union[None, datetime.date]): + a_nullable_date (datetime.date | None): a_uuid (UUID): - a_nullable_uuid (Union[None, UUID]): Default: UUID('07EF8B4D-AA09-4FFA-898D-C710796AFF41'). - required_nullable (Union[None, str]): + a_nullable_uuid (None | UUID): Default: UUID('07EF8B4D-AA09-4FFA-898D-C710796AFF41'). + required_nullable (None | str): required_not_nullable (str): - one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', Any]): - nullable_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', None]): + one_of_models (Any | FreeFormModel | ModelWithUnionProperty): + nullable_one_of_models (FreeFormModel | ModelWithUnionProperty | None): model (ModelWithUnionProperty): - nullable_model (Union['ModelWithUnionProperty', None]): - any_value (Union[Unset, Any]): Default: 'default'. - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): - nested_list_of_enums (Union[Unset, list[list[DifferentEnum]]]): - a_not_required_date (Union[Unset, datetime.date]): - a_not_required_uuid (Union[Unset, UUID]): - attr_1_leading_digit (Union[Unset, str]): - attr_leading_underscore (Union[Unset, str]): - not_required_nullable (Union[None, Unset, str]): - not_required_not_nullable (Union[Unset, str]): - not_required_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', Unset]): - not_required_nullable_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', None, Unset, str]): - not_required_model (Union[Unset, ModelWithUnionProperty]): - not_required_nullable_model (Union['ModelWithUnionProperty', None, Unset]): + nullable_model (ModelWithUnionProperty | None): + any_value (Any | Unset): Default: 'default'. + an_optional_allof_enum (AnAllOfEnum | Unset): + nested_list_of_enums (list[list[DifferentEnum]] | Unset): + a_not_required_date (datetime.date | Unset): + a_not_required_uuid (UUID | Unset): + attr_1_leading_digit (str | Unset): + attr_leading_underscore (str | Unset): + not_required_nullable (None | str | Unset): + not_required_not_nullable (str | Unset): + not_required_one_of_models (FreeFormModel | ModelWithUnionProperty | Unset): + not_required_nullable_one_of_models (FreeFormModel | ModelWithUnionProperty | None | str | Unset): + not_required_model (ModelWithUnionProperty | Unset): + not_required_nullable_model (ModelWithUnionProperty | None | Unset): """ an_enum_value: AnEnum - a_camel_date_time: Union[datetime.date, datetime.datetime] + a_camel_date_time: datetime.date | datetime.datetime a_date: datetime.date - a_nullable_date: Union[None, datetime.date] + a_nullable_date: datetime.date | None a_uuid: UUID - required_nullable: Union[None, str] + required_nullable: None | str required_not_nullable: str - one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", Any] - nullable_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", None] - model: "ModelWithUnionProperty" - nullable_model: Union["ModelWithUnionProperty", None] + one_of_models: Any | FreeFormModel | ModelWithUnionProperty + nullable_one_of_models: FreeFormModel | ModelWithUnionProperty | None + model: ModelWithUnionProperty + nullable_model: ModelWithUnionProperty | None an_allof_enum_with_overridden_default: AnAllOfEnum = AnAllOfEnum.OVERRIDDEN_DEFAULT - a_nullable_uuid: Union[None, UUID] = UUID("07EF8B4D-AA09-4FFA-898D-C710796AFF41") - any_value: Union[Unset, Any] = "default" - an_optional_allof_enum: Union[Unset, AnAllOfEnum] = UNSET - nested_list_of_enums: Union[Unset, list[list[DifferentEnum]]] = UNSET - a_not_required_date: Union[Unset, datetime.date] = UNSET - a_not_required_uuid: Union[Unset, UUID] = UNSET - attr_1_leading_digit: Union[Unset, str] = UNSET - attr_leading_underscore: Union[Unset, str] = UNSET - not_required_nullable: Union[None, Unset, str] = UNSET - not_required_not_nullable: Union[Unset, str] = UNSET - not_required_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", Unset] = UNSET - not_required_nullable_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str] = UNSET - not_required_model: Union[Unset, "ModelWithUnionProperty"] = UNSET - not_required_nullable_model: Union["ModelWithUnionProperty", None, Unset] = UNSET + a_nullable_uuid: None | UUID = UUID("07EF8B4D-AA09-4FFA-898D-C710796AFF41") + any_value: Any | Unset = "default" + an_optional_allof_enum: AnAllOfEnum | Unset = UNSET + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + a_not_required_date: datetime.date | Unset = UNSET + a_not_required_uuid: UUID | Unset = UNSET + attr_1_leading_digit: str | Unset = UNSET + attr_leading_underscore: str | Unset = UNSET + not_required_nullable: None | str | Unset = UNSET + not_required_not_nullable: str | Unset = UNSET + not_required_one_of_models: FreeFormModel | ModelWithUnionProperty | Unset = UNSET + not_required_nullable_one_of_models: FreeFormModel | ModelWithUnionProperty | None | str | Unset = UNSET + not_required_model: ModelWithUnionProperty | Unset = UNSET + not_required_nullable_model: ModelWithUnionProperty | None | Unset = UNSET def to_dict(self) -> dict[str, Any]: from ..models.free_form_model import FreeFormModel @@ -94,7 +97,7 @@ def to_dict(self) -> dict[str, Any]: a_date = self.a_date.isoformat() - a_nullable_date: Union[None, str] + a_nullable_date: None | str if isinstance(self.a_nullable_date, datetime.date): a_nullable_date = self.a_nullable_date.isoformat() else: @@ -102,18 +105,18 @@ def to_dict(self) -> dict[str, Any]: a_uuid = str(self.a_uuid) - a_nullable_uuid: Union[None, str] + a_nullable_uuid: None | str if isinstance(self.a_nullable_uuid, UUID): a_nullable_uuid = str(self.a_nullable_uuid) else: a_nullable_uuid = self.a_nullable_uuid - required_nullable: Union[None, str] + required_nullable: None | str required_nullable = self.required_nullable required_not_nullable = self.required_not_nullable - one_of_models: Union[Any, dict[str, Any]] + one_of_models: Any | dict[str, Any] if isinstance(self.one_of_models, FreeFormModel): one_of_models = self.one_of_models.to_dict() elif isinstance(self.one_of_models, ModelWithUnionProperty): @@ -121,7 +124,7 @@ def to_dict(self) -> dict[str, Any]: else: one_of_models = self.one_of_models - nullable_one_of_models: Union[None, dict[str, Any]] + nullable_one_of_models: dict[str, Any] | None if isinstance(self.nullable_one_of_models, FreeFormModel): nullable_one_of_models = self.nullable_one_of_models.to_dict() elif isinstance(self.nullable_one_of_models, ModelWithUnionProperty): @@ -131,7 +134,7 @@ def to_dict(self) -> dict[str, Any]: model = self.model.to_dict() - nullable_model: Union[None, dict[str, Any]] + nullable_model: dict[str, Any] | None if isinstance(self.nullable_model, ModelWithUnionProperty): nullable_model = self.nullable_model.to_dict() else: @@ -139,11 +142,11 @@ def to_dict(self) -> dict[str, Any]: any_value = self.any_value - an_optional_allof_enum: Union[Unset, str] = UNSET + an_optional_allof_enum: str | Unset = UNSET if not isinstance(self.an_optional_allof_enum, Unset): an_optional_allof_enum = self.an_optional_allof_enum.value - nested_list_of_enums: Union[Unset, list[list[str]]] = UNSET + nested_list_of_enums: list[list[str]] | Unset = UNSET if not isinstance(self.nested_list_of_enums, Unset): nested_list_of_enums = [] for nested_list_of_enums_item_data in self.nested_list_of_enums: @@ -154,11 +157,11 @@ def to_dict(self) -> dict[str, Any]: nested_list_of_enums.append(nested_list_of_enums_item) - a_not_required_date: Union[Unset, str] = UNSET + a_not_required_date: str | Unset = UNSET if not isinstance(self.a_not_required_date, Unset): a_not_required_date = self.a_not_required_date.isoformat() - a_not_required_uuid: Union[Unset, str] = UNSET + a_not_required_uuid: str | Unset = UNSET if not isinstance(self.a_not_required_uuid, Unset): a_not_required_uuid = str(self.a_not_required_uuid) @@ -166,7 +169,7 @@ def to_dict(self) -> dict[str, Any]: attr_leading_underscore = self.attr_leading_underscore - not_required_nullable: Union[None, Unset, str] + not_required_nullable: None | str | Unset if isinstance(self.not_required_nullable, Unset): not_required_nullable = UNSET else: @@ -174,7 +177,7 @@ def to_dict(self) -> dict[str, Any]: not_required_not_nullable = self.not_required_not_nullable - not_required_one_of_models: Union[Unset, dict[str, Any]] + not_required_one_of_models: dict[str, Any] | Unset if isinstance(self.not_required_one_of_models, Unset): not_required_one_of_models = UNSET elif isinstance(self.not_required_one_of_models, FreeFormModel): @@ -182,7 +185,7 @@ def to_dict(self) -> dict[str, Any]: else: not_required_one_of_models = self.not_required_one_of_models.to_dict() - not_required_nullable_one_of_models: Union[None, Unset, dict[str, Any], str] + not_required_nullable_one_of_models: dict[str, Any] | None | str | Unset if isinstance(self.not_required_nullable_one_of_models, Unset): not_required_nullable_one_of_models = UNSET elif isinstance(self.not_required_nullable_one_of_models, FreeFormModel): @@ -192,11 +195,11 @@ def to_dict(self) -> dict[str, Any]: else: not_required_nullable_one_of_models = self.not_required_nullable_one_of_models - not_required_model: Union[Unset, dict[str, Any]] = UNSET + not_required_model: dict[str, Any] | Unset = UNSET if not isinstance(self.not_required_model, Unset): not_required_model = self.not_required_model.to_dict() - not_required_nullable_model: Union[None, Unset, dict[str, Any]] + not_required_nullable_model: dict[str, Any] | None | Unset if isinstance(self.not_required_nullable_model, Unset): not_required_nullable_model = UNSET elif isinstance(self.not_required_nullable_model, ModelWithUnionProperty): @@ -205,6 +208,7 @@ def to_dict(self) -> dict[str, Any]: not_required_nullable_model = self.not_required_nullable_model field_dict: dict[str, Any] = {} + field_dict.update( { "an_enum_value": an_enum_value, @@ -252,23 +256,23 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.free_form_model import FreeFormModel from ..models.model_with_union_property import ModelWithUnionProperty - d = src_dict.copy() + d = dict(src_dict) an_enum_value = AnEnum(d.pop("an_enum_value")) an_allof_enum_with_overridden_default = AnAllOfEnum(d.pop("an_allof_enum_with_overridden_default")) - def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.datetime]: + def _parse_a_camel_date_time(data: object) -> datetime.date | datetime.datetime: try: if not isinstance(data, str): raise TypeError() a_camel_date_time_type_0 = isoparse(data) return a_camel_date_time_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, str): raise TypeError() @@ -280,7 +284,7 @@ def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.date a_date = isoparse(d.pop("a_date")).date() - def _parse_a_nullable_date(data: object) -> Union[None, datetime.date]: + def _parse_a_nullable_date(data: object) -> datetime.date | None: if data is None: return data try: @@ -289,15 +293,15 @@ def _parse_a_nullable_date(data: object) -> Union[None, datetime.date]: a_nullable_date_type_0 = isoparse(data).date() return a_nullable_date_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, datetime.date], data) + return cast(datetime.date | None, data) a_nullable_date = _parse_a_nullable_date(d.pop("a_nullable_date")) a_uuid = UUID(d.pop("a_uuid")) - def _parse_a_nullable_uuid(data: object) -> Union[None, UUID]: + def _parse_a_nullable_uuid(data: object) -> None | UUID: if data is None: return data try: @@ -306,29 +310,29 @@ def _parse_a_nullable_uuid(data: object) -> Union[None, UUID]: a_nullable_uuid_type_0 = UUID(data) return a_nullable_uuid_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, UUID], data) + return cast(None | UUID, data) a_nullable_uuid = _parse_a_nullable_uuid(d.pop("a_nullable_uuid")) - def _parse_required_nullable(data: object) -> Union[None, str]: + def _parse_required_nullable(data: object) -> None | str: if data is None: return data - return cast(Union[None, str], data) + return cast(None | str, data) required_nullable = _parse_required_nullable(d.pop("required_nullable")) required_not_nullable = d.pop("required_not_nullable") - def _parse_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", Any]: + def _parse_one_of_models(data: object) -> Any | FreeFormModel | ModelWithUnionProperty: try: if not isinstance(data, dict): raise TypeError() one_of_models_type_0 = FreeFormModel.from_dict(data) return one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -336,13 +340,13 @@ def _parse_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnion one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", Any], data) + return cast(Any | FreeFormModel | ModelWithUnionProperty, data) one_of_models = _parse_one_of_models(d.pop("one_of_models")) - def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", None]: + def _parse_nullable_one_of_models(data: object) -> FreeFormModel | ModelWithUnionProperty | None: if data is None: return data try: @@ -351,7 +355,7 @@ def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "Model nullable_one_of_models_type_0 = FreeFormModel.from_dict(data) return nullable_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -359,15 +363,15 @@ def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "Model nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return nullable_one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", None], data) + return cast(FreeFormModel | ModelWithUnionProperty | None, data) nullable_one_of_models = _parse_nullable_one_of_models(d.pop("nullable_one_of_models")) model = ModelWithUnionProperty.from_dict(d.pop("model")) - def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None]: + def _parse_nullable_model(data: object) -> ModelWithUnionProperty | None: if data is None: return data try: @@ -376,42 +380,44 @@ def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None] nullable_model_type_1 = ModelWithUnionProperty.from_dict(data) return nullable_model_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["ModelWithUnionProperty", None], data) + return cast(ModelWithUnionProperty | None, data) nullable_model = _parse_nullable_model(d.pop("nullable_model")) any_value = d.pop("any_value", UNSET) _an_optional_allof_enum = d.pop("an_optional_allof_enum", UNSET) - an_optional_allof_enum: Union[Unset, AnAllOfEnum] + an_optional_allof_enum: AnAllOfEnum | Unset if isinstance(_an_optional_allof_enum, Unset): an_optional_allof_enum = UNSET else: an_optional_allof_enum = AnAllOfEnum(_an_optional_allof_enum) - nested_list_of_enums = [] _nested_list_of_enums = d.pop("nested_list_of_enums", UNSET) - for nested_list_of_enums_item_data in _nested_list_of_enums or []: - nested_list_of_enums_item = [] - _nested_list_of_enums_item = nested_list_of_enums_item_data - for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: - nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data) + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + if _nested_list_of_enums is not UNSET: + nested_list_of_enums = [] + for nested_list_of_enums_item_data in _nested_list_of_enums: + nested_list_of_enums_item = [] + _nested_list_of_enums_item = nested_list_of_enums_item_data + for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: + nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data) - nested_list_of_enums_item.append(nested_list_of_enums_item_item) + nested_list_of_enums_item.append(nested_list_of_enums_item_item) - nested_list_of_enums.append(nested_list_of_enums_item) + nested_list_of_enums.append(nested_list_of_enums_item) _a_not_required_date = d.pop("a_not_required_date", UNSET) - a_not_required_date: Union[Unset, datetime.date] + a_not_required_date: datetime.date | Unset if isinstance(_a_not_required_date, Unset): a_not_required_date = UNSET else: a_not_required_date = isoparse(_a_not_required_date).date() _a_not_required_uuid = d.pop("a_not_required_uuid", UNSET) - a_not_required_uuid: Union[Unset, UUID] + a_not_required_uuid: UUID | Unset if isinstance(_a_not_required_uuid, Unset): a_not_required_uuid = UNSET else: @@ -421,18 +427,18 @@ def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None] attr_leading_underscore = d.pop("_leading_underscore", UNSET) - def _parse_not_required_nullable(data: object) -> Union[None, Unset, str]: + def _parse_not_required_nullable(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) not_required_nullable = _parse_not_required_nullable(d.pop("not_required_nullable", UNSET)) not_required_not_nullable = d.pop("not_required_not_nullable", UNSET) - def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", Unset]: + def _parse_not_required_one_of_models(data: object) -> FreeFormModel | ModelWithUnionProperty | Unset: if isinstance(data, Unset): return data try: @@ -441,7 +447,7 @@ def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "M not_required_one_of_models_type_0 = FreeFormModel.from_dict(data) return not_required_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() @@ -453,7 +459,7 @@ def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "M def _parse_not_required_nullable_one_of_models( data: object, - ) -> Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str]: + ) -> FreeFormModel | ModelWithUnionProperty | None | str | Unset: if data is None: return data if isinstance(data, Unset): @@ -464,7 +470,7 @@ def _parse_not_required_nullable_one_of_models( not_required_nullable_one_of_models_type_0 = FreeFormModel.from_dict(data) return not_required_nullable_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -472,22 +478,22 @@ def _parse_not_required_nullable_one_of_models( not_required_nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return not_required_nullable_one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str], data) + return cast(FreeFormModel | ModelWithUnionProperty | None | str | Unset, data) not_required_nullable_one_of_models = _parse_not_required_nullable_one_of_models( d.pop("not_required_nullable_one_of_models", UNSET) ) _not_required_model = d.pop("not_required_model", UNSET) - not_required_model: Union[Unset, ModelWithUnionProperty] + not_required_model: ModelWithUnionProperty | Unset if isinstance(_not_required_model, Unset): not_required_model = UNSET else: not_required_model = ModelWithUnionProperty.from_dict(_not_required_model) - def _parse_not_required_nullable_model(data: object) -> Union["ModelWithUnionProperty", None, Unset]: + def _parse_not_required_nullable_model(data: object) -> ModelWithUnionProperty | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -498,9 +504,9 @@ def _parse_not_required_nullable_model(data: object) -> Union["ModelWithUnionPro not_required_nullable_model_type_1 = ModelWithUnionProperty.from_dict(data) return not_required_nullable_model_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["ModelWithUnionProperty", None, Unset], data) + return cast(ModelWithUnionProperty | None | Unset, data) not_required_nullable_model = _parse_not_required_nullable_model(d.pop("not_required_nullable_model", UNSET)) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py index c1a905195..b44dfc975 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py @@ -1,4 +1,7 @@ +from __future__ import annotations + import datetime +from collections.abc import Mapping from io import BytesIO from typing import Any, TypeVar, cast @@ -213,8 +216,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) enum_properties_ref = [] _enum_properties_ref = d.pop("enum_properties_ref") for componentsschemas_an_other_array_of_enum_item_data in _enum_properties_ref: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_has_properties_but_no_type.py b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_has_properties_but_no_type.py index 6a39f4951..3295dcf26 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_has_properties_but_no_type.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_has_properties_but_no_type.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,14 +16,14 @@ class AllOfHasPropertiesButNoType: """ Attributes: - a_sub_property (Union[Unset, str]): - type_ (Union[Unset, str]): - type_enum (Union[Unset, AllOfHasPropertiesButNoTypeTypeEnum]): + a_sub_property (str | Unset): + type_ (str | Unset): + type_enum (AllOfHasPropertiesButNoTypeTypeEnum | Unset): """ - a_sub_property: Union[Unset, str] = UNSET - type_: Union[Unset, str] = UNSET - type_enum: Union[Unset, AllOfHasPropertiesButNoTypeTypeEnum] = UNSET + a_sub_property: str | Unset = UNSET + type_: str | Unset = UNSET + type_enum: AllOfHasPropertiesButNoTypeTypeEnum | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -28,7 +31,7 @@ def to_dict(self) -> dict[str, Any]: type_ = self.type_ - type_enum: Union[Unset, int] = UNSET + type_enum: int | Unset = UNSET if not isinstance(self.type_enum, Unset): type_enum = self.type_enum.value @@ -45,14 +48,14 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_sub_property = d.pop("a_sub_property", UNSET) type_ = d.pop("type", UNSET) _type_enum = d.pop("type_enum", UNSET) - type_enum: Union[Unset, AllOfHasPropertiesButNoTypeTypeEnum] + type_enum: AllOfHasPropertiesButNoTypeTypeEnum | Unset if isinstance(_type_enum, Unset): type_enum = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py index dfb672ce1..65b6f97c6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,14 +16,14 @@ class AllOfSubModel: """ Attributes: - a_sub_property (Union[Unset, str]): - type_ (Union[Unset, str]): - type_enum (Union[Unset, AllOfSubModelTypeEnum]): + a_sub_property (str | Unset): + type_ (str | Unset): + type_enum (AllOfSubModelTypeEnum | Unset): """ - a_sub_property: Union[Unset, str] = UNSET - type_: Union[Unset, str] = UNSET - type_enum: Union[Unset, AllOfSubModelTypeEnum] = UNSET + a_sub_property: str | Unset = UNSET + type_: str | Unset = UNSET + type_enum: AllOfSubModelTypeEnum | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -28,7 +31,7 @@ def to_dict(self) -> dict[str, Any]: type_ = self.type_ - type_enum: Union[Unset, int] = UNSET + type_enum: int | Unset = UNSET if not isinstance(self.type_enum, Unset): type_enum = self.type_enum.value @@ -45,14 +48,14 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_sub_property = d.pop("a_sub_property", UNSET) type_ = d.pop("type", UNSET) _type_enum = d.pop("type_enum", UNSET) - type_enum: Union[Unset, AllOfSubModelTypeEnum] + type_enum: AllOfSubModelTypeEnum | Unset if isinstance(_type_enum, Unset): type_enum = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_a_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_a_item.py index 02e9cfa4b..8750fb194 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_a_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_a_item.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,14 +19,14 @@ class AnArrayWithACircularRefInItemsObjectAItem: """ Attributes: - circular (Union[Unset, list['AnArrayWithACircularRefInItemsObjectBItem']]): + circular (list[AnArrayWithACircularRefInItemsObjectBItem] | Unset): """ - circular: Union[Unset, list["AnArrayWithACircularRefInItemsObjectBItem"]] = UNSET + circular: list[AnArrayWithACircularRefInItemsObjectBItem] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - circular: Union[Unset, list[dict[str, Any]]] = UNSET + circular: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.circular, Unset): circular = [] for componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data in self.circular: @@ -41,22 +44,24 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.an_array_with_a_circular_ref_in_items_object_b_item import ( AnArrayWithACircularRefInItemsObjectBItem, ) - d = src_dict.copy() - circular = [] + d = dict(src_dict) _circular = d.pop("circular", UNSET) - for componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data in _circular or []: - componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item = ( - AnArrayWithACircularRefInItemsObjectBItem.from_dict( - componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data + circular: list[AnArrayWithACircularRefInItemsObjectBItem] | Unset = UNSET + if _circular is not UNSET: + circular = [] + for componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data in _circular: + componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item = ( + AnArrayWithACircularRefInItemsObjectBItem.from_dict( + componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item_data + ) ) - ) - circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item) + circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_b_item) an_array_with_a_circular_ref_in_items_object_a_item = cls( circular=circular, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_a_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_a_item.py index c72c0160a..06ce50b1e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_a_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_a_item.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -16,7 +19,7 @@ class AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem: """ """ - additional_properties: dict[str, list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem"]] = ( + additional_properties: dict[str, list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem]] = ( _attrs_field(init=False, factory=dict) ) @@ -35,12 +38,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.an_array_with_a_circular_ref_in_items_object_additional_properties_b_item import ( AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem, ) - d = src_dict.copy() + d = dict(src_dict) an_array_with_a_circular_ref_in_items_object_additional_properties_a_item = cls() additional_properties = {} @@ -71,12 +74,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem"]: + def __getitem__(self, key: str) -> list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem]: return self.additional_properties[key] - def __setitem__( - self, key: str, value: list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem"] - ) -> None: + def __setitem__(self, key: str, value: list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem]) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_b_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_b_item.py index 7ffb50a16..689ac0127 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_b_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_additional_properties_b_item.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -16,7 +19,7 @@ class AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem: """ """ - additional_properties: dict[str, list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem"]] = ( + additional_properties: dict[str, list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem]] = ( _attrs_field(init=False, factory=dict) ) @@ -35,12 +38,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.an_array_with_a_circular_ref_in_items_object_additional_properties_a_item import ( AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem, ) - d = src_dict.copy() + d = dict(src_dict) an_array_with_a_circular_ref_in_items_object_additional_properties_b_item = cls() additional_properties = {} @@ -71,12 +74,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem"]: + def __getitem__(self, key: str) -> list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem]: return self.additional_properties[key] - def __setitem__( - self, key: str, value: list["AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem"] - ) -> None: + def __setitem__(self, key: str, value: list[AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem]) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_b_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_b_item.py index 6d5e83a65..0d4f07ece 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_b_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_circular_ref_in_items_object_b_item.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,14 +19,14 @@ class AnArrayWithACircularRefInItemsObjectBItem: """ Attributes: - circular (Union[Unset, list['AnArrayWithACircularRefInItemsObjectAItem']]): + circular (list[AnArrayWithACircularRefInItemsObjectAItem] | Unset): """ - circular: Union[Unset, list["AnArrayWithACircularRefInItemsObjectAItem"]] = UNSET + circular: list[AnArrayWithACircularRefInItemsObjectAItem] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - circular: Union[Unset, list[dict[str, Any]]] = UNSET + circular: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.circular, Unset): circular = [] for componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data in self.circular: @@ -41,22 +44,24 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.an_array_with_a_circular_ref_in_items_object_a_item import ( AnArrayWithACircularRefInItemsObjectAItem, ) - d = src_dict.copy() - circular = [] + d = dict(src_dict) _circular = d.pop("circular", UNSET) - for componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data in _circular or []: - componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item = ( - AnArrayWithACircularRefInItemsObjectAItem.from_dict( - componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data + circular: list[AnArrayWithACircularRefInItemsObjectAItem] | Unset = UNSET + if _circular is not UNSET: + circular = [] + for componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data in _circular: + componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item = ( + AnArrayWithACircularRefInItemsObjectAItem.from_dict( + componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item_data + ) ) - ) - circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item) + circular.append(componentsschemas_an_array_with_a_circular_ref_in_items_object_a_item) an_array_with_a_circular_ref_in_items_object_b_item = cls( circular=circular, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_additional_properties_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_additional_properties_item.py index 14dc6ba26..10b6e6c93 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_additional_properties_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_additional_properties_item.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -10,7 +13,7 @@ class AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem: """ """ - additional_properties: dict[str, list["AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem"]] = ( + additional_properties: dict[str, list[AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem]] = ( _attrs_field(init=False, factory=dict) ) @@ -27,8 +30,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) an_array_with_a_recursive_ref_in_items_object_additional_properties_item = cls() additional_properties = {} @@ -59,12 +62,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> list["AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem"]: + def __getitem__(self, key: str) -> list[AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem]: return self.additional_properties[key] - def __setitem__( - self, key: str, value: list["AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem"] - ) -> None: + def __setitem__(self, key: str, value: list[AnArrayWithARecursiveRefInItemsObjectAdditionalPropertiesItem]) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_item.py b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_item.py index c8629e83d..581a9f622 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_item.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/an_array_with_a_recursive_ref_in_items_object_item.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,14 +15,14 @@ class AnArrayWithARecursiveRefInItemsObjectItem: """ Attributes: - recursive (Union[Unset, list['AnArrayWithARecursiveRefInItemsObjectItem']]): + recursive (list[AnArrayWithARecursiveRefInItemsObjectItem] | Unset): """ - recursive: Union[Unset, list["AnArrayWithARecursiveRefInItemsObjectItem"]] = UNSET + recursive: list[AnArrayWithARecursiveRefInItemsObjectItem] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - recursive: Union[Unset, list[dict[str, Any]]] = UNSET + recursive: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.recursive, Unset): recursive = [] for componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data in self.recursive: @@ -37,18 +40,20 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() - recursive = [] + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _recursive = d.pop("recursive", UNSET) - for componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data in _recursive or []: - componentsschemas_an_array_with_a_recursive_ref_in_items_object_item = ( - AnArrayWithARecursiveRefInItemsObjectItem.from_dict( - componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data + recursive: list[AnArrayWithARecursiveRefInItemsObjectItem] | Unset = UNSET + if _recursive is not UNSET: + recursive = [] + for componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data in _recursive: + componentsschemas_an_array_with_a_recursive_ref_in_items_object_item = ( + AnArrayWithARecursiveRefInItemsObjectItem.from_dict( + componentsschemas_an_array_with_a_recursive_ref_in_items_object_item_data + ) ) - ) - recursive.append(componentsschemas_an_array_with_a_recursive_ref_in_items_object_item) + recursive.append(componentsschemas_an_array_with_a_recursive_ref_in_items_object_item) an_array_with_a_recursive_ref_in_items_object_item = cls( recursive=recursive, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py index df2d9b2cd..7c58d1a9c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,24 +17,24 @@ class AnotherAllOfSubModel: """ Attributes: - another_sub_property (Union[Unset, str]): - type_ (Union[Unset, AnotherAllOfSubModelType]): - type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): + another_sub_property (str | Unset): + type_ (AnotherAllOfSubModelType | Unset): + type_enum (AnotherAllOfSubModelTypeEnum | Unset): """ - another_sub_property: Union[Unset, str] = UNSET - type_: Union[Unset, AnotherAllOfSubModelType] = UNSET - type_enum: Union[Unset, AnotherAllOfSubModelTypeEnum] = UNSET + another_sub_property: str | Unset = UNSET + type_: AnotherAllOfSubModelType | Unset = UNSET + type_enum: AnotherAllOfSubModelTypeEnum | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: another_sub_property = self.another_sub_property - type_: Union[Unset, str] = UNSET + type_: str | Unset = UNSET if not isinstance(self.type_, Unset): type_ = self.type_.value - type_enum: Union[Unset, int] = UNSET + type_enum: int | Unset = UNSET if not isinstance(self.type_enum, Unset): type_enum = self.type_enum.value @@ -48,19 +51,19 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) another_sub_property = d.pop("another_sub_property", UNSET) _type_ = d.pop("type", UNSET) - type_: Union[Unset, AnotherAllOfSubModelType] + type_: AnotherAllOfSubModelType | Unset if isinstance(_type_, Unset): type_ = UNSET else: type_ = AnotherAllOfSubModelType(_type_) _type_enum = d.pop("type_enum", UNSET) - type_enum: Union[Unset, AnotherAllOfSubModelTypeEnum] + type_enum: AnotherAllOfSubModelTypeEnum | Unset if isinstance(_type_enum, Unset): type_enum = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py index 1c255cfcb..959cdccc8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py @@ -1,14 +1,18 @@ +from __future__ import annotations + import datetime import json +from collections.abc import Mapping from io import BytesIO -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from dateutil.parser import isoparse +from .. import types from ..models.different_enum import DifferentEnum -from ..types import UNSET, File, FileJsonType, Unset +from ..types import UNSET, File, FileTypes, Unset if TYPE_CHECKING: from ..models.a_form_data import AFormData @@ -34,34 +38,34 @@ class BodyUploadFileTestsUploadPost: some_file (File): some_required_number (float): some_object (BodyUploadFileTestsUploadPostSomeObject): - some_nullable_object (Union['BodyUploadFileTestsUploadPostSomeNullableObject', None]): - some_optional_file (Union[Unset, File]): - some_string (Union[Unset, str]): Default: 'some_default_string'. - a_datetime (Union[Unset, datetime.datetime]): - a_date (Union[Unset, datetime.date]): - some_number (Union[Unset, float]): - some_nullable_number (Union[None, Unset, float]): - some_int_array (Union[Unset, list[Union[None, int]]]): - some_array (Union[None, Unset, list['AFormData']]): - some_optional_object (Union[Unset, BodyUploadFileTestsUploadPostSomeOptionalObject]): - some_enum (Union[Unset, DifferentEnum]): An enumeration. + some_nullable_object (BodyUploadFileTestsUploadPostSomeNullableObject | None): + some_optional_file (File | Unset): + some_string (str | Unset): Default: 'some_default_string'. + a_datetime (datetime.datetime | Unset): + a_date (datetime.date | Unset): + some_number (float | Unset): + some_nullable_number (float | None | Unset): + some_int_array (list[int | None] | Unset): + some_array (list[AFormData] | None | Unset): + some_optional_object (BodyUploadFileTestsUploadPostSomeOptionalObject | Unset): + some_enum (DifferentEnum | Unset): An enumeration. """ some_file: File some_required_number: float - some_object: "BodyUploadFileTestsUploadPostSomeObject" - some_nullable_object: Union["BodyUploadFileTestsUploadPostSomeNullableObject", None] - some_optional_file: Union[Unset, File] = UNSET - some_string: Union[Unset, str] = "some_default_string" - a_datetime: Union[Unset, datetime.datetime] = UNSET - a_date: Union[Unset, datetime.date] = UNSET - some_number: Union[Unset, float] = UNSET - some_nullable_number: Union[None, Unset, float] = UNSET - some_int_array: Union[Unset, list[Union[None, int]]] = UNSET - some_array: Union[None, Unset, list["AFormData"]] = UNSET - some_optional_object: Union[Unset, "BodyUploadFileTestsUploadPostSomeOptionalObject"] = UNSET - some_enum: Union[Unset, DifferentEnum] = UNSET - additional_properties: dict[str, "BodyUploadFileTestsUploadPostAdditionalProperty"] = _attrs_field( + some_object: BodyUploadFileTestsUploadPostSomeObject + some_nullable_object: BodyUploadFileTestsUploadPostSomeNullableObject | None + some_optional_file: File | Unset = UNSET + some_string: str | Unset = "some_default_string" + a_datetime: datetime.datetime | Unset = UNSET + a_date: datetime.date | Unset = UNSET + some_number: float | Unset = UNSET + some_nullable_number: float | None | Unset = UNSET + some_int_array: list[int | None] | Unset = UNSET + some_array: list[AFormData] | None | Unset = UNSET + some_optional_object: BodyUploadFileTestsUploadPostSomeOptionalObject | Unset = UNSET + some_enum: DifferentEnum | Unset = UNSET + additional_properties: dict[str, BodyUploadFileTestsUploadPostAdditionalProperty] = _attrs_field( init=False, factory=dict ) @@ -76,43 +80,43 @@ def to_dict(self) -> dict[str, Any]: some_object = self.some_object.to_dict() - some_nullable_object: Union[None, dict[str, Any]] + some_nullable_object: dict[str, Any] | None if isinstance(self.some_nullable_object, BodyUploadFileTestsUploadPostSomeNullableObject): some_nullable_object = self.some_nullable_object.to_dict() else: some_nullable_object = self.some_nullable_object - some_optional_file: Union[Unset, FileJsonType] = UNSET + some_optional_file: FileTypes | Unset = UNSET if not isinstance(self.some_optional_file, Unset): some_optional_file = self.some_optional_file.to_tuple() some_string = self.some_string - a_datetime: Union[Unset, str] = UNSET + a_datetime: str | Unset = UNSET if not isinstance(self.a_datetime, Unset): a_datetime = self.a_datetime.isoformat() - a_date: Union[Unset, str] = UNSET + a_date: str | Unset = UNSET if not isinstance(self.a_date, Unset): a_date = self.a_date.isoformat() some_number = self.some_number - some_nullable_number: Union[None, Unset, float] + some_nullable_number: float | None | Unset if isinstance(self.some_nullable_number, Unset): some_nullable_number = UNSET else: some_nullable_number = self.some_nullable_number - some_int_array: Union[Unset, list[Union[None, int]]] = UNSET + some_int_array: list[int | None] | Unset = UNSET if not isinstance(self.some_int_array, Unset): some_int_array = [] for some_int_array_item_data in self.some_int_array: - some_int_array_item: Union[None, int] + some_int_array_item: int | None some_int_array_item = some_int_array_item_data some_int_array.append(some_int_array_item) - some_array: Union[None, Unset, list[dict[str, Any]]] + some_array: list[dict[str, Any]] | None | Unset if isinstance(self.some_array, Unset): some_array = UNSET elif isinstance(self.some_array, list): @@ -124,17 +128,18 @@ def to_dict(self) -> dict[str, Any]: else: some_array = self.some_array - some_optional_object: Union[Unset, dict[str, Any]] = UNSET + some_optional_object: dict[str, Any] | Unset = UNSET if not isinstance(self.some_optional_object, Unset): some_optional_object = self.some_optional_object.to_dict() - some_enum: Union[Unset, str] = UNSET + some_enum: str | Unset = UNSET if not isinstance(self.some_enum, Unset): some_enum = self.some_enum.value field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = prop.to_dict() + field_dict.update( { "some_file": some_file, @@ -166,119 +171,83 @@ def to_dict(self) -> dict[str, Any]: return field_dict - def to_multipart(self) -> dict[str, Any]: - some_file = self.some_file.to_tuple() + def to_multipart(self) -> types.RequestFiles: + files: types.RequestFiles = [] - some_required_number = (None, str(self.some_required_number).encode(), "text/plain") + files.append(("some_file", self.some_file.to_tuple())) - some_object = (None, json.dumps(self.some_object.to_dict()).encode(), "application/json") + files.append(("some_required_number", (None, str(self.some_required_number).encode(), "text/plain"))) - some_nullable_object: tuple[None, bytes, str] + files.append(("some_object", (None, json.dumps(self.some_object.to_dict()).encode(), "application/json"))) if isinstance(self.some_nullable_object, BodyUploadFileTestsUploadPostSomeNullableObject): - some_nullable_object = (None, json.dumps(self.some_nullable_object.to_dict()).encode(), "application/json") + files.append( + ( + "some_nullable_object", + (None, json.dumps(self.some_nullable_object.to_dict()).encode(), "application/json"), + ) + ) else: - some_nullable_object = (None, str(self.some_nullable_object).encode(), "text/plain") + files.append(("some_nullable_object", (None, str(self.some_nullable_object).encode(), "text/plain"))) - some_optional_file: Union[Unset, FileJsonType] = UNSET if not isinstance(self.some_optional_file, Unset): - some_optional_file = self.some_optional_file.to_tuple() + files.append(("some_optional_file", self.some_optional_file.to_tuple())) - some_string = ( - self.some_string - if isinstance(self.some_string, Unset) - else (None, str(self.some_string).encode(), "text/plain") - ) + if not isinstance(self.some_string, Unset): + files.append(("some_string", (None, str(self.some_string).encode(), "text/plain"))) - a_datetime: Union[Unset, bytes] = UNSET if not isinstance(self.a_datetime, Unset): - a_datetime = self.a_datetime.isoformat().encode() + files.append(("a_datetime", (None, self.a_datetime.isoformat().encode(), "text/plain"))) - a_date: Union[Unset, bytes] = UNSET if not isinstance(self.a_date, Unset): - a_date = self.a_date.isoformat().encode() + files.append(("a_date", (None, self.a_date.isoformat().encode(), "text/plain"))) - some_number = ( - self.some_number - if isinstance(self.some_number, Unset) - else (None, str(self.some_number).encode(), "text/plain") - ) + if not isinstance(self.some_number, Unset): + files.append(("some_number", (None, str(self.some_number).encode(), "text/plain"))) - some_nullable_number: Union[Unset, tuple[None, bytes, str]] + if not isinstance(self.some_nullable_number, Unset): + if isinstance(self.some_nullable_number, float): + files.append(("some_nullable_number", (None, str(self.some_nullable_number).encode(), "text/plain"))) + else: + files.append(("some_nullable_number", (None, str(self.some_nullable_number).encode(), "text/plain"))) - if isinstance(self.some_nullable_number, Unset): - some_nullable_number = UNSET - elif isinstance(self.some_nullable_number, float): - some_nullable_number = (None, str(self.some_nullable_number).encode(), "text/plain") - else: - some_nullable_number = (None, str(self.some_nullable_number).encode(), "text/plain") - - some_int_array: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.some_int_array, Unset): - _temp_some_int_array = [] - for some_int_array_item_data in self.some_int_array: - some_int_array_item: Union[None, int] - some_int_array_item = some_int_array_item_data - _temp_some_int_array.append(some_int_array_item) - some_int_array = (None, json.dumps(_temp_some_int_array).encode(), "application/json") - - some_array: Union[Unset, tuple[None, bytes, str]] + for some_int_array_item_element in self.some_int_array: + if isinstance(some_int_array_item_element, int): + files.append(("some_int_array", (None, str(some_int_array_item_element).encode(), "text/plain"))) + else: + files.append(("some_int_array", (None, str(some_int_array_item_element).encode(), "text/plain"))) + + if not isinstance(self.some_array, Unset): + if isinstance(self.some_array, list): + for some_array_type_0_item_element in self.some_array: + files.append( + ( + "some_array", + (None, json.dumps(some_array_type_0_item_element.to_dict()).encode(), "application/json"), + ) + ) + else: + files.append(("some_array", (None, str(self.some_array).encode(), "text/plain"))) - if isinstance(self.some_array, Unset): - some_array = UNSET - elif isinstance(self.some_array, list): - _temp_some_array = [] - for some_array_type_0_item_data in self.some_array: - some_array_type_0_item = some_array_type_0_item_data.to_dict() - _temp_some_array.append(some_array_type_0_item) - some_array = (None, json.dumps(_temp_some_array).encode(), "application/json") - else: - some_array = (None, str(self.some_array).encode(), "text/plain") - - some_optional_object: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.some_optional_object, Unset): - some_optional_object = (None, json.dumps(self.some_optional_object.to_dict()).encode(), "application/json") + files.append( + ( + "some_optional_object", + (None, json.dumps(self.some_optional_object.to_dict()).encode(), "application/json"), + ) + ) - some_enum: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.some_enum, Unset): - some_enum = (None, str(self.some_enum.value).encode(), "text/plain") + files.append(("some_enum", (None, str(self.some_enum.value).encode(), "text/plain"))) - field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): - field_dict[prop_name] = (None, json.dumps(prop.to_dict()).encode(), "application/json") - field_dict.update( - { - "some_file": some_file, - "some_required_number": some_required_number, - "some_object": some_object, - "some_nullable_object": some_nullable_object, - } - ) - if some_optional_file is not UNSET: - field_dict["some_optional_file"] = some_optional_file - if some_string is not UNSET: - field_dict["some_string"] = some_string - if a_datetime is not UNSET: - field_dict["a_datetime"] = a_datetime - if a_date is not UNSET: - field_dict["a_date"] = a_date - if some_number is not UNSET: - field_dict["some_number"] = some_number - if some_nullable_number is not UNSET: - field_dict["some_nullable_number"] = some_nullable_number - if some_int_array is not UNSET: - field_dict["some_int_array"] = some_int_array - if some_array is not UNSET: - field_dict["some_array"] = some_array - if some_optional_object is not UNSET: - field_dict["some_optional_object"] = some_optional_object - if some_enum is not UNSET: - field_dict["some_enum"] = some_enum + files.append((prop_name, (None, json.dumps(prop.to_dict()).encode(), "application/json"))) - return field_dict + return files @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.a_form_data import AFormData from ..models.body_upload_file_tests_upload_post_additional_property import ( BodyUploadFileTestsUploadPostAdditionalProperty, @@ -291,14 +260,14 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: BodyUploadFileTestsUploadPostSomeOptionalObject, ) - d = src_dict.copy() + d = dict(src_dict) some_file = File(payload=BytesIO(d.pop("some_file"))) some_required_number = d.pop("some_required_number") some_object = BodyUploadFileTestsUploadPostSomeObject.from_dict(d.pop("some_object")) - def _parse_some_nullable_object(data: object) -> Union["BodyUploadFileTestsUploadPostSomeNullableObject", None]: + def _parse_some_nullable_object(data: object) -> BodyUploadFileTestsUploadPostSomeNullableObject | None: if data is None: return data try: @@ -307,14 +276,14 @@ def _parse_some_nullable_object(data: object) -> Union["BodyUploadFileTestsUploa some_nullable_object_type_0 = BodyUploadFileTestsUploadPostSomeNullableObject.from_dict(data) return some_nullable_object_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["BodyUploadFileTestsUploadPostSomeNullableObject", None], data) + return cast(BodyUploadFileTestsUploadPostSomeNullableObject | None, data) some_nullable_object = _parse_some_nullable_object(d.pop("some_nullable_object")) _some_optional_file = d.pop("some_optional_file", UNSET) - some_optional_file: Union[Unset, File] + some_optional_file: File | Unset if isinstance(_some_optional_file, Unset): some_optional_file = UNSET else: @@ -323,14 +292,14 @@ def _parse_some_nullable_object(data: object) -> Union["BodyUploadFileTestsUploa some_string = d.pop("some_string", UNSET) _a_datetime = d.pop("a_datetime", UNSET) - a_datetime: Union[Unset, datetime.datetime] + a_datetime: datetime.datetime | Unset if isinstance(_a_datetime, Unset): a_datetime = UNSET else: a_datetime = isoparse(_a_datetime) _a_date = d.pop("a_date", UNSET) - a_date: Union[Unset, datetime.date] + a_date: datetime.date | Unset if isinstance(_a_date, Unset): a_date = UNSET else: @@ -338,29 +307,31 @@ def _parse_some_nullable_object(data: object) -> Union["BodyUploadFileTestsUploa some_number = d.pop("some_number", UNSET) - def _parse_some_nullable_number(data: object) -> Union[None, Unset, float]: + def _parse_some_nullable_number(data: object) -> float | None | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, float], data) + return cast(float | None | Unset, data) some_nullable_number = _parse_some_nullable_number(d.pop("some_nullable_number", UNSET)) - some_int_array = [] _some_int_array = d.pop("some_int_array", UNSET) - for some_int_array_item_data in _some_int_array or []: + some_int_array: list[int | None] | Unset = UNSET + if _some_int_array is not UNSET: + some_int_array = [] + for some_int_array_item_data in _some_int_array: - def _parse_some_int_array_item(data: object) -> Union[None, int]: - if data is None: - return data - return cast(Union[None, int], data) + def _parse_some_int_array_item(data: object) -> int | None: + if data is None: + return data + return cast(int | None, data) - some_int_array_item = _parse_some_int_array_item(some_int_array_item_data) + some_int_array_item = _parse_some_int_array_item(some_int_array_item_data) - some_int_array.append(some_int_array_item) + some_int_array.append(some_int_array_item) - def _parse_some_array(data: object) -> Union[None, Unset, list["AFormData"]]: + def _parse_some_array(data: object) -> list[AFormData] | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -376,21 +347,21 @@ def _parse_some_array(data: object) -> Union[None, Unset, list["AFormData"]]: some_array_type_0.append(some_array_type_0_item) return some_array_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, Unset, list["AFormData"]], data) + return cast(list[AFormData] | None | Unset, data) some_array = _parse_some_array(d.pop("some_array", UNSET)) _some_optional_object = d.pop("some_optional_object", UNSET) - some_optional_object: Union[Unset, BodyUploadFileTestsUploadPostSomeOptionalObject] + some_optional_object: BodyUploadFileTestsUploadPostSomeOptionalObject | Unset if isinstance(_some_optional_object, Unset): some_optional_object = UNSET else: some_optional_object = BodyUploadFileTestsUploadPostSomeOptionalObject.from_dict(_some_optional_object) _some_enum = d.pop("some_enum", UNSET) - some_enum: Union[Unset, DifferentEnum] + some_enum: DifferentEnum | Unset if isinstance(_some_enum, Unset): some_enum = UNSET else: @@ -426,10 +397,10 @@ def _parse_some_array(data: object) -> Union[None, Unset, list["AFormData"]]: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "BodyUploadFileTestsUploadPostAdditionalProperty": + def __getitem__(self, key: str) -> BodyUploadFileTestsUploadPostAdditionalProperty: return self.additional_properties[key] - def __setitem__(self, key: str, value: "BodyUploadFileTestsUploadPostAdditionalProperty") -> None: + def __setitem__(self, key: str, value: BodyUploadFileTestsUploadPostAdditionalProperty) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py index 47dde1338..160cb2542 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class BodyUploadFileTestsUploadPostAdditionalProperty: """ Attributes: - foo (Union[Unset, str]): + foo (str | Unset): """ - foo: Union[Unset, str] = UNSET + foo: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) foo = d.pop("foo", UNSET) body_upload_file_tests_upload_post_additional_property = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py index 817dfd789..47796442d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class BodyUploadFileTestsUploadPostSomeNullableObject: """ Attributes: - bar (Union[Unset, str]): + bar (str | Unset): """ - bar: Union[Unset, str] = UNSET + bar: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) bar = d.pop("bar", UNSET) body_upload_file_tests_upload_post_some_nullable_object = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py index a074bb86f..0cc39b78b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -35,8 +38,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) num = d.pop("num") text = d.pop("text") diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py index e0ba4b364..f5658196c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) foo = d.pop("foo") body_upload_file_tests_upload_post_some_optional_object = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/extended.py b/end_to_end_tests/golden-record/my_test_api_client/models/extended.py index ffd6406c7..708aa4a90 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/extended.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/extended.py @@ -1,5 +1,8 @@ +from __future__ import annotations + import datetime -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from uuid import UUID from attrs import define as _attrs_define @@ -25,60 +28,60 @@ class Extended: Attributes: an_enum_value (AnEnum): For testing Enums in all the ways they can be used an_allof_enum_with_overridden_default (AnAllOfEnum): Default: AnAllOfEnum.OVERRIDDEN_DEFAULT. - a_camel_date_time (Union[datetime.date, datetime.datetime]): + a_camel_date_time (datetime.date | datetime.datetime): a_date (datetime.date): - a_nullable_date (Union[None, datetime.date]): + a_nullable_date (datetime.date | None): a_uuid (UUID): - a_nullable_uuid (Union[None, UUID]): Default: UUID('07EF8B4D-AA09-4FFA-898D-C710796AFF41'). - required_nullable (Union[None, str]): + a_nullable_uuid (None | UUID): Default: UUID('07EF8B4D-AA09-4FFA-898D-C710796AFF41'). + required_nullable (None | str): required_not_nullable (str): - one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', Any]): - nullable_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', None]): + one_of_models (Any | FreeFormModel | ModelWithUnionProperty): + nullable_one_of_models (FreeFormModel | ModelWithUnionProperty | None): model (ModelWithUnionProperty): - nullable_model (Union['ModelWithUnionProperty', None]): - any_value (Union[Unset, Any]): Default: 'default'. - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): - nested_list_of_enums (Union[Unset, list[list[DifferentEnum]]]): - a_not_required_date (Union[Unset, datetime.date]): - a_not_required_uuid (Union[Unset, UUID]): - attr_1_leading_digit (Union[Unset, str]): - attr_leading_underscore (Union[Unset, str]): - not_required_nullable (Union[None, Unset, str]): - not_required_not_nullable (Union[Unset, str]): - not_required_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', Unset]): - not_required_nullable_one_of_models (Union['FreeFormModel', 'ModelWithUnionProperty', None, Unset, str]): - not_required_model (Union[Unset, ModelWithUnionProperty]): - not_required_nullable_model (Union['ModelWithUnionProperty', None, Unset]): - from_extended (Union[Unset, str]): + nullable_model (ModelWithUnionProperty | None): + any_value (Any | Unset): Default: 'default'. + an_optional_allof_enum (AnAllOfEnum | Unset): + nested_list_of_enums (list[list[DifferentEnum]] | Unset): + a_not_required_date (datetime.date | Unset): + a_not_required_uuid (UUID | Unset): + attr_1_leading_digit (str | Unset): + attr_leading_underscore (str | Unset): + not_required_nullable (None | str | Unset): + not_required_not_nullable (str | Unset): + not_required_one_of_models (FreeFormModel | ModelWithUnionProperty | Unset): + not_required_nullable_one_of_models (FreeFormModel | ModelWithUnionProperty | None | str | Unset): + not_required_model (ModelWithUnionProperty | Unset): + not_required_nullable_model (ModelWithUnionProperty | None | Unset): + from_extended (str | Unset): """ an_enum_value: AnEnum - a_camel_date_time: Union[datetime.date, datetime.datetime] + a_camel_date_time: datetime.date | datetime.datetime a_date: datetime.date - a_nullable_date: Union[None, datetime.date] + a_nullable_date: datetime.date | None a_uuid: UUID - required_nullable: Union[None, str] + required_nullable: None | str required_not_nullable: str - one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", Any] - nullable_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", None] - model: "ModelWithUnionProperty" - nullable_model: Union["ModelWithUnionProperty", None] + one_of_models: Any | FreeFormModel | ModelWithUnionProperty + nullable_one_of_models: FreeFormModel | ModelWithUnionProperty | None + model: ModelWithUnionProperty + nullable_model: ModelWithUnionProperty | None an_allof_enum_with_overridden_default: AnAllOfEnum = AnAllOfEnum.OVERRIDDEN_DEFAULT - a_nullable_uuid: Union[None, UUID] = UUID("07EF8B4D-AA09-4FFA-898D-C710796AFF41") - any_value: Union[Unset, Any] = "default" - an_optional_allof_enum: Union[Unset, AnAllOfEnum] = UNSET - nested_list_of_enums: Union[Unset, list[list[DifferentEnum]]] = UNSET - a_not_required_date: Union[Unset, datetime.date] = UNSET - a_not_required_uuid: Union[Unset, UUID] = UNSET - attr_1_leading_digit: Union[Unset, str] = UNSET - attr_leading_underscore: Union[Unset, str] = UNSET - not_required_nullable: Union[None, Unset, str] = UNSET - not_required_not_nullable: Union[Unset, str] = UNSET - not_required_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", Unset] = UNSET - not_required_nullable_one_of_models: Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str] = UNSET - not_required_model: Union[Unset, "ModelWithUnionProperty"] = UNSET - not_required_nullable_model: Union["ModelWithUnionProperty", None, Unset] = UNSET - from_extended: Union[Unset, str] = UNSET + a_nullable_uuid: None | UUID = UUID("07EF8B4D-AA09-4FFA-898D-C710796AFF41") + any_value: Any | Unset = "default" + an_optional_allof_enum: AnAllOfEnum | Unset = UNSET + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + a_not_required_date: datetime.date | Unset = UNSET + a_not_required_uuid: UUID | Unset = UNSET + attr_1_leading_digit: str | Unset = UNSET + attr_leading_underscore: str | Unset = UNSET + not_required_nullable: None | str | Unset = UNSET + not_required_not_nullable: str | Unset = UNSET + not_required_one_of_models: FreeFormModel | ModelWithUnionProperty | Unset = UNSET + not_required_nullable_one_of_models: FreeFormModel | ModelWithUnionProperty | None | str | Unset = UNSET + not_required_model: ModelWithUnionProperty | Unset = UNSET + not_required_nullable_model: ModelWithUnionProperty | None | Unset = UNSET + from_extended: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -97,7 +100,7 @@ def to_dict(self) -> dict[str, Any]: a_date = self.a_date.isoformat() - a_nullable_date: Union[None, str] + a_nullable_date: None | str if isinstance(self.a_nullable_date, datetime.date): a_nullable_date = self.a_nullable_date.isoformat() else: @@ -105,18 +108,18 @@ def to_dict(self) -> dict[str, Any]: a_uuid = str(self.a_uuid) - a_nullable_uuid: Union[None, str] + a_nullable_uuid: None | str if isinstance(self.a_nullable_uuid, UUID): a_nullable_uuid = str(self.a_nullable_uuid) else: a_nullable_uuid = self.a_nullable_uuid - required_nullable: Union[None, str] + required_nullable: None | str required_nullable = self.required_nullable required_not_nullable = self.required_not_nullable - one_of_models: Union[Any, dict[str, Any]] + one_of_models: Any | dict[str, Any] if isinstance(self.one_of_models, FreeFormModel): one_of_models = self.one_of_models.to_dict() elif isinstance(self.one_of_models, ModelWithUnionProperty): @@ -124,7 +127,7 @@ def to_dict(self) -> dict[str, Any]: else: one_of_models = self.one_of_models - nullable_one_of_models: Union[None, dict[str, Any]] + nullable_one_of_models: dict[str, Any] | None if isinstance(self.nullable_one_of_models, FreeFormModel): nullable_one_of_models = self.nullable_one_of_models.to_dict() elif isinstance(self.nullable_one_of_models, ModelWithUnionProperty): @@ -134,7 +137,7 @@ def to_dict(self) -> dict[str, Any]: model = self.model.to_dict() - nullable_model: Union[None, dict[str, Any]] + nullable_model: dict[str, Any] | None if isinstance(self.nullable_model, ModelWithUnionProperty): nullable_model = self.nullable_model.to_dict() else: @@ -142,11 +145,11 @@ def to_dict(self) -> dict[str, Any]: any_value = self.any_value - an_optional_allof_enum: Union[Unset, str] = UNSET + an_optional_allof_enum: str | Unset = UNSET if not isinstance(self.an_optional_allof_enum, Unset): an_optional_allof_enum = self.an_optional_allof_enum.value - nested_list_of_enums: Union[Unset, list[list[str]]] = UNSET + nested_list_of_enums: list[list[str]] | Unset = UNSET if not isinstance(self.nested_list_of_enums, Unset): nested_list_of_enums = [] for nested_list_of_enums_item_data in self.nested_list_of_enums: @@ -157,11 +160,11 @@ def to_dict(self) -> dict[str, Any]: nested_list_of_enums.append(nested_list_of_enums_item) - a_not_required_date: Union[Unset, str] = UNSET + a_not_required_date: str | Unset = UNSET if not isinstance(self.a_not_required_date, Unset): a_not_required_date = self.a_not_required_date.isoformat() - a_not_required_uuid: Union[Unset, str] = UNSET + a_not_required_uuid: str | Unset = UNSET if not isinstance(self.a_not_required_uuid, Unset): a_not_required_uuid = str(self.a_not_required_uuid) @@ -169,7 +172,7 @@ def to_dict(self) -> dict[str, Any]: attr_leading_underscore = self.attr_leading_underscore - not_required_nullable: Union[None, Unset, str] + not_required_nullable: None | str | Unset if isinstance(self.not_required_nullable, Unset): not_required_nullable = UNSET else: @@ -177,7 +180,7 @@ def to_dict(self) -> dict[str, Any]: not_required_not_nullable = self.not_required_not_nullable - not_required_one_of_models: Union[Unset, dict[str, Any]] + not_required_one_of_models: dict[str, Any] | Unset if isinstance(self.not_required_one_of_models, Unset): not_required_one_of_models = UNSET elif isinstance(self.not_required_one_of_models, FreeFormModel): @@ -185,7 +188,7 @@ def to_dict(self) -> dict[str, Any]: else: not_required_one_of_models = self.not_required_one_of_models.to_dict() - not_required_nullable_one_of_models: Union[None, Unset, dict[str, Any], str] + not_required_nullable_one_of_models: dict[str, Any] | None | str | Unset if isinstance(self.not_required_nullable_one_of_models, Unset): not_required_nullable_one_of_models = UNSET elif isinstance(self.not_required_nullable_one_of_models, FreeFormModel): @@ -195,11 +198,11 @@ def to_dict(self) -> dict[str, Any]: else: not_required_nullable_one_of_models = self.not_required_nullable_one_of_models - not_required_model: Union[Unset, dict[str, Any]] = UNSET + not_required_model: dict[str, Any] | Unset = UNSET if not isinstance(self.not_required_model, Unset): not_required_model = self.not_required_model.to_dict() - not_required_nullable_model: Union[None, Unset, dict[str, Any]] + not_required_nullable_model: dict[str, Any] | None | Unset if isinstance(self.not_required_nullable_model, Unset): not_required_nullable_model = UNSET elif isinstance(self.not_required_nullable_model, ModelWithUnionProperty): @@ -260,23 +263,23 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.free_form_model import FreeFormModel from ..models.model_with_union_property import ModelWithUnionProperty - d = src_dict.copy() + d = dict(src_dict) an_enum_value = AnEnum(d.pop("an_enum_value")) an_allof_enum_with_overridden_default = AnAllOfEnum(d.pop("an_allof_enum_with_overridden_default")) - def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.datetime]: + def _parse_a_camel_date_time(data: object) -> datetime.date | datetime.datetime: try: if not isinstance(data, str): raise TypeError() a_camel_date_time_type_0 = isoparse(data) return a_camel_date_time_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, str): raise TypeError() @@ -288,7 +291,7 @@ def _parse_a_camel_date_time(data: object) -> Union[datetime.date, datetime.date a_date = isoparse(d.pop("a_date")).date() - def _parse_a_nullable_date(data: object) -> Union[None, datetime.date]: + def _parse_a_nullable_date(data: object) -> datetime.date | None: if data is None: return data try: @@ -297,15 +300,15 @@ def _parse_a_nullable_date(data: object) -> Union[None, datetime.date]: a_nullable_date_type_0 = isoparse(data).date() return a_nullable_date_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, datetime.date], data) + return cast(datetime.date | None, data) a_nullable_date = _parse_a_nullable_date(d.pop("a_nullable_date")) a_uuid = UUID(d.pop("a_uuid")) - def _parse_a_nullable_uuid(data: object) -> Union[None, UUID]: + def _parse_a_nullable_uuid(data: object) -> None | UUID: if data is None: return data try: @@ -314,29 +317,29 @@ def _parse_a_nullable_uuid(data: object) -> Union[None, UUID]: a_nullable_uuid_type_0 = UUID(data) return a_nullable_uuid_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, UUID], data) + return cast(None | UUID, data) a_nullable_uuid = _parse_a_nullable_uuid(d.pop("a_nullable_uuid")) - def _parse_required_nullable(data: object) -> Union[None, str]: + def _parse_required_nullable(data: object) -> None | str: if data is None: return data - return cast(Union[None, str], data) + return cast(None | str, data) required_nullable = _parse_required_nullable(d.pop("required_nullable")) required_not_nullable = d.pop("required_not_nullable") - def _parse_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", Any]: + def _parse_one_of_models(data: object) -> Any | FreeFormModel | ModelWithUnionProperty: try: if not isinstance(data, dict): raise TypeError() one_of_models_type_0 = FreeFormModel.from_dict(data) return one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -344,13 +347,13 @@ def _parse_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnion one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", Any], data) + return cast(Any | FreeFormModel | ModelWithUnionProperty, data) one_of_models = _parse_one_of_models(d.pop("one_of_models")) - def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", None]: + def _parse_nullable_one_of_models(data: object) -> FreeFormModel | ModelWithUnionProperty | None: if data is None: return data try: @@ -359,7 +362,7 @@ def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "Model nullable_one_of_models_type_0 = FreeFormModel.from_dict(data) return nullable_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -367,15 +370,15 @@ def _parse_nullable_one_of_models(data: object) -> Union["FreeFormModel", "Model nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return nullable_one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", None], data) + return cast(FreeFormModel | ModelWithUnionProperty | None, data) nullable_one_of_models = _parse_nullable_one_of_models(d.pop("nullable_one_of_models")) model = ModelWithUnionProperty.from_dict(d.pop("model")) - def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None]: + def _parse_nullable_model(data: object) -> ModelWithUnionProperty | None: if data is None: return data try: @@ -384,42 +387,44 @@ def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None] nullable_model_type_1 = ModelWithUnionProperty.from_dict(data) return nullable_model_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["ModelWithUnionProperty", None], data) + return cast(ModelWithUnionProperty | None, data) nullable_model = _parse_nullable_model(d.pop("nullable_model")) any_value = d.pop("any_value", UNSET) _an_optional_allof_enum = d.pop("an_optional_allof_enum", UNSET) - an_optional_allof_enum: Union[Unset, AnAllOfEnum] + an_optional_allof_enum: AnAllOfEnum | Unset if isinstance(_an_optional_allof_enum, Unset): an_optional_allof_enum = UNSET else: an_optional_allof_enum = AnAllOfEnum(_an_optional_allof_enum) - nested_list_of_enums = [] _nested_list_of_enums = d.pop("nested_list_of_enums", UNSET) - for nested_list_of_enums_item_data in _nested_list_of_enums or []: - nested_list_of_enums_item = [] - _nested_list_of_enums_item = nested_list_of_enums_item_data - for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: - nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data) + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + if _nested_list_of_enums is not UNSET: + nested_list_of_enums = [] + for nested_list_of_enums_item_data in _nested_list_of_enums: + nested_list_of_enums_item = [] + _nested_list_of_enums_item = nested_list_of_enums_item_data + for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: + nested_list_of_enums_item_item = DifferentEnum(nested_list_of_enums_item_item_data) - nested_list_of_enums_item.append(nested_list_of_enums_item_item) + nested_list_of_enums_item.append(nested_list_of_enums_item_item) - nested_list_of_enums.append(nested_list_of_enums_item) + nested_list_of_enums.append(nested_list_of_enums_item) _a_not_required_date = d.pop("a_not_required_date", UNSET) - a_not_required_date: Union[Unset, datetime.date] + a_not_required_date: datetime.date | Unset if isinstance(_a_not_required_date, Unset): a_not_required_date = UNSET else: a_not_required_date = isoparse(_a_not_required_date).date() _a_not_required_uuid = d.pop("a_not_required_uuid", UNSET) - a_not_required_uuid: Union[Unset, UUID] + a_not_required_uuid: UUID | Unset if isinstance(_a_not_required_uuid, Unset): a_not_required_uuid = UNSET else: @@ -429,18 +434,18 @@ def _parse_nullable_model(data: object) -> Union["ModelWithUnionProperty", None] attr_leading_underscore = d.pop("_leading_underscore", UNSET) - def _parse_not_required_nullable(data: object) -> Union[None, Unset, str]: + def _parse_not_required_nullable(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) not_required_nullable = _parse_not_required_nullable(d.pop("not_required_nullable", UNSET)) not_required_not_nullable = d.pop("not_required_not_nullable", UNSET) - def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "ModelWithUnionProperty", Unset]: + def _parse_not_required_one_of_models(data: object) -> FreeFormModel | ModelWithUnionProperty | Unset: if isinstance(data, Unset): return data try: @@ -449,7 +454,7 @@ def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "M not_required_one_of_models_type_0 = FreeFormModel.from_dict(data) return not_required_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() @@ -461,7 +466,7 @@ def _parse_not_required_one_of_models(data: object) -> Union["FreeFormModel", "M def _parse_not_required_nullable_one_of_models( data: object, - ) -> Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str]: + ) -> FreeFormModel | ModelWithUnionProperty | None | str | Unset: if data is None: return data if isinstance(data, Unset): @@ -472,7 +477,7 @@ def _parse_not_required_nullable_one_of_models( not_required_nullable_one_of_models_type_0 = FreeFormModel.from_dict(data) return not_required_nullable_one_of_models_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -480,22 +485,22 @@ def _parse_not_required_nullable_one_of_models( not_required_nullable_one_of_models_type_1 = ModelWithUnionProperty.from_dict(data) return not_required_nullable_one_of_models_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["FreeFormModel", "ModelWithUnionProperty", None, Unset, str], data) + return cast(FreeFormModel | ModelWithUnionProperty | None | str | Unset, data) not_required_nullable_one_of_models = _parse_not_required_nullable_one_of_models( d.pop("not_required_nullable_one_of_models", UNSET) ) _not_required_model = d.pop("not_required_model", UNSET) - not_required_model: Union[Unset, ModelWithUnionProperty] + not_required_model: ModelWithUnionProperty | Unset if isinstance(_not_required_model, Unset): not_required_model = UNSET else: not_required_model = ModelWithUnionProperty.from_dict(_not_required_model) - def _parse_not_required_nullable_model(data: object) -> Union["ModelWithUnionProperty", None, Unset]: + def _parse_not_required_nullable_model(data: object) -> ModelWithUnionProperty | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -506,9 +511,9 @@ def _parse_not_required_nullable_model(data: object) -> Union["ModelWithUnionPro not_required_nullable_model_type_1 = ModelWithUnionProperty.from_dict(data) return not_required_nullable_model_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["ModelWithUnionProperty", None, Unset], data) + return cast(ModelWithUnionProperty | None | Unset, data) not_required_nullable_model = _parse_not_required_nullable_model(d.pop("not_required_nullable_model", UNSET)) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py index 10770503b..038a4de17 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) free_form_model = cls() free_form_model.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_allof_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_allof_response_200.py index 5e24734e3..03b423308 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_allof_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_allof_response_200.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,26 +20,26 @@ class GetModelsAllofResponse200: """ Attributes: - aliased (Union[Unset, AModel]): A Model for testing all the ways custom objects can be used - extended (Union[Unset, Extended]): - model (Union[Unset, AModel]): A Model for testing all the ways custom objects can be used + aliased (AModel | Unset): A Model for testing all the ways custom objects can be used + extended (Extended | Unset): + model (AModel | Unset): A Model for testing all the ways custom objects can be used """ - aliased: Union[Unset, "AModel"] = UNSET - extended: Union[Unset, "Extended"] = UNSET - model: Union[Unset, "AModel"] = UNSET + aliased: AModel | Unset = UNSET + extended: Extended | Unset = UNSET + model: AModel | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - aliased: Union[Unset, dict[str, Any]] = UNSET + aliased: dict[str, Any] | Unset = UNSET if not isinstance(self.aliased, Unset): aliased = self.aliased.to_dict() - extended: Union[Unset, dict[str, Any]] = UNSET + extended: dict[str, Any] | Unset = UNSET if not isinstance(self.extended, Unset): extended = self.extended.to_dict() - model: Union[Unset, dict[str, Any]] = UNSET + model: dict[str, Any] | Unset = UNSET if not isinstance(self.model, Unset): model = self.model.to_dict() @@ -53,27 +56,27 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.a_model import AModel from ..models.extended import Extended - d = src_dict.copy() + d = dict(src_dict) _aliased = d.pop("aliased", UNSET) - aliased: Union[Unset, AModel] + aliased: AModel | Unset if isinstance(_aliased, Unset): aliased = UNSET else: aliased = AModel.from_dict(_aliased) _extended = d.pop("extended", UNSET) - extended: Union[Unset, Extended] + extended: Extended | Unset if isinstance(_extended, Unset): extended = UNSET else: extended = Extended.from_dict(_extended) _model = d.pop("model", UNSET) - model: Union[Unset, AModel] + model: AModel | Unset if isinstance(_model, Unset): model = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_0.py index 18c1e9e64..a079b954a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_0.py @@ -1,4 +1,7 @@ -from typing import Any, Literal, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,11 +16,11 @@ class GetModelsOneofWithRequiredConstResponse200Type0: """ Attributes: type_ (Literal['alpha']): - color (Union[Unset, str]): + color (str | Unset): """ type_: Literal["alpha"] - color: Union[Unset, str] = UNSET + color: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,8 +41,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) type_ = cast(Literal["alpha"], d.pop("type")) if type_ != "alpha": raise ValueError(f"type must match const 'alpha', got '{type_}'") diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_1.py index b1df54c32..04670dcba 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/get_models_oneof_with_required_const_response_200_type_1.py @@ -1,4 +1,7 @@ -from typing import Any, Literal, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,11 +16,11 @@ class GetModelsOneofWithRequiredConstResponse200Type1: """ Attributes: type_ (Literal['beta']): - texture (Union[Unset, str]): + texture (str | Unset): """ type_: Literal["beta"] - texture: Union[Unset, str] = UNSET + texture: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,8 +41,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) type_ = cast(Literal["beta"], d.pop("type")) if type_ != "beta": raise ValueError(f"type must match const 'beta', got '{type_}'") diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py index a423c6d2f..4d982caee 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -15,13 +18,13 @@ class HTTPValidationError: """ Attributes: - detail (Union[Unset, list['ValidationError']]): + detail (list[ValidationError] | Unset): """ - detail: Union[Unset, list["ValidationError"]] = UNSET + detail: list[ValidationError] | Unset = UNSET def to_dict(self) -> dict[str, Any]: - detail: Union[Unset, list[dict[str, Any]]] = UNSET + detail: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.detail, Unset): detail = [] for detail_item_data in self.detail: @@ -29,6 +32,7 @@ def to_dict(self) -> dict[str, Any]: detail.append(detail_item) field_dict: dict[str, Any] = {} + field_dict.update({}) if detail is not UNSET: field_dict["detail"] = detail @@ -36,16 +40,18 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.validation_error import ValidationError - d = src_dict.copy() - detail = [] + d = dict(src_dict) _detail = d.pop("detail", UNSET) - for detail_item_data in _detail or []: - detail_item = ValidationError.from_dict(detail_item_data) + detail: list[ValidationError] | Unset = UNSET + if _detail is not UNSET: + detail = [] + for detail_item_data in _detail: + detail_item = ValidationError.from_dict(detail_item_data) - detail.append(detail_item) + detail.append(detail_item) http_validation_error = cls( detail=detail, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py index 79788bf80..51f96846e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) import_ = cls() import_.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/json_like_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/json_like_body.py index bb4a31010..4e60f7ab6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/json_like_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/json_like_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class JsonLikeBody: """ Attributes: - a (Union[Unset, str]): + a (str | Unset): """ - a: Union[Unset, str] = UNSET + a: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a = d.pop("a", UNSET) json_like_body = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/mixed_case_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/mixed_case_response_200.py index adb74459d..93aead870 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/mixed_case_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/mixed_case_response_200.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,12 +15,12 @@ class MixedCaseResponse200: """ Attributes: - mixed_case (Union[Unset, str]): - mixedCase (Union[Unset, str]): + mixed_case (str | Unset): + mixedCase (str | Unset): """ - mixed_case: Union[Unset, str] = UNSET - mixedCase: Union[Unset, str] = UNSET + mixed_case: str | Unset = UNSET + mixedCase: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -36,8 +39,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) mixed_case = d.pop("mixed_case", UNSET) mixedCase = d.pop("mixedCase", UNSET) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py index a9fb59976..a8abde58a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,26 +17,26 @@ class ModelFromAllOf: """ Attributes: - a_sub_property (Union[Unset, str]): - type_ (Union[Unset, AnotherAllOfSubModelType]): - type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): - another_sub_property (Union[Unset, str]): + a_sub_property (str | Unset): + type_ (AnotherAllOfSubModelType | Unset): + type_enum (AnotherAllOfSubModelTypeEnum | Unset): + another_sub_property (str | Unset): """ - a_sub_property: Union[Unset, str] = UNSET - type_: Union[Unset, AnotherAllOfSubModelType] = UNSET - type_enum: Union[Unset, AnotherAllOfSubModelTypeEnum] = UNSET - another_sub_property: Union[Unset, str] = UNSET + a_sub_property: str | Unset = UNSET + type_: AnotherAllOfSubModelType | Unset = UNSET + type_enum: AnotherAllOfSubModelTypeEnum | Unset = UNSET + another_sub_property: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: a_sub_property = self.a_sub_property - type_: Union[Unset, str] = UNSET + type_: str | Unset = UNSET if not isinstance(self.type_, Unset): type_ = self.type_.value - type_enum: Union[Unset, int] = UNSET + type_enum: int | Unset = UNSET if not isinstance(self.type_enum, Unset): type_enum = self.type_enum.value @@ -54,19 +57,19 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_sub_property = d.pop("a_sub_property", UNSET) _type_ = d.pop("type", UNSET) - type_: Union[Unset, AnotherAllOfSubModelType] + type_: AnotherAllOfSubModelType | Unset if isinstance(_type_, Unset): type_ = UNSET else: type_ = AnotherAllOfSubModelType(_type_) _type_enum = d.pop("type_enum", UNSET) - type_enum: Union[Unset, AnotherAllOfSubModelTypeEnum] + type_enum: AnotherAllOfSubModelTypeEnum | Unset if isinstance(_type_enum, Unset): type_enum = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py index 6f4eefc36..4d79be855 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_name = cls() model_name.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_reference_with_periods.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_reference_with_periods.py index 004ed9b20..4700932e4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_reference_with_periods.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_reference_with_periods.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_reference_with_periods = cls() model_reference_with_periods.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py index a0cdb4f6a..9cef96f7c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,11 +21,11 @@ class ModelWithAdditionalPropertiesInlined: """ Attributes: - a_number (Union[Unset, float]): + a_number (float | Unset): """ - a_number: Union[Unset, float] = UNSET - additional_properties: dict[str, "ModelWithAdditionalPropertiesInlinedAdditionalProperty"] = _attrs_field( + a_number: float | Unset = UNSET + additional_properties: dict[str, ModelWithAdditionalPropertiesInlinedAdditionalProperty] = _attrs_field( init=False, factory=dict ) @@ -32,6 +35,7 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = prop.to_dict() + field_dict.update({}) if a_number is not UNSET: field_dict["a_number"] = a_number @@ -39,12 +43,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_additional_properties_inlined_additional_property import ( ModelWithAdditionalPropertiesInlinedAdditionalProperty, ) - d = src_dict.copy() + d = dict(src_dict) a_number = d.pop("a_number", UNSET) model_with_additional_properties_inlined = cls( @@ -64,10 +68,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "ModelWithAdditionalPropertiesInlinedAdditionalProperty": + def __getitem__(self, key: str) -> ModelWithAdditionalPropertiesInlinedAdditionalProperty: return self.additional_properties[key] - def __setitem__(self, key: str, value: "ModelWithAdditionalPropertiesInlinedAdditionalProperty") -> None: + def __setitem__(self, key: str, value: ModelWithAdditionalPropertiesInlinedAdditionalProperty) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py index 3bfffaf2c..8f877a575 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class ModelWithAdditionalPropertiesInlinedAdditionalProperty: """ Attributes: - extra_props_prop (Union[Unset, str]): + extra_props_prop (str | Unset): """ - extra_props_prop: Union[Unset, str] = UNSET + extra_props_prop: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) extra_props_prop = d.pop("extra_props_prop", UNSET) model_with_additional_properties_inlined_additional_property = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py index 0b80a0076..d3e0e338a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -22,8 +25,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_with_additional_properties_refed = cls() additional_properties = {} diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py index f71fe7c1e..7b59d8c2f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,7 +20,7 @@ class ModelWithAnyJsonProperties: """ """ additional_properties: dict[ - str, Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", bool, float, int, list[str], str] + str, bool | float | int | list[str] | ModelWithAnyJsonPropertiesAdditionalPropertyType0 | str ] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,12 +41,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_any_json_properties_additional_property_type_0 import ( ModelWithAnyJsonPropertiesAdditionalPropertyType0, ) - d = src_dict.copy() + d = dict(src_dict) model_with_any_json_properties = cls() additional_properties = {} @@ -51,14 +54,14 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def _parse_additional_property( data: object, - ) -> Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", bool, float, int, list[str], str]: + ) -> bool | float | int | list[str] | ModelWithAnyJsonPropertiesAdditionalPropertyType0 | str: try: if not isinstance(data, dict): raise TypeError() additional_property_type_0 = ModelWithAnyJsonPropertiesAdditionalPropertyType0.from_dict(data) return additional_property_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, list): @@ -66,10 +69,10 @@ def _parse_additional_property( additional_property_type_1 = cast(list[str], data) return additional_property_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass return cast( - Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", bool, float, int, list[str], str], data + bool | float | int | list[str] | ModelWithAnyJsonPropertiesAdditionalPropertyType0 | str, data ) additional_property = _parse_additional_property(prop_dict) @@ -85,13 +88,11 @@ def additional_keys(self) -> list[str]: def __getitem__( self, key: str - ) -> Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", bool, float, int, list[str], str]: + ) -> bool | float | int | list[str] | ModelWithAnyJsonPropertiesAdditionalPropertyType0 | str: return self.additional_properties[key] def __setitem__( - self, - key: str, - value: Union["ModelWithAnyJsonPropertiesAdditionalPropertyType0", bool, float, int, list[str], str], + self, key: str, value: bool | float | int | list[str] | ModelWithAnyJsonPropertiesAdditionalPropertyType0 | str ) -> None: self.additional_properties[key] = value diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py index 65993e8be..5726b1d50 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_with_any_json_properties_additional_property_type_0 = cls() model_with_any_json_properties_additional_property_type_0.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_backslash_in_description.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_backslash_in_description.py index 0b5dfc3b5..22d2978a4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_backslash_in_description.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_backslash_in_description.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -21,8 +24,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_with_backslash_in_description = cls() model_with_backslash_in_description.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_a.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_a.py index 3253c520b..5e9849159 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_a.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_a.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,14 +19,14 @@ class ModelWithCircularRefA: """ Attributes: - circular (Union[Unset, ModelWithCircularRefB]): + circular (ModelWithCircularRefB | Unset): """ - circular: Union[Unset, "ModelWithCircularRefB"] = UNSET + circular: ModelWithCircularRefB | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - circular: Union[Unset, dict[str, Any]] = UNSET + circular: dict[str, Any] | Unset = UNSET if not isinstance(self.circular, Unset): circular = self.circular.to_dict() @@ -36,12 +39,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_circular_ref_b import ModelWithCircularRefB - d = src_dict.copy() + d = dict(src_dict) _circular = d.pop("circular", UNSET) - circular: Union[Unset, ModelWithCircularRefB] + circular: ModelWithCircularRefB | Unset if isinstance(_circular, Unset): circular = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_b.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_b.py index 89c3a064c..1a0e61354 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_b.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_b.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,14 +19,14 @@ class ModelWithCircularRefB: """ Attributes: - circular (Union[Unset, ModelWithCircularRefA]): + circular (ModelWithCircularRefA | Unset): """ - circular: Union[Unset, "ModelWithCircularRefA"] = UNSET + circular: ModelWithCircularRefA | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - circular: Union[Unset, dict[str, Any]] = UNSET + circular: dict[str, Any] | Unset = UNSET if not isinstance(self.circular, Unset): circular = self.circular.to_dict() @@ -36,12 +39,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_circular_ref_a import ModelWithCircularRefA - d = src_dict.copy() + d = dict(src_dict) _circular = d.pop("circular", UNSET) - circular: Union[Unset, ModelWithCircularRefA] + circular: ModelWithCircularRefA | Unset if isinstance(_circular, Unset): circular = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_a.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_a.py index 32cb687c7..cd389aeb3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_a.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_a.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -14,7 +17,7 @@ class ModelWithCircularRefInAdditionalPropertiesA: """ """ - additional_properties: dict[str, "ModelWithCircularRefInAdditionalPropertiesB"] = _attrs_field( + additional_properties: dict[str, ModelWithCircularRefInAdditionalPropertiesB] = _attrs_field( init=False, factory=dict ) @@ -26,12 +29,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_circular_ref_in_additional_properties_b import ( ModelWithCircularRefInAdditionalPropertiesB, ) - d = src_dict.copy() + d = dict(src_dict) model_with_circular_ref_in_additional_properties_a = cls() additional_properties = {} @@ -47,10 +50,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "ModelWithCircularRefInAdditionalPropertiesB": + def __getitem__(self, key: str) -> ModelWithCircularRefInAdditionalPropertiesB: return self.additional_properties[key] - def __setitem__(self, key: str, value: "ModelWithCircularRefInAdditionalPropertiesB") -> None: + def __setitem__(self, key: str, value: ModelWithCircularRefInAdditionalPropertiesB) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_b.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_b.py index d134a94b9..78a11d482 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_b.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_circular_ref_in_additional_properties_b.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define @@ -14,7 +17,7 @@ class ModelWithCircularRefInAdditionalPropertiesB: """ """ - additional_properties: dict[str, "ModelWithCircularRefInAdditionalPropertiesA"] = _attrs_field( + additional_properties: dict[str, ModelWithCircularRefInAdditionalPropertiesA] = _attrs_field( init=False, factory=dict ) @@ -26,12 +29,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_circular_ref_in_additional_properties_a import ( ModelWithCircularRefInAdditionalPropertiesA, ) - d = src_dict.copy() + d = dict(src_dict) model_with_circular_ref_in_additional_properties_b = cls() additional_properties = {} @@ -47,10 +50,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "ModelWithCircularRefInAdditionalPropertiesA": + def __getitem__(self, key: str) -> ModelWithCircularRefInAdditionalPropertiesA: return self.additional_properties[key] - def __setitem__(self, key: str, value: "ModelWithCircularRefInAdditionalPropertiesA") -> None: + def __setitem__(self, key: str, value: ModelWithCircularRefInAdditionalPropertiesA) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_date_time_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_date_time_property.py index f503af00a..39dd2500b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_date_time_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_date_time_property.py @@ -1,5 +1,8 @@ +from __future__ import annotations + import datetime -from typing import Any, TypeVar, Union +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,14 +17,14 @@ class ModelWithDateTimeProperty: """ Attributes: - datetime_ (Union[Unset, datetime.datetime]): + datetime_ (datetime.datetime | Unset): """ - datetime_: Union[Unset, datetime.datetime] = UNSET + datetime_: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - datetime_: Union[Unset, str] = UNSET + datetime_: str | Unset = UNSET if not isinstance(self.datetime_, Unset): datetime_ = self.datetime_.isoformat() @@ -34,10 +37,10 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _datetime_ = d.pop("datetime", UNSET) - datetime_: Union[Unset, datetime.datetime] + datetime_: datetime.datetime | Unset if isinstance(_datetime_, Unset): datetime_ = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_discriminated_union.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_discriminated_union.py index 93a3535db..0e0021611 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_discriminated_union.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_discriminated_union.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,17 +20,17 @@ class ModelWithDiscriminatedUnion: """ Attributes: - discriminated_union (Union['ADiscriminatedUnionType1', 'ADiscriminatedUnionType2', None, Unset]): + discriminated_union (ADiscriminatedUnionType1 | ADiscriminatedUnionType2 | None | Unset): """ - discriminated_union: Union["ADiscriminatedUnionType1", "ADiscriminatedUnionType2", None, Unset] = UNSET + discriminated_union: ADiscriminatedUnionType1 | ADiscriminatedUnionType2 | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: from ..models.a_discriminated_union_type_1 import ADiscriminatedUnionType1 from ..models.a_discriminated_union_type_2 import ADiscriminatedUnionType2 - discriminated_union: Union[None, Unset, dict[str, Any]] + discriminated_union: dict[str, Any] | None | Unset if isinstance(self.discriminated_union, Unset): discriminated_union = UNSET elif isinstance(self.discriminated_union, ADiscriminatedUnionType1): @@ -46,15 +49,15 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.a_discriminated_union_type_1 import ADiscriminatedUnionType1 from ..models.a_discriminated_union_type_2 import ADiscriminatedUnionType2 - d = src_dict.copy() + d = dict(src_dict) def _parse_discriminated_union( data: object, - ) -> Union["ADiscriminatedUnionType1", "ADiscriminatedUnionType2", None, Unset]: + ) -> ADiscriminatedUnionType1 | ADiscriminatedUnionType2 | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -65,7 +68,7 @@ def _parse_discriminated_union( componentsschemas_a_discriminated_union_type_0 = ADiscriminatedUnionType1.from_dict(data) return componentsschemas_a_discriminated_union_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -73,9 +76,9 @@ def _parse_discriminated_union( componentsschemas_a_discriminated_union_type_1 = ADiscriminatedUnionType2.from_dict(data) return componentsschemas_a_discriminated_union_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["ADiscriminatedUnionType1", "ADiscriminatedUnionType2", None, Unset], data) + return cast(ADiscriminatedUnionType1 | ADiscriminatedUnionType2 | None | Unset, data) discriminated_union = _parse_discriminated_union(d.pop("discriminated_union", UNSET)) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_merged_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_merged_properties.py index 765d107d8..234a49e78 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_merged_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_merged_properties.py @@ -1,5 +1,8 @@ +from __future__ import annotations + import datetime -from typing import Any, TypeVar, Union +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,29 +18,29 @@ class ModelWithMergedProperties: """ Attributes: - simple_string (Union[Unset, str]): extended simpleString description Default: 'new default'. - string_to_enum (Union[Unset, ModelWithMergedPropertiesStringToEnum]): Default: + simple_string (str | Unset): extended simpleString description Default: 'new default'. + string_to_enum (ModelWithMergedPropertiesStringToEnum | Unset): Default: ModelWithMergedPropertiesStringToEnum.A. - string_to_date (Union[Unset, datetime.date]): - number_to_int (Union[Unset, int]): - any_to_string (Union[Unset, str]): Default: 'x'. + string_to_date (datetime.date | Unset): + number_to_int (int | Unset): + any_to_string (str | Unset): Default: 'x'. """ - simple_string: Union[Unset, str] = "new default" - string_to_enum: Union[Unset, ModelWithMergedPropertiesStringToEnum] = ModelWithMergedPropertiesStringToEnum.A - string_to_date: Union[Unset, datetime.date] = UNSET - number_to_int: Union[Unset, int] = UNSET - any_to_string: Union[Unset, str] = "x" + simple_string: str | Unset = "new default" + string_to_enum: ModelWithMergedPropertiesStringToEnum | Unset = ModelWithMergedPropertiesStringToEnum.A + string_to_date: datetime.date | Unset = UNSET + number_to_int: int | Unset = UNSET + any_to_string: str | Unset = "x" additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: simple_string = self.simple_string - string_to_enum: Union[Unset, str] = UNSET + string_to_enum: str | Unset = UNSET if not isinstance(self.string_to_enum, Unset): string_to_enum = self.string_to_enum.value - string_to_date: Union[Unset, str] = UNSET + string_to_date: str | Unset = UNSET if not isinstance(self.string_to_date, Unset): string_to_date = self.string_to_date.isoformat() @@ -62,19 +65,19 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) simple_string = d.pop("simpleString", UNSET) _string_to_enum = d.pop("stringToEnum", UNSET) - string_to_enum: Union[Unset, ModelWithMergedPropertiesStringToEnum] + string_to_enum: ModelWithMergedPropertiesStringToEnum | Unset if isinstance(_string_to_enum, Unset): string_to_enum = UNSET else: string_to_enum = ModelWithMergedPropertiesStringToEnum(_string_to_enum) _string_to_date = d.pop("stringToDate", UNSET) - string_to_date: Union[Unset, datetime.date] + string_to_date: datetime.date | Unset if isinstance(_string_to_date, Unset): string_to_date = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_no_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_no_properties.py index 24e718e6d..6d70837d1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_no_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_no_properties.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -15,7 +18,7 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: model_with_no_properties = cls() return model_with_no_properties diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py index db13972e9..2f4bf9de8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,14 +21,14 @@ class ModelWithPrimitiveAdditionalProperties: """ Attributes: - a_date_holder (Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder]): + a_date_holder (ModelWithPrimitiveAdditionalPropertiesADateHolder | Unset): """ - a_date_holder: Union[Unset, "ModelWithPrimitiveAdditionalPropertiesADateHolder"] = UNSET + a_date_holder: ModelWithPrimitiveAdditionalPropertiesADateHolder | Unset = UNSET additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - a_date_holder: Union[Unset, dict[str, Any]] = UNSET + a_date_holder: dict[str, Any] | Unset = UNSET if not isinstance(self.a_date_holder, Unset): a_date_holder = self.a_date_holder.to_dict() @@ -38,14 +41,14 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_with_primitive_additional_properties_a_date_holder import ( ModelWithPrimitiveAdditionalPropertiesADateHolder, ) - d = src_dict.copy() + d = dict(src_dict) _a_date_holder = d.pop("a_date_holder", UNSET) - a_date_holder: Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder] + a_date_holder: ModelWithPrimitiveAdditionalPropertiesADateHolder | Unset if isinstance(_a_date_holder, Unset): a_date_holder = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py index f53f968ac..891fdc3e2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py @@ -1,4 +1,7 @@ +from __future__ import annotations + import datetime +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -22,8 +25,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_with_primitive_additional_properties_a_date_holder = cls() additional_properties = {} diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py index d8ef017e0..19b63447d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,14 +19,14 @@ class ModelWithPropertyRef: """ Attributes: - inner (Union[Unset, ModelName]): + inner (ModelName | Unset): """ - inner: Union[Unset, "ModelName"] = UNSET + inner: ModelName | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - inner: Union[Unset, dict[str, Any]] = UNSET + inner: dict[str, Any] | Unset = UNSET if not isinstance(self.inner, Unset): inner = self.inner.to_dict() @@ -36,12 +39,12 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.model_name import ModelName - d = src_dict.copy() + d = dict(src_dict) _inner = d.pop("inner", UNSET) - inner: Union[Unset, ModelName] + inner: ModelName | Unset if isinstance(_inner, Unset): inner = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref.py index f7370d6f1..d4149434c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,14 +15,14 @@ class ModelWithRecursiveRef: """ Attributes: - recursive (Union[Unset, ModelWithRecursiveRef]): + recursive (ModelWithRecursiveRef | Unset): """ - recursive: Union[Unset, "ModelWithRecursiveRef"] = UNSET + recursive: ModelWithRecursiveRef | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - recursive: Union[Unset, dict[str, Any]] = UNSET + recursive: dict[str, Any] | Unset = UNSET if not isinstance(self.recursive, Unset): recursive = self.recursive.to_dict() @@ -32,10 +35,10 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _recursive = d.pop("recursive", UNSET) - recursive: Union[Unset, ModelWithRecursiveRef] + recursive: ModelWithRecursiveRef | Unset if isinstance(_recursive, Unset): recursive = UNSET else: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref_in_additional_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref_in_additional_properties.py index 961b82697..3b83ea3f9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref_in_additional_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_recursive_ref_in_additional_properties.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -10,7 +13,7 @@ class ModelWithRecursiveRefInAdditionalProperties: """ """ - additional_properties: dict[str, "ModelWithRecursiveRefInAdditionalProperties"] = _attrs_field( + additional_properties: dict[str, ModelWithRecursiveRefInAdditionalProperties] = _attrs_field( init=False, factory=dict ) @@ -22,8 +25,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) model_with_recursive_ref_in_additional_properties = cls() additional_properties = {} @@ -39,10 +42,10 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "ModelWithRecursiveRefInAdditionalProperties": + def __getitem__(self, key: str) -> ModelWithRecursiveRefInAdditionalProperties: return self.additional_properties[key] - def __setitem__(self, key: str, value: "ModelWithRecursiveRefInAdditionalProperties") -> None: + def __setitem__(self, key: str, value: ModelWithRecursiveRefInAdditionalProperties) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py index e818fc69b..176b3eadc 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -13,13 +16,13 @@ class ModelWithUnionProperty: """ Attributes: - a_property (Union[AnEnum, AnIntEnum, Unset]): + a_property (AnEnum | AnIntEnum | Unset): """ - a_property: Union[AnEnum, AnIntEnum, Unset] = UNSET + a_property: AnEnum | AnIntEnum | Unset = UNSET def to_dict(self) -> dict[str, Any]: - a_property: Union[Unset, int, str] + a_property: int | str | Unset if isinstance(self.a_property, Unset): a_property = UNSET elif isinstance(self.a_property, AnEnum): @@ -28,6 +31,7 @@ def to_dict(self) -> dict[str, Any]: a_property = self.a_property.value field_dict: dict[str, Any] = {} + field_dict.update({}) if a_property is not UNSET: field_dict["a_property"] = a_property @@ -35,10 +39,10 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) - def _parse_a_property(data: object) -> Union[AnEnum, AnIntEnum, Unset]: + def _parse_a_property(data: object) -> AnEnum | AnIntEnum | Unset: if isinstance(data, Unset): return data try: @@ -47,7 +51,7 @@ def _parse_a_property(data: object) -> Union[AnEnum, AnIntEnum, Unset]: a_property_type_0 = AnEnum(data) return a_property_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, int): raise TypeError() diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py index 659496eb6..ab144ded1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py @@ -1,12 +1,15 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from ..types import UNSET, Unset if TYPE_CHECKING: - from ..models.model_with_union_property_inlined_fruit_type_0 import ModelWithUnionPropertyInlinedFruitType0 - from ..models.model_with_union_property_inlined_fruit_type_1 import ModelWithUnionPropertyInlinedFruitType1 + from ..models.model_with_union_property_inlined_apples import ModelWithUnionPropertyInlinedApples + from ..models.model_with_union_property_inlined_bananas import ModelWithUnionPropertyInlinedBananas T = TypeVar("T", bound="ModelWithUnionPropertyInlined") @@ -16,23 +19,24 @@ class ModelWithUnionPropertyInlined: """ Attributes: - fruit (Union['ModelWithUnionPropertyInlinedFruitType0', 'ModelWithUnionPropertyInlinedFruitType1', Unset]): + fruit (ModelWithUnionPropertyInlinedApples | ModelWithUnionPropertyInlinedBananas | Unset): """ - fruit: Union["ModelWithUnionPropertyInlinedFruitType0", "ModelWithUnionPropertyInlinedFruitType1", Unset] = UNSET + fruit: ModelWithUnionPropertyInlinedApples | ModelWithUnionPropertyInlinedBananas | Unset = UNSET def to_dict(self) -> dict[str, Any]: - from ..models.model_with_union_property_inlined_fruit_type_0 import ModelWithUnionPropertyInlinedFruitType0 + from ..models.model_with_union_property_inlined_apples import ModelWithUnionPropertyInlinedApples - fruit: Union[Unset, dict[str, Any]] + fruit: dict[str, Any] | Unset if isinstance(self.fruit, Unset): fruit = UNSET - elif isinstance(self.fruit, ModelWithUnionPropertyInlinedFruitType0): + elif isinstance(self.fruit, ModelWithUnionPropertyInlinedApples): fruit = self.fruit.to_dict() else: fruit = self.fruit.to_dict() field_dict: dict[str, Any] = {} + field_dict.update({}) if fruit is not UNSET: field_dict["fruit"] = fruit @@ -40,30 +44,30 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - from ..models.model_with_union_property_inlined_fruit_type_0 import ModelWithUnionPropertyInlinedFruitType0 - from ..models.model_with_union_property_inlined_fruit_type_1 import ModelWithUnionPropertyInlinedFruitType1 + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.model_with_union_property_inlined_apples import ModelWithUnionPropertyInlinedApples + from ..models.model_with_union_property_inlined_bananas import ModelWithUnionPropertyInlinedBananas - d = src_dict.copy() + d = dict(src_dict) def _parse_fruit( data: object, - ) -> Union["ModelWithUnionPropertyInlinedFruitType0", "ModelWithUnionPropertyInlinedFruitType1", Unset]: + ) -> ModelWithUnionPropertyInlinedApples | ModelWithUnionPropertyInlinedBananas | Unset: if isinstance(data, Unset): return data try: if not isinstance(data, dict): raise TypeError() - fruit_type_0 = ModelWithUnionPropertyInlinedFruitType0.from_dict(data) + fruit_apples = ModelWithUnionPropertyInlinedApples.from_dict(data) - return fruit_type_0 - except: # noqa: E722 + return fruit_apples + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() - fruit_type_1 = ModelWithUnionPropertyInlinedFruitType1.from_dict(data) + fruit_bananas = ModelWithUnionPropertyInlinedBananas.from_dict(data) - return fruit_type_1 + return fruit_bananas fruit = _parse_fruit(d.pop("fruit", UNSET)) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_apples.py similarity index 67% rename from end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py rename to end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_apples.py index 4678b4cef..0ad6f0cf2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_apples.py @@ -1,21 +1,24 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -T = TypeVar("T", bound="ModelWithUnionPropertyInlinedFruitType0") +T = TypeVar("T", bound="ModelWithUnionPropertyInlinedApples") @_attrs_define -class ModelWithUnionPropertyInlinedFruitType0: +class ModelWithUnionPropertyInlinedApples: """ Attributes: - apples (Union[Unset, str]): + apples (str | Unset): """ - apples: Union[Unset, str] = UNSET + apples: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,16 +33,16 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) apples = d.pop("apples", UNSET) - model_with_union_property_inlined_fruit_type_0 = cls( + model_with_union_property_inlined_apples = cls( apples=apples, ) - model_with_union_property_inlined_fruit_type_0.additional_properties = d - return model_with_union_property_inlined_fruit_type_0 + model_with_union_property_inlined_apples.additional_properties = d + return model_with_union_property_inlined_apples @property def additional_keys(self) -> list[str]: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_bananas.py similarity index 67% rename from end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py rename to end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_bananas.py index d70e54234..68a54e760 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_bananas.py @@ -1,21 +1,24 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -T = TypeVar("T", bound="ModelWithUnionPropertyInlinedFruitType1") +T = TypeVar("T", bound="ModelWithUnionPropertyInlinedBananas") @_attrs_define -class ModelWithUnionPropertyInlinedFruitType1: +class ModelWithUnionPropertyInlinedBananas: """ Attributes: - bananas (Union[Unset, str]): + bananas (str | Unset): """ - bananas: Union[Unset, str] = UNSET + bananas: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,16 +33,16 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) bananas = d.pop("bananas", UNSET) - model_with_union_property_inlined_fruit_type_1 = cls( + model_with_union_property_inlined_bananas = cls( bananas=bananas, ) - model_with_union_property_inlined_fruit_type_1.additional_properties = d - return model_with_union_property_inlined_fruit_type_1 + model_with_union_property_inlined_bananas.additional_properties = d + return model_with_union_property_inlined_bananas @property def additional_keys(self) -> list[str]: diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/none.py b/end_to_end_tests/golden-record/my_test_api_client/models/none.py index 23cb7d679..26a7ba2ba 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/none.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/none.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) none = cls() none.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/octet_stream_tests_octet_stream_post_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/octet_stream_tests_octet_stream_post_response_200.py new file mode 100644 index 000000000..8d138937a --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/models/octet_stream_tests_octet_stream_post_response_200.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from io import BytesIO +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, File, FileTypes, Unset + +T = TypeVar("T", bound="OctetStreamTestsOctetStreamPostResponse200") + + +@_attrs_define +class OctetStreamTestsOctetStreamPostResponse200: + """ + Attributes: + data (File | Unset): + """ + + data: File | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data: FileTypes | Unset = UNSET + if not isinstance(self.data, Unset): + data = self.data.to_tuple() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if data is not UNSET: + field_dict["data"] = data + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _data = d.pop("data", UNSET) + data: File | Unset + if isinstance(_data, Unset): + data = UNSET + else: + data = File(payload=BytesIO(_data)) + + octet_stream_tests_octet_stream_post_response_200 = cls( + data=data, + ) + + octet_stream_tests_octet_stream_post_response_200.additional_properties = d + return octet_stream_tests_octet_stream_post_response_200 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_data_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_data_body.py index ba36efef2..d83f8d7eb 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_data_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_data_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class PostBodiesMultipleDataBody: """ Attributes: - a (Union[Unset, str]): + a (str | Unset): """ - a: Union[Unset, str] = UNSET + a: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a = d.pop("a", UNSET) post_bodies_multiple_data_body = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_files_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_files_body.py index 188abf39e..81d7db7a7 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_files_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_files_body.py @@ -1,8 +1,12 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field +from .. import types from ..types import UNSET, Unset T = TypeVar("T", bound="PostBodiesMultipleFilesBody") @@ -12,10 +16,10 @@ class PostBodiesMultipleFilesBody: """ Attributes: - a (Union[Unset, str]): + a (str | Unset): """ - a: Union[Unset, str] = UNSET + a: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -29,22 +33,20 @@ def to_dict(self) -> dict[str, Any]: return field_dict - def to_multipart(self) -> dict[str, Any]: - a = self.a if isinstance(self.a, Unset) else (None, str(self.a).encode(), "text/plain") + def to_multipart(self) -> types.RequestFiles: + files: types.RequestFiles = [] - field_dict: dict[str, Any] = {} - for prop_name, prop in self.additional_properties.items(): - field_dict[prop_name] = (None, str(prop).encode(), "text/plain") + if not isinstance(self.a, Unset): + files.append(("a", (None, str(self.a).encode(), "text/plain"))) - field_dict.update({}) - if a is not UNSET: - field_dict["a"] = a + for prop_name, prop in self.additional_properties.items(): + files.append((prop_name, (None, str(prop).encode(), "text/plain"))) - return field_dict + return files @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a = d.pop("a", UNSET) post_bodies_multiple_files_body = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_json_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_json_body.py index f4e7ffaa6..a5ec152e9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_json_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_bodies_multiple_json_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,10 +15,10 @@ class PostBodiesMultipleJsonBody: """ Attributes: - a (Union[Unset, str]): + a (str | Unset): """ - a: Union[Unset, str] = UNSET + a: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,8 +33,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a = d.pop("a", UNSET) post_bodies_multiple_json_body = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_form_data_inline_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_form_data_inline_body.py index 07c3b2648..5d7c3982b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_form_data_inline_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_form_data_inline_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,11 +16,11 @@ class PostFormDataInlineBody: """ Attributes: a_required_field (str): - an_optional_field (Union[Unset, str]): + an_optional_field (str | Unset): """ a_required_field: str - an_optional_field: Union[Unset, str] = UNSET + an_optional_field: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,8 +41,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_required_field = d.pop("a_required_field") an_optional_field = d.pop("an_optional_field", UNSET) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_body.py index 100e84dc9..2895d97d8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,12 +15,12 @@ class PostNamingPropertyConflictWithImportBody: """ Attributes: - field (Union[Unset, str]): A python_name of field should not interfere with attrs field - define (Union[Unset, str]): A python_name of define should not interfere with attrs define + field (str | Unset): A python_name of field should not interfere with attrs field + define (str | Unset): A python_name of define should not interfere with attrs define """ - field: Union[Unset, str] = UNSET - define: Union[Unset, str] = UNSET + field: str | Unset = UNSET + define: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -36,8 +39,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) field = d.pop("Field", UNSET) define = d.pop("Define", UNSET) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_response_200.py index 91c550749..c2a8ac7f3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_naming_property_conflict_with_import_response_200.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,12 +15,12 @@ class PostNamingPropertyConflictWithImportResponse200: """ Attributes: - field (Union[Unset, str]): A python_name of field should not interfere with attrs field - define (Union[Unset, str]): A python_name of define should not interfere with attrs define + field (str | Unset): A python_name of field should not interfere with attrs field + define (str | Unset): A python_name of define should not interfere with attrs define """ - field: Union[Unset, str] = UNSET - define: Union[Unset, str] = UNSET + field: str | Unset = UNSET + define: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -36,8 +39,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) field = d.pop("Field", UNSET) define = d.pop("Define", UNSET) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200.py index 9962f552c..41685d494 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,10 +19,10 @@ class PostResponsesUnionsSimpleBeforeComplexResponse200: """ Attributes: - a (Union['PostResponsesUnionsSimpleBeforeComplexResponse200AType1', str]): + a (PostResponsesUnionsSimpleBeforeComplexResponse200AType1 | str): """ - a: Union["PostResponsesUnionsSimpleBeforeComplexResponse200AType1", str] + a: PostResponsesUnionsSimpleBeforeComplexResponse200AType1 | str additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -27,7 +30,7 @@ def to_dict(self) -> dict[str, Any]: PostResponsesUnionsSimpleBeforeComplexResponse200AType1, ) - a: Union[dict[str, Any], str] + a: dict[str, Any] | str if isinstance(self.a, PostResponsesUnionsSimpleBeforeComplexResponse200AType1): a = self.a.to_dict() else: @@ -44,23 +47,23 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.post_responses_unions_simple_before_complex_response_200a_type_1 import ( PostResponsesUnionsSimpleBeforeComplexResponse200AType1, ) - d = src_dict.copy() + d = dict(src_dict) - def _parse_a(data: object) -> Union["PostResponsesUnionsSimpleBeforeComplexResponse200AType1", str]: + def _parse_a(data: object) -> PostResponsesUnionsSimpleBeforeComplexResponse200AType1 | str: try: if not isinstance(data, dict): raise TypeError() a_type_1 = PostResponsesUnionsSimpleBeforeComplexResponse200AType1.from_dict(data) return a_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["PostResponsesUnionsSimpleBeforeComplexResponse200AType1", str], data) + return cast(PostResponsesUnionsSimpleBeforeComplexResponse200AType1 | str, data) a = _parse_a(d.pop("a")) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200a_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200a_type_1.py index 5e8ef0207..ed608b31c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200a_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/post_responses_unions_simple_before_complex_response_200a_type_1.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -19,8 +22,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) post_responses_unions_simple_before_complex_response_200a_type_1 = cls() post_responses_unions_simple_before_complex_response_200a_type_1.additional_properties = d diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx.py b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx.py new file mode 100644 index 000000000..61e806ff9 --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.status_code_patterns_response_2xx_status import StatusCodePatternsResponse2XXStatus +from ..types import UNSET, Unset + +T = TypeVar("T", bound="StatusCodePatternsResponse2XX") + + +@_attrs_define +class StatusCodePatternsResponse2XX: + """ + Attributes: + status (StatusCodePatternsResponse2XXStatus | Unset): + """ + + status: StatusCodePatternsResponse2XXStatus | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + status: str | Unset = UNSET + if not isinstance(self.status, Unset): + status = self.status.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if status is not UNSET: + field_dict["status"] = status + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _status = d.pop("status", UNSET) + status: StatusCodePatternsResponse2XXStatus | Unset + if isinstance(_status, Unset): + status = UNSET + else: + status = StatusCodePatternsResponse2XXStatus(_status) + + status_code_patterns_response_2xx = cls( + status=status, + ) + + status_code_patterns_response_2xx.additional_properties = d + return status_code_patterns_response_2xx + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx_status.py b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx_status.py new file mode 100644 index 000000000..0baaf6da8 --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_2xx_status.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class StatusCodePatternsResponse2XXStatus(str, Enum): + FAILURE = "failure" + SUCCESS = "success" + + def __str__(self) -> str: + return str(self.value) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_4xx.py b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_4xx.py new file mode 100644 index 000000000..f62c4168a --- /dev/null +++ b/end_to_end_tests/golden-record/my_test_api_client/models/status_code_patterns_response_4xx.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="StatusCodePatternsResponse4XX") + + +@_attrs_define +class StatusCodePatternsResponse4XX: + """ + Attributes: + error (str | Unset): + """ + + error: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + error = self.error + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if error is not UNSET: + field_dict["error"] = error + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + error = d.pop("error", UNSET) + + status_code_patterns_response_4xx = cls( + error=error, + ) + + status_code_patterns_response_4xx.additional_properties = d + return status_code_patterns_response_4xx + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_body.py index 721011eed..73b054b24 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_body.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -11,15 +14,16 @@ class TestInlineObjectsBody: """ Attributes: - a_property (Union[Unset, str]): + a_property (str | Unset): """ - a_property: Union[Unset, str] = UNSET + a_property: str | Unset = UNSET def to_dict(self) -> dict[str, Any]: a_property = self.a_property field_dict: dict[str, Any] = {} + field_dict.update({}) if a_property is not UNSET: field_dict["a_property"] = a_property @@ -27,8 +31,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_property = d.pop("a_property", UNSET) test_inline_objects_body = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py index 2cf353587..174a5957b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -11,15 +14,16 @@ class TestInlineObjectsResponse200: """ Attributes: - a_property (Union[Unset, str]): + a_property (str | Unset): """ - a_property: Union[Unset, str] = UNSET + a_property: str | Unset = UNSET def to_dict(self) -> dict[str, Any]: a_property = self.a_property field_dict: dict[str, Any] = {} + field_dict.update({}) if a_property is not UNSET: field_dict["a_property"] = a_property @@ -27,8 +31,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) a_property = d.pop("a_property", UNSET) test_inline_objects_response_200 = cls( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py index 112808e62..9bb9070d6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar, cast from attrs import define as _attrs_define @@ -26,6 +29,7 @@ def to_dict(self) -> dict[str, Any]: type_ = self.type_ field_dict: dict[str, Any] = {} + field_dict.update( { "loc": loc, @@ -37,8 +41,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) loc = cast(list[str], d.pop("loc")) msg = d.pop("msg") diff --git a/end_to_end_tests/golden-record/my_test_api_client/types.py b/end_to_end_tests/golden-record/my_test_api_client/types.py index b9ed58b8a..b64af0952 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/types.py +++ b/end_to_end_tests/golden-record/my_test_api_client/types.py @@ -1,8 +1,8 @@ """Contains some shared types for properties""" -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Literal, Optional, TypeVar +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -14,7 +14,15 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]] +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define @@ -22,10 +30,10 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -40,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/end_to_end_tests/golden-record/pyproject.toml b/end_to_end_tests/golden-record/pyproject.toml index feca06dbd..d3fd8e4d7 100644 --- a/end_to_end_tests/golden-record/pyproject.toml +++ b/end_to_end_tests/golden-record/pyproject.toml @@ -5,19 +5,18 @@ description = "A client library for accessing My Test API" authors = [] readme = "README.md" packages = [ - {include = "my_test_api_client"}, + { include = "my_test_api_client" }, ] -include = ["CHANGELOG.md", "my_test_api_client/py.typed"] - +include = ["my_test_api_client/py.typed"] [tool.poetry.dependencies] -python = "^3.9" -httpx = ">=0.20.0,<0.29.0" +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" attrs = ">=22.2.0" python-dateutil = "^2.8.0" [build-system] -requires = ["poetry-core>=1.0.0"] +requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" [tool.ruff] diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/__init__.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/__init__.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 52385855c..4ed5ff6ee 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -27,16 +27,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -47,7 +48,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, bool_enum: bool, ) -> Response[Any]: """Bool Enum @@ -76,7 +77,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, bool_enum: bool, ) -> Response[Any]: """Bool Enum diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py index af4c4ca22..bdec57bf1 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -29,16 +29,17 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -49,7 +50,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, int_enum: AnIntEnum, ) -> Response[Any]: """Int Enum @@ -78,7 +79,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, int_enum: AnIntEnum, ) -> Response[Any]: """Int Enum diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/__init__.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/__init__.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/get_user_list.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/get_user_list.py index 00bc801d9..15b821528 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/get_user_list.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -18,10 +18,10 @@ def _get_kwargs( *, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - int_enum_header: Union[Unset, GetUserListIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetUserListStringEnumHeader] = UNSET, + int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, + string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} if not isinstance(int_enum_header, Unset): @@ -41,7 +41,7 @@ def _get_kwargs( json_an_enum_value_with_null = [] for an_enum_value_with_null_item_data in an_enum_value_with_null: - an_enum_value_with_null_item: Union[None, str] + an_enum_value_with_null_item: None | str if isinstance(an_enum_value_with_null_item_data, str): an_enum_value_with_null_item = an_enum_value_with_null_item_data else: @@ -66,9 +66,7 @@ def _get_kwargs( return _kwargs -def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[list["AModel"]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -78,15 +76,14 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[list["AModel"]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -97,30 +94,30 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - int_enum_header: Union[Unset, GetUserListIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetUserListStringEnumHeader] = UNSET, -) -> Response[list["AModel"]]: + int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, + string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, +) -> Response[list[AModel]]: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - int_enum_header (Union[Unset, GetUserListIntEnumHeader]): - string_enum_header (Union[Unset, GetUserListStringEnumHeader]): + int_enum_header (GetUserListIntEnumHeader | Unset): + string_enum_header (GetUserListStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['AModel']] + Response[list[AModel]] """ kwargs = _get_kwargs( @@ -140,30 +137,30 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - int_enum_header: Union[Unset, GetUserListIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetUserListStringEnumHeader] = UNSET, -) -> Optional[list["AModel"]]: + int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, + string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, +) -> list[AModel] | None: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - int_enum_header (Union[Unset, GetUserListIntEnumHeader]): - string_enum_header (Union[Unset, GetUserListStringEnumHeader]): + int_enum_header (GetUserListIntEnumHeader | Unset): + string_enum_header (GetUserListStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['AModel'] + list[AModel] """ return sync_detailed( @@ -178,30 +175,30 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - int_enum_header: Union[Unset, GetUserListIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetUserListStringEnumHeader] = UNSET, -) -> Response[list["AModel"]]: + int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, + string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, +) -> Response[list[AModel]]: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - int_enum_header (Union[Unset, GetUserListIntEnumHeader]): - string_enum_header (Union[Unset, GetUserListStringEnumHeader]): + int_enum_header (GetUserListIntEnumHeader | Unset): + string_enum_header (GetUserListStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['AModel']] + Response[list[AModel]] """ kwargs = _get_kwargs( @@ -219,30 +216,30 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, an_enum_value: list[AnEnum], - an_enum_value_with_null: list[Union[AnEnumWithNull, None]], + an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], - int_enum_header: Union[Unset, GetUserListIntEnumHeader] = UNSET, - string_enum_header: Union[Unset, GetUserListStringEnumHeader] = UNSET, -) -> Optional[list["AModel"]]: + int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, + string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, +) -> list[AModel] | None: """Get List Get a list of things Args: an_enum_value (list[AnEnum]): - an_enum_value_with_null (list[Union[AnEnumWithNull, None]]): + an_enum_value_with_null (list[AnEnumWithNull | None]): an_enum_value_with_only_null (list[None]): - int_enum_header (Union[Unset, GetUserListIntEnumHeader]): - string_enum_header (Union[Unset, GetUserListStringEnumHeader]): + int_enum_header (GetUserListIntEnumHeader | Unset): + string_enum_header (GetUserListStringEnumHeader | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['AModel'] + list[AModel] """ return ( diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/post_user_list.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/post_user_list.py index 82df1a8f8..148e68a35 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/post_user_list.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/api/tests/post_user_list.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -21,17 +21,13 @@ def _get_kwargs( "url": "/tests/", } - _body = body.to_multipart() - - _kwargs["files"] = _body + _kwargs["files"] = body.to_multipart() _kwargs["headers"] = headers return _kwargs -def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[list["AModel"]]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -41,15 +37,14 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[list["AModel"]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,9 +55,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostUserListBody, -) -> Response[list["AModel"]]: +) -> Response[list[AModel]]: """Post List Post a list of things @@ -75,7 +70,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['AModel']] + Response[list[AModel]] """ kwargs = _get_kwargs( @@ -91,9 +86,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostUserListBody, -) -> Optional[list["AModel"]]: +) -> list[AModel] | None: """Post List Post a list of things @@ -106,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['AModel'] + list[AModel] """ return sync_detailed( @@ -117,9 +112,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostUserListBody, -) -> Response[list["AModel"]]: +) -> Response[list[AModel]]: """Post List Post a list of things @@ -132,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['AModel']] + Response[list[AModel]] """ kwargs = _get_kwargs( @@ -146,9 +141,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostUserListBody, -) -> Optional[list["AModel"]]: +) -> list[AModel] | None: """Post List Post a list of things @@ -161,7 +156,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['AModel'] + list[AModel] """ return ( diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/client.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/client.py index e80446f10..1b7055ab8 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/client.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/a_model.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/a_model.py index 7050c1a3c..890f7507f 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/a_model.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/a_model.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define @@ -17,16 +20,16 @@ class AModel: Attributes: an_enum_value (AnEnum): For testing Enums in all the ways they can be used an_allof_enum_with_overridden_default (AnAllOfEnum): Default: 'overridden_default'. - any_value (Union[Unset, Any]): - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): - nested_list_of_enums (Union[Unset, list[list[DifferentEnum]]]): + any_value (Any | Unset): + an_optional_allof_enum (AnAllOfEnum | Unset): + nested_list_of_enums (list[list[DifferentEnum]] | Unset): """ an_enum_value: AnEnum an_allof_enum_with_overridden_default: AnAllOfEnum = "overridden_default" - any_value: Union[Unset, Any] = UNSET - an_optional_allof_enum: Union[Unset, AnAllOfEnum] = UNSET - nested_list_of_enums: Union[Unset, list[list[DifferentEnum]]] = UNSET + any_value: Any | Unset = UNSET + an_optional_allof_enum: AnAllOfEnum | Unset = UNSET + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET def to_dict(self) -> dict[str, Any]: an_enum_value: str = self.an_enum_value @@ -35,11 +38,11 @@ def to_dict(self) -> dict[str, Any]: any_value = self.any_value - an_optional_allof_enum: Union[Unset, str] = UNSET + an_optional_allof_enum: str | Unset = UNSET if not isinstance(self.an_optional_allof_enum, Unset): an_optional_allof_enum = self.an_optional_allof_enum - nested_list_of_enums: Union[Unset, list[list[str]]] = UNSET + nested_list_of_enums: list[list[str]] | Unset = UNSET if not isinstance(self.nested_list_of_enums, Unset): nested_list_of_enums = [] for nested_list_of_enums_item_data in self.nested_list_of_enums: @@ -51,6 +54,7 @@ def to_dict(self) -> dict[str, Any]: nested_list_of_enums.append(nested_list_of_enums_item) field_dict: dict[str, Any] = {} + field_dict.update( { "an_enum_value": an_enum_value, @@ -67,8 +71,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) an_enum_value = check_an_enum(d.pop("an_enum_value")) an_allof_enum_with_overridden_default = check_an_all_of_enum(d.pop("an_allof_enum_with_overridden_default")) @@ -76,23 +80,25 @@ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: any_value = d.pop("any_value", UNSET) _an_optional_allof_enum = d.pop("an_optional_allof_enum", UNSET) - an_optional_allof_enum: Union[Unset, AnAllOfEnum] + an_optional_allof_enum: AnAllOfEnum | Unset if isinstance(_an_optional_allof_enum, Unset): an_optional_allof_enum = UNSET else: an_optional_allof_enum = check_an_all_of_enum(_an_optional_allof_enum) - nested_list_of_enums = [] _nested_list_of_enums = d.pop("nested_list_of_enums", UNSET) - for nested_list_of_enums_item_data in _nested_list_of_enums or []: - nested_list_of_enums_item = [] - _nested_list_of_enums_item = nested_list_of_enums_item_data - for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: - nested_list_of_enums_item_item = check_different_enum(nested_list_of_enums_item_item_data) + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + if _nested_list_of_enums is not UNSET: + nested_list_of_enums = [] + for nested_list_of_enums_item_data in _nested_list_of_enums: + nested_list_of_enums_item = [] + _nested_list_of_enums_item = nested_list_of_enums_item_data + for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: + nested_list_of_enums_item_item = check_different_enum(nested_list_of_enums_item_item_data) - nested_list_of_enums_item.append(nested_list_of_enums_item_item) + nested_list_of_enums_item.append(nested_list_of_enums_item_item) - nested_list_of_enums.append(nested_list_of_enums_item) + nested_list_of_enums.append(nested_list_of_enums_item) a_model = cls( an_enum_value=an_enum_value, diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/post_user_list_body.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/post_user_list_body.py index 5566f1b3b..7e8e93950 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/post_user_list_body.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/models/post_user_list_body.py @@ -1,9 +1,12 @@ -import json -from typing import Any, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field +from .. import types from ..models.an_all_of_enum import AnAllOfEnum, check_an_all_of_enum from ..models.an_enum import AnEnum, check_an_enum from ..models.an_enum_with_null import AnEnumWithNull, check_an_enum_with_null @@ -17,54 +20,54 @@ class PostUserListBody: """ Attributes: - an_enum_value (Union[Unset, list[AnEnum]]): - an_enum_value_with_null (Union[Unset, list[Union[AnEnumWithNull, None]]]): - an_enum_value_with_only_null (Union[Unset, list[None]]): - an_allof_enum_with_overridden_default (Union[Unset, AnAllOfEnum]): Default: 'overridden_default'. - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): - nested_list_of_enums (Union[Unset, list[list[DifferentEnum]]]): + an_enum_value (list[AnEnum] | Unset): + an_enum_value_with_null (list[AnEnumWithNull | None] | Unset): + an_enum_value_with_only_null (list[None] | Unset): + an_allof_enum_with_overridden_default (AnAllOfEnum | Unset): Default: 'overridden_default'. + an_optional_allof_enum (AnAllOfEnum | Unset): + nested_list_of_enums (list[list[DifferentEnum]] | Unset): """ - an_enum_value: Union[Unset, list[AnEnum]] = UNSET - an_enum_value_with_null: Union[Unset, list[Union[AnEnumWithNull, None]]] = UNSET - an_enum_value_with_only_null: Union[Unset, list[None]] = UNSET - an_allof_enum_with_overridden_default: Union[Unset, AnAllOfEnum] = "overridden_default" - an_optional_allof_enum: Union[Unset, AnAllOfEnum] = UNSET - nested_list_of_enums: Union[Unset, list[list[DifferentEnum]]] = UNSET + an_enum_value: list[AnEnum] | Unset = UNSET + an_enum_value_with_null: list[AnEnumWithNull | None] | Unset = UNSET + an_enum_value_with_only_null: list[None] | Unset = UNSET + an_allof_enum_with_overridden_default: AnAllOfEnum | Unset = "overridden_default" + an_optional_allof_enum: AnAllOfEnum | Unset = UNSET + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - an_enum_value: Union[Unset, list[str]] = UNSET + an_enum_value: list[str] | Unset = UNSET if not isinstance(self.an_enum_value, Unset): an_enum_value = [] for an_enum_value_item_data in self.an_enum_value: an_enum_value_item: str = an_enum_value_item_data an_enum_value.append(an_enum_value_item) - an_enum_value_with_null: Union[Unset, list[Union[None, str]]] = UNSET + an_enum_value_with_null: list[None | str] | Unset = UNSET if not isinstance(self.an_enum_value_with_null, Unset): an_enum_value_with_null = [] for an_enum_value_with_null_item_data in self.an_enum_value_with_null: - an_enum_value_with_null_item: Union[None, str] + an_enum_value_with_null_item: None | str if isinstance(an_enum_value_with_null_item_data, str): an_enum_value_with_null_item = an_enum_value_with_null_item_data else: an_enum_value_with_null_item = an_enum_value_with_null_item_data an_enum_value_with_null.append(an_enum_value_with_null_item) - an_enum_value_with_only_null: Union[Unset, list[None]] = UNSET + an_enum_value_with_only_null: list[None] | Unset = UNSET if not isinstance(self.an_enum_value_with_only_null, Unset): an_enum_value_with_only_null = self.an_enum_value_with_only_null - an_allof_enum_with_overridden_default: Union[Unset, str] = UNSET + an_allof_enum_with_overridden_default: str | Unset = UNSET if not isinstance(self.an_allof_enum_with_overridden_default, Unset): an_allof_enum_with_overridden_default = self.an_allof_enum_with_overridden_default - an_optional_allof_enum: Union[Unset, str] = UNSET + an_optional_allof_enum: str | Unset = UNSET if not isinstance(self.an_optional_allof_enum, Unset): an_optional_allof_enum = self.an_optional_allof_enum - nested_list_of_enums: Union[Unset, list[list[str]]] = UNSET + nested_list_of_enums: list[list[str]] | Unset = UNSET if not isinstance(self.nested_list_of_enums, Unset): nested_list_of_enums = [] for nested_list_of_enums_item_data in self.nested_list_of_enums: @@ -93,138 +96,129 @@ def to_dict(self) -> dict[str, Any]: return field_dict - def to_multipart(self) -> dict[str, Any]: - an_enum_value: Union[Unset, tuple[None, bytes, str]] = UNSET + def to_multipart(self) -> types.RequestFiles: + files: types.RequestFiles = [] + if not isinstance(self.an_enum_value, Unset): - _temp_an_enum_value = [] - for an_enum_value_item_data in self.an_enum_value: - an_enum_value_item: str = an_enum_value_item_data - _temp_an_enum_value.append(an_enum_value_item) - an_enum_value = (None, json.dumps(_temp_an_enum_value).encode(), "application/json") + for an_enum_value_item_element in self.an_enum_value: + files.append(("an_enum_value", (None, str(an_enum_value_item_element).encode(), "text/plain"))) - an_enum_value_with_null: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.an_enum_value_with_null, Unset): - _temp_an_enum_value_with_null = [] - for an_enum_value_with_null_item_data in self.an_enum_value_with_null: - an_enum_value_with_null_item: Union[None, str] - if isinstance(an_enum_value_with_null_item_data, str): - an_enum_value_with_null_item = an_enum_value_with_null_item_data + for an_enum_value_with_null_item_element in self.an_enum_value_with_null: + if an_enum_value_with_null_item_element is None: + files.append( + ( + "an_enum_value_with_null", + (None, str(an_enum_value_with_null_item_element).encode(), "text/plain"), + ) + ) else: - an_enum_value_with_null_item = an_enum_value_with_null_item_data - _temp_an_enum_value_with_null.append(an_enum_value_with_null_item) - an_enum_value_with_null = (None, json.dumps(_temp_an_enum_value_with_null).encode(), "application/json") + files.append( + ( + "an_enum_value_with_null", + (None, str(an_enum_value_with_null_item_element).encode(), "text/plain"), + ) + ) - an_enum_value_with_only_null: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.an_enum_value_with_only_null, Unset): - _temp_an_enum_value_with_only_null = self.an_enum_value_with_only_null - an_enum_value_with_only_null = ( - None, - json.dumps(_temp_an_enum_value_with_only_null).encode(), - "application/json", - ) + for an_enum_value_with_only_null_item_element in self.an_enum_value_with_only_null: + files.append( + ( + "an_enum_value_with_only_null", + (None, str(an_enum_value_with_only_null_item_element).encode(), "text/plain"), + ) + ) - an_allof_enum_with_overridden_default: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.an_allof_enum_with_overridden_default, Unset): - an_allof_enum_with_overridden_default = ( - None, - str(self.an_allof_enum_with_overridden_default).encode(), - "text/plain", + files.append( + ( + "an_allof_enum_with_overridden_default", + (None, str(self.an_allof_enum_with_overridden_default).encode(), "text/plain"), + ) ) - an_optional_allof_enum: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.an_optional_allof_enum, Unset): - an_optional_allof_enum = (None, str(self.an_optional_allof_enum).encode(), "text/plain") + files.append(("an_optional_allof_enum", (None, str(self.an_optional_allof_enum).encode(), "text/plain"))) - nested_list_of_enums: Union[Unset, tuple[None, bytes, str]] = UNSET if not isinstance(self.nested_list_of_enums, Unset): - _temp_nested_list_of_enums = [] - for nested_list_of_enums_item_data in self.nested_list_of_enums: - nested_list_of_enums_item = [] - for nested_list_of_enums_item_item_data in nested_list_of_enums_item_data: - nested_list_of_enums_item_item: str = nested_list_of_enums_item_item_data - nested_list_of_enums_item.append(nested_list_of_enums_item_item) - - _temp_nested_list_of_enums.append(nested_list_of_enums_item) - nested_list_of_enums = (None, json.dumps(_temp_nested_list_of_enums).encode(), "application/json") + for nested_list_of_enums_item_element in self.nested_list_of_enums: + for nested_list_of_enums_item_item_element in nested_list_of_enums_item_element: + files.append( + ( + "nested_list_of_enums", + (None, str(nested_list_of_enums_item_item_element).encode(), "text/plain"), + ) + ) - field_dict: dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): - field_dict[prop_name] = (None, str(prop).encode(), "text/plain") + files.append((prop_name, (None, str(prop).encode(), "text/plain"))) - field_dict.update({}) - if an_enum_value is not UNSET: - field_dict["an_enum_value"] = an_enum_value - if an_enum_value_with_null is not UNSET: - field_dict["an_enum_value_with_null"] = an_enum_value_with_null - if an_enum_value_with_only_null is not UNSET: - field_dict["an_enum_value_with_only_null"] = an_enum_value_with_only_null - if an_allof_enum_with_overridden_default is not UNSET: - field_dict["an_allof_enum_with_overridden_default"] = an_allof_enum_with_overridden_default - if an_optional_allof_enum is not UNSET: - field_dict["an_optional_allof_enum"] = an_optional_allof_enum - if nested_list_of_enums is not UNSET: - field_dict["nested_list_of_enums"] = nested_list_of_enums - - return field_dict + return files @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() - an_enum_value = [] + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _an_enum_value = d.pop("an_enum_value", UNSET) - for an_enum_value_item_data in _an_enum_value or []: - an_enum_value_item = check_an_enum(an_enum_value_item_data) + an_enum_value: list[AnEnum] | Unset = UNSET + if _an_enum_value is not UNSET: + an_enum_value = [] + for an_enum_value_item_data in _an_enum_value: + an_enum_value_item = check_an_enum(an_enum_value_item_data) - an_enum_value.append(an_enum_value_item) + an_enum_value.append(an_enum_value_item) - an_enum_value_with_null = [] _an_enum_value_with_null = d.pop("an_enum_value_with_null", UNSET) - for an_enum_value_with_null_item_data in _an_enum_value_with_null or []: + an_enum_value_with_null: list[AnEnumWithNull | None] | Unset = UNSET + if _an_enum_value_with_null is not UNSET: + an_enum_value_with_null = [] + for an_enum_value_with_null_item_data in _an_enum_value_with_null: - def _parse_an_enum_value_with_null_item(data: object) -> Union[AnEnumWithNull, None]: - if data is None: - return data - try: - if not isinstance(data, str): - raise TypeError() - componentsschemas_an_enum_with_null_type_1 = check_an_enum_with_null(data) + def _parse_an_enum_value_with_null_item(data: object) -> AnEnumWithNull | None: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + componentsschemas_an_enum_with_null_type_1 = check_an_enum_with_null(data) - return componentsschemas_an_enum_with_null_type_1 - except: # noqa: E722 - pass - return cast(Union[AnEnumWithNull, None], data) + return componentsschemas_an_enum_with_null_type_1 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AnEnumWithNull | None, data) - an_enum_value_with_null_item = _parse_an_enum_value_with_null_item(an_enum_value_with_null_item_data) + an_enum_value_with_null_item = _parse_an_enum_value_with_null_item(an_enum_value_with_null_item_data) - an_enum_value_with_null.append(an_enum_value_with_null_item) + an_enum_value_with_null.append(an_enum_value_with_null_item) an_enum_value_with_only_null = cast(list[None], d.pop("an_enum_value_with_only_null", UNSET)) _an_allof_enum_with_overridden_default = d.pop("an_allof_enum_with_overridden_default", UNSET) - an_allof_enum_with_overridden_default: Union[Unset, AnAllOfEnum] + an_allof_enum_with_overridden_default: AnAllOfEnum | Unset if isinstance(_an_allof_enum_with_overridden_default, Unset): an_allof_enum_with_overridden_default = UNSET else: an_allof_enum_with_overridden_default = check_an_all_of_enum(_an_allof_enum_with_overridden_default) _an_optional_allof_enum = d.pop("an_optional_allof_enum", UNSET) - an_optional_allof_enum: Union[Unset, AnAllOfEnum] + an_optional_allof_enum: AnAllOfEnum | Unset if isinstance(_an_optional_allof_enum, Unset): an_optional_allof_enum = UNSET else: an_optional_allof_enum = check_an_all_of_enum(_an_optional_allof_enum) - nested_list_of_enums = [] _nested_list_of_enums = d.pop("nested_list_of_enums", UNSET) - for nested_list_of_enums_item_data in _nested_list_of_enums or []: - nested_list_of_enums_item = [] - _nested_list_of_enums_item = nested_list_of_enums_item_data - for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: - nested_list_of_enums_item_item = check_different_enum(nested_list_of_enums_item_item_data) + nested_list_of_enums: list[list[DifferentEnum]] | Unset = UNSET + if _nested_list_of_enums is not UNSET: + nested_list_of_enums = [] + for nested_list_of_enums_item_data in _nested_list_of_enums: + nested_list_of_enums_item = [] + _nested_list_of_enums_item = nested_list_of_enums_item_data + for nested_list_of_enums_item_item_data in _nested_list_of_enums_item: + nested_list_of_enums_item_item = check_different_enum(nested_list_of_enums_item_item_data) - nested_list_of_enums_item.append(nested_list_of_enums_item_item) + nested_list_of_enums_item.append(nested_list_of_enums_item_item) - nested_list_of_enums.append(nested_list_of_enums_item) + nested_list_of_enums.append(nested_list_of_enums_item) post_user_list_body = cls( an_enum_value=an_enum_value, diff --git a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/types.py b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/types.py index b9ed58b8a..b64af0952 100644 --- a/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/types.py +++ b/end_to_end_tests/literal-enums-golden-record/my_enum_api_client/types.py @@ -1,8 +1,8 @@ """Contains some shared types for properties""" -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Literal, Optional, TypeVar +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -14,7 +14,15 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]] +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define @@ -22,10 +30,10 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -40,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/end_to_end_tests/literal-enums-golden-record/pyproject.toml b/end_to_end_tests/literal-enums-golden-record/pyproject.toml index 2c4d6b4e3..a83d5f1ad 100644 --- a/end_to_end_tests/literal-enums-golden-record/pyproject.toml +++ b/end_to_end_tests/literal-enums-golden-record/pyproject.toml @@ -5,19 +5,18 @@ description = "A client library for accessing My Enum API" authors = [] readme = "README.md" packages = [ - {include = "my_enum_api_client"}, + { include = "my_enum_api_client" }, ] -include = ["CHANGELOG.md", "my_enum_api_client/py.typed"] - +include = ["my_enum_api_client/py.typed"] [tool.poetry.dependencies] -python = "^3.9" -httpx = ">=0.20.0,<0.29.0" +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" attrs = ">=22.2.0" python-dateutil = "^2.8.0" [build-system] -requires = ["poetry-core>=1.0.0"] +requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" [tool.ruff] diff --git a/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml b/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml index c1f8a2a2b..d5fb9e988 100644 --- a/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml +++ b/end_to_end_tests/metadata_snapshots/pdm.pyproject.toml @@ -4,9 +4,9 @@ version = "0.1.0" description = "A client library for accessing Test 3.1 Features" authors = [] readme = "README.md" -requires-python = ">=3.9,<4.0" +requires-python = ">=3.10" dependencies = [ - "httpx>=0.20.0,<0.29.0", + "httpx>=0.23.0,<0.29.0", "attrs>=22.2.0", "python-dateutil>=2.8.0", ] diff --git a/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml b/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml index 2e8cd6c04..202b9d360 100644 --- a/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml +++ b/end_to_end_tests/metadata_snapshots/poetry.pyproject.toml @@ -5,19 +5,18 @@ description = "A client library for accessing Test 3.1 Features" authors = [] readme = "README.md" packages = [ - {include = "test_3_1_features_client"}, + { include = "test_3_1_features_client" }, ] -include = ["CHANGELOG.md", "test_3_1_features_client/py.typed"] - +include = ["test_3_1_features_client/py.typed"] [tool.poetry.dependencies] -python = "^3.9" -httpx = ">=0.20.0,<0.29.0" +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" attrs = ">=22.2.0" python-dateutil = "^2.8.0" [build-system] -requires = ["poetry-core>=1.0.0"] +requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" [tool.ruff] diff --git a/end_to_end_tests/metadata_snapshots/setup.py b/end_to_end_tests/metadata_snapshots/setup.py index 6c7a58b97..7ef00915b 100644 --- a/end_to_end_tests/metadata_snapshots/setup.py +++ b/end_to_end_tests/metadata_snapshots/setup.py @@ -12,7 +12,7 @@ long_description=long_description, long_description_content_type="text/markdown", packages=find_packages(), - python_requires=">=3.9, <4", - install_requires=["httpx >= 0.20.0, < 0.29.0", "attrs >= 22.2.0", "python-dateutil >= 2.8.0, < 3"], + python_requires=">=3.10, <4", + install_requires=["httpx >= 0.23.0, < 0.29.0", "attrs >= 22.2.0", "python-dateutil >= 2.8.0, < 3"], package_data={"test_3_1_features_client": ["py.typed"]}, ) diff --git a/end_to_end_tests/metadata_snapshots/uv.pyproject.toml b/end_to_end_tests/metadata_snapshots/uv.pyproject.toml new file mode 100644 index 000000000..65d85d2fc --- /dev/null +++ b/end_to_end_tests/metadata_snapshots/uv.pyproject.toml @@ -0,0 +1,26 @@ +[project] +name = "test-3-1-features-client" +version = "0.1.0" +description = "A client library for accessing Test 3.1 Features" +authors = [] +requires-python = ">=3.10" +readme = "README.md" +dependencies = [ + "httpx>=0.23.0,<0.29.0", + "attrs>=22.2.0", + "python-dateutil>=2.8.0,<3", +] + +[tool.uv.build-backend] +module-name = "test_3_1_features_client" +module-root = "" + +[build-system] +requires = ["uv_build>=0.9.0,<0.10.0"] +build-backend = "uv_build" + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = ["F", "I", "UP"] diff --git a/end_to_end_tests/regen_golden_record.py b/end_to_end_tests/regen_golden_record.py index 2471e1340..e01a84884 100644 --- a/end_to_end_tests/regen_golden_record.py +++ b/end_to_end_tests/regen_golden_record.py @@ -1,8 +1,6 @@ """ Regenerate golden-record """ import filecmp -import os import shutil -import tempfile from pathlib import Path from typer.testing import CliRunner @@ -10,87 +8,89 @@ from openapi_python_client.cli import app -def regen_golden_record(): +def _regenerate( + *, + spec_file_name: str, + output_dir: str = "my-test-api-client", + golden_record_dir: str | None = None, + config_file_name: str = "config.yml", + extra_args: list[str] | None = None +) -> None: + end_to_end_tests_base_path = Path(__file__).parent + project_base_path = end_to_end_tests_base_path.parent runner = CliRunner() - openapi_path = Path(__file__).parent / "baseline_openapi_3.0.json" - - gr_path = Path(__file__).parent / "golden-record" - output_path = Path.cwd() / "my-test-api-client" - config_path = Path(__file__).parent / "config.yml" + openapi_path = end_to_end_tests_base_path / spec_file_name - shutil.rmtree(gr_path, ignore_errors=True) + output_path = project_base_path / output_dir shutil.rmtree(output_path, ignore_errors=True) - result = runner.invoke( - app, ["generate", f"--config={config_path}", f"--path={openapi_path}"] - ) - - if result.stdout: - print(result.stdout) - if result.exception: - raise result.exception - output_path.rename(gr_path) - - -def regen_golden_record_3_1_features(): - runner = CliRunner() - openapi_path = Path(__file__).parent / "3.1_specific.openapi.yaml" - - gr_path = Path(__file__).parent / "test-3-1-golden-record" - output_path = Path.cwd() / "test-3-1-features-client" - - shutil.rmtree(gr_path, ignore_errors=True) - shutil.rmtree(output_path, ignore_errors=True) + args = ["generate", f"--path={openapi_path}"] + if config_file_name: + config_path = end_to_end_tests_base_path / config_file_name + args.append(f"--config={config_path}") + if extra_args: + args.extend(extra_args) + print(f"Using {spec_file_name}{f' and {config_file_name}' if config_file_name else ''}") - result = runner.invoke(app, ["generate", f"--path={openapi_path}"]) + result = runner.invoke(app, args) if result.stdout: print(result.stdout) if result.exception: - raise result.exception - output_path.rename(gr_path) + raise Exception(f"{result.exception} {result.stderr}") + if golden_record_dir: + gr_path = end_to_end_tests_base_path / golden_record_dir + shutil.rmtree(gr_path, ignore_errors=True) + output_path.rename(gr_path) -def regen_literal_enums_golden_record(): - runner = CliRunner() - openapi_path = Path(__file__).parent / "openapi_3.1_enums.yaml" +def regen_golden_record(): + _regenerate( + spec_file_name="baseline_openapi_3.0.json", + golden_record_dir="golden-record", + ) - gr_path = Path(__file__).parent / "literal-enums-golden-record" - output_path = Path.cwd() / "my-enum-api-client" - config_path = Path(__file__).parent / "literal_enums.config.yml" - shutil.rmtree(gr_path, ignore_errors=True) - shutil.rmtree(output_path, ignore_errors=True) +def regen_golden_record_3_1_features(): + _regenerate( + spec_file_name="3.1_specific.openapi.yaml", + output_dir="test-3-1-features-client", + golden_record_dir="test-3-1-golden-record", + ) - result = runner.invoke(app, ["generate", f"--path={openapi_path}", f"--config={config_path}"]) - if result.stdout: - print(result.stdout) - if result.exception: - raise result.exception - output_path.rename(gr_path) +def regen_literal_enums_golden_record(): + _regenerate( + spec_file_name="openapi_3.1_enums.yaml", + output_dir="my-enum-api-client", + golden_record_dir="literal-enums-golden-record", + config_file_name="literal_enums.config.yml", + ) def regen_metadata_snapshots(): - runner = CliRunner() - openapi_path = Path(__file__).parent / "3.1_specific.openapi.yaml" output_path = Path.cwd() / "test-3-1-features-client" snapshots_dir = Path(__file__).parent / "metadata_snapshots" - for (meta, file, rename_to) in (("setup", "setup.py", "setup.py"), ("pdm", "pyproject.toml", "pdm.pyproject.toml"), ("poetry", "pyproject.toml", "poetry.pyproject.toml")): - shutil.rmtree(output_path, ignore_errors=True) - result = runner.invoke(app, ["generate", f"--path={openapi_path}", f"--meta={meta}"]) - - if result.stdout: - print(result.stdout) - if result.exception: - raise result.exception - + for (meta, file, rename_to) in (("setup", "setup.py", "setup.py"), ("pdm", "pyproject.toml", "pdm.pyproject.toml"), ("poetry", "pyproject.toml", "poetry.pyproject.toml"), ("uv", "pyproject.toml", "uv.pyproject.toml")): + _regenerate( + spec_file_name="3.1_specific.openapi.yaml", + output_dir="test-3-1-features-client", + extra_args=[f"--meta={meta}"], + ) (output_path / file).rename(snapshots_dir / rename_to) shutil.rmtree(output_path, ignore_errors=True) +def regen_docstrings_on_attributes_golden_record(): + _regenerate( + spec_file_name="docstrings_on_attributes.yml", + golden_record_dir="docstrings-on-attributes-golden-record", + config_file_name="docstrings_on_attributes.config.yml", + ) + + def regen_custom_template_golden_record(): runner = CliRunner() openapi_path = Path(__file__).parent / "baseline_openapi_3.0.json" @@ -143,5 +143,6 @@ def regen_custom_template_golden_record(): regen_golden_record() regen_golden_record_3_1_features() regen_metadata_snapshots() + regen_docstrings_on_attributes_golden_record() regen_custom_template_golden_record() regen_literal_enums_golden_record() diff --git a/end_to_end_tests/test-3-1-golden-record/pyproject.toml b/end_to_end_tests/test-3-1-golden-record/pyproject.toml index 2e8cd6c04..202b9d360 100644 --- a/end_to_end_tests/test-3-1-golden-record/pyproject.toml +++ b/end_to_end_tests/test-3-1-golden-record/pyproject.toml @@ -5,19 +5,18 @@ description = "A client library for accessing Test 3.1 Features" authors = [] readme = "README.md" packages = [ - {include = "test_3_1_features_client"}, + { include = "test_3_1_features_client" }, ] -include = ["CHANGELOG.md", "test_3_1_features_client/py.typed"] - +include = ["test_3_1_features_client/py.typed"] [tool.poetry.dependencies] -python = "^3.9" -httpx = ">=0.20.0,<0.29.0" +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" attrs = ">=22.2.0" python-dateutil = "^2.8.0" [build-system] -requires = ["poetry-core>=1.0.0"] +requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" [tool.ruff] diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/__init__.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/__init__.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/post_const_path.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/post_const_path.py index 0d05b8189..bf3472121 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/post_const_path.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/const/post_const_path.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Literal, Optional, Union, cast +from typing import Any, Literal, cast +from urllib.parse import quote import httpx @@ -14,7 +15,7 @@ def _get_kwargs( *, body: PostConstPathBody, required_query: Literal["this always goes in the query"], - optional_query: Union[Literal["this sometimes goes in the query"], Unset] = UNSET, + optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -28,13 +29,14 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/const/{path}", + "url": "/const/{path}".format( + path=quote(str(path), safe=""), + ), "params": params, } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -42,8 +44,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Literal["Why have a fixed response? I dunno"]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Literal["Why have a fixed response? I dunno"] | None: if response.status_code == 200: response_200 = cast(Literal["Why have a fixed response? I dunno"], response.json()) if response_200 != "Why have a fixed response? I dunno": @@ -51,6 +53,7 @@ def _parse_response( f"response_200 must match const 'Why have a fixed response? I dunno', got '{response_200}'" ) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,7 +61,7 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response + *, client: AuthenticatedClient | Client, response: httpx.Response ) -> Response[Literal["Why have a fixed response? I dunno"]]: return Response( status_code=HTTPStatus(response.status_code), @@ -71,16 +74,16 @@ def _build_response( def sync_detailed( path: Literal["this goes in the path"], *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], - optional_query: Union[Literal["this sometimes goes in the query"], Unset] = UNSET, + optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, ) -> Response[Literal["Why have a fixed response? I dunno"]]: """ Args: path (Literal['this goes in the path']): required_query (Literal['this always goes in the query']): - optional_query (Union[Literal['this sometimes goes in the query'], Unset]): + optional_query (Literal['this sometimes goes in the query'] | Unset): body (PostConstPathBody): Raises: @@ -108,16 +111,16 @@ def sync_detailed( def sync( path: Literal["this goes in the path"], *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], - optional_query: Union[Literal["this sometimes goes in the query"], Unset] = UNSET, -) -> Optional[Literal["Why have a fixed response? I dunno"]]: + optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, +) -> Literal["Why have a fixed response? I dunno"] | None: """ Args: path (Literal['this goes in the path']): required_query (Literal['this always goes in the query']): - optional_query (Union[Literal['this sometimes goes in the query'], Unset]): + optional_query (Literal['this sometimes goes in the query'] | Unset): body (PostConstPathBody): Raises: @@ -140,16 +143,16 @@ def sync( async def asyncio_detailed( path: Literal["this goes in the path"], *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], - optional_query: Union[Literal["this sometimes goes in the query"], Unset] = UNSET, + optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, ) -> Response[Literal["Why have a fixed response? I dunno"]]: """ Args: path (Literal['this goes in the path']): required_query (Literal['this always goes in the query']): - optional_query (Union[Literal['this sometimes goes in the query'], Unset]): + optional_query (Literal['this sometimes goes in the query'] | Unset): body (PostConstPathBody): Raises: @@ -175,16 +178,16 @@ async def asyncio_detailed( async def asyncio( path: Literal["this goes in the path"], *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], - optional_query: Union[Literal["this sometimes goes in the query"], Unset] = UNSET, -) -> Optional[Literal["Why have a fixed response? I dunno"]]: + optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, +) -> Literal["Why have a fixed response? I dunno"] | None: """ Args: path (Literal['this goes in the path']): required_query (Literal['this always goes in the query']): - optional_query (Union[Literal['this sometimes goes in the query'], Unset]): + optional_query (Literal['this sometimes goes in the query'] | Unset): body (PostConstPathBody): Raises: diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/__init__.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/__init__.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/post_prefix_items.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/post_prefix_items.py index f12d53f18..5b114873e 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/post_prefix_items.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/api/prefix_items/post_prefix_items.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -20,26 +20,26 @@ def _get_kwargs( "url": "/prefixItems", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers return _kwargs -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[str]: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[str]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -50,7 +50,7 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostPrefixItemsBody, ) -> Response[str]: """ @@ -78,9 +78,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostPrefixItemsBody, -) -> Optional[str]: +) -> str | None: """ Args: body (PostPrefixItemsBody): @@ -101,7 +101,7 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostPrefixItemsBody, ) -> Response[str]: """ @@ -127,9 +127,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostPrefixItemsBody, -) -> Optional[str]: +) -> str | None: """ Args: body (PostPrefixItemsBody): diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/client.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/client.py index e80446f10..1b7055ab8 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/client.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_const_path_body.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_const_path_body.py index 15734903c..f59894f08 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_const_path_body.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_const_path_body.py @@ -1,4 +1,7 @@ -from typing import Any, Literal, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,19 +16,19 @@ class PostConstPathBody: """ Attributes: required (Literal['this always goes in the body']): - nullable (Union[Literal['this or null goes in the body'], None]): - optional (Union[Literal['this sometimes goes in the body'], Unset]): + nullable (Literal['this or null goes in the body'] | None): + optional (Literal['this sometimes goes in the body'] | Unset): """ required: Literal["this always goes in the body"] - nullable: Union[Literal["this or null goes in the body"], None] - optional: Union[Literal["this sometimes goes in the body"], Unset] = UNSET + nullable: Literal["this or null goes in the body"] | None + optional: Literal["this sometimes goes in the body"] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: required = self.required - nullable: Union[Literal["this or null goes in the body"], None] + nullable: Literal["this or null goes in the body"] | None nullable = self.nullable optional = self.optional @@ -44,13 +47,13 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) required = cast(Literal["this always goes in the body"], d.pop("required")) if required != "this always goes in the body": raise ValueError(f"required must match const 'this always goes in the body', got '{required}'") - def _parse_nullable(data: object) -> Union[Literal["this or null goes in the body"], None]: + def _parse_nullable(data: object) -> Literal["this or null goes in the body"] | None: if data is None: return data nullable_type_1 = cast(Literal["this or null goes in the body"], data) @@ -59,11 +62,11 @@ def _parse_nullable(data: object) -> Union[Literal["this or null goes in the bod f"nullable_type_1 must match const 'this or null goes in the body', got '{nullable_type_1}'" ) return nullable_type_1 - return cast(Union[Literal["this or null goes in the body"], None], data) + return cast(Literal["this or null goes in the body"] | None, data) nullable = _parse_nullable(d.pop("nullable")) - optional = cast(Union[Literal["this sometimes goes in the body"], Unset], d.pop("optional", UNSET)) + optional = cast(Literal["this sometimes goes in the body"] | Unset, d.pop("optional", UNSET)) if optional != "this sometimes goes in the body" and not isinstance(optional, Unset): raise ValueError(f"optional must match const 'this sometimes goes in the body', got '{optional}'") diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_prefix_items_body.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_prefix_items_body.py index a578b3091..b074bb717 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_prefix_items_body.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/models/post_prefix_items_body.py @@ -1,4 +1,7 @@ -from typing import Any, Literal, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,28 +15,28 @@ class PostPrefixItemsBody: """ Attributes: - prefix_items_and_items (Union[Unset, list[Union[Literal['prefix'], float, str]]]): - prefix_items_only (Union[Unset, list[Union[float, str]]]): + prefix_items_and_items (list[float | Literal['prefix'] | str] | Unset): + prefix_items_only (list[float | str] | Unset): """ - prefix_items_and_items: Union[Unset, list[Union[Literal["prefix"], float, str]]] = UNSET - prefix_items_only: Union[Unset, list[Union[float, str]]] = UNSET + prefix_items_and_items: list[float | Literal["prefix"] | str] | Unset = UNSET + prefix_items_only: list[float | str] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - prefix_items_and_items: Union[Unset, list[Union[Literal["prefix"], float, str]]] = UNSET + prefix_items_and_items: list[float | Literal["prefix"] | str] | Unset = UNSET if not isinstance(self.prefix_items_and_items, Unset): prefix_items_and_items = [] for prefix_items_and_items_item_data in self.prefix_items_and_items: - prefix_items_and_items_item: Union[Literal["prefix"], float, str] + prefix_items_and_items_item: float | Literal["prefix"] | str prefix_items_and_items_item = prefix_items_and_items_item_data prefix_items_and_items.append(prefix_items_and_items_item) - prefix_items_only: Union[Unset, list[Union[float, str]]] = UNSET + prefix_items_only: list[float | str] | Unset = UNSET if not isinstance(self.prefix_items_only, Unset): prefix_items_only = [] for prefix_items_only_item_data in self.prefix_items_only: - prefix_items_only_item: Union[float, str] + prefix_items_only_item: float | str prefix_items_only_item = prefix_items_only_item_data prefix_items_only.append(prefix_items_only_item) @@ -48,35 +51,39 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() - prefix_items_and_items = [] + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) _prefix_items_and_items = d.pop("prefixItemsAndItems", UNSET) - for prefix_items_and_items_item_data in _prefix_items_and_items or []: + prefix_items_and_items: list[float | Literal["prefix"] | str] | Unset = UNSET + if _prefix_items_and_items is not UNSET: + prefix_items_and_items = [] + for prefix_items_and_items_item_data in _prefix_items_and_items: - def _parse_prefix_items_and_items_item(data: object) -> Union[Literal["prefix"], float, str]: - prefix_items_and_items_item_type_0 = cast(Literal["prefix"], data) - if prefix_items_and_items_item_type_0 != "prefix": - raise ValueError( - f"prefixItemsAndItems_item_type_0 must match const 'prefix', got '{prefix_items_and_items_item_type_0}'" - ) - return prefix_items_and_items_item_type_0 - return cast(Union[Literal["prefix"], float, str], data) + def _parse_prefix_items_and_items_item(data: object) -> float | Literal["prefix"] | str: + prefix_items_and_items_item_type_0 = cast(Literal["prefix"], data) + if prefix_items_and_items_item_type_0 != "prefix": + raise ValueError( + f"prefixItemsAndItems_item_type_0 must match const 'prefix', got '{prefix_items_and_items_item_type_0}'" + ) + return prefix_items_and_items_item_type_0 + return cast(float | Literal["prefix"] | str, data) - prefix_items_and_items_item = _parse_prefix_items_and_items_item(prefix_items_and_items_item_data) + prefix_items_and_items_item = _parse_prefix_items_and_items_item(prefix_items_and_items_item_data) - prefix_items_and_items.append(prefix_items_and_items_item) + prefix_items_and_items.append(prefix_items_and_items_item) - prefix_items_only = [] _prefix_items_only = d.pop("prefixItemsOnly", UNSET) - for prefix_items_only_item_data in _prefix_items_only or []: + prefix_items_only: list[float | str] | Unset = UNSET + if _prefix_items_only is not UNSET: + prefix_items_only = [] + for prefix_items_only_item_data in _prefix_items_only: - def _parse_prefix_items_only_item(data: object) -> Union[float, str]: - return cast(Union[float, str], data) + def _parse_prefix_items_only_item(data: object) -> float | str: + return cast(float | str, data) - prefix_items_only_item = _parse_prefix_items_only_item(prefix_items_only_item_data) + prefix_items_only_item = _parse_prefix_items_only_item(prefix_items_only_item_data) - prefix_items_only.append(prefix_items_only_item) + prefix_items_only.append(prefix_items_only_item) post_prefix_items_body = cls( prefix_items_and_items=prefix_items_and_items, diff --git a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/types.py b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/types.py index b9ed58b8a..b64af0952 100644 --- a/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/types.py +++ b/end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/types.py @@ -1,8 +1,8 @@ """Contains some shared types for properties""" -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Literal, Optional, TypeVar +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -14,7 +14,15 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]] +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define @@ -22,10 +30,10 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -40,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/end_to_end_tests/test_custom_templates/models_init.py.jinja b/end_to_end_tests/test_custom_templates/models_init.py.jinja new file mode 100644 index 000000000..8b0a55aee --- /dev/null +++ b/end_to_end_tests/test_custom_templates/models_init.py.jinja @@ -0,0 +1,33 @@ + +# Testing that we can access model-related information via Jinja variables. + +# To avoid having to update this file in the golden record every time the test specs are changed, +# we won't include all the classes in this output - we'll just look for one of them. + +# Using "alls" +{% for name in alls %} +{% if name == "AModel" %} +# {{ name }} +{% endif %} +{% endfor %} + +# Using "imports" +{% for import in imports %} +{% if import.endswith("import AModel") %} +# {{ import }} +{% endif %} +{% endfor %} + +# Using "openapi.models" +{% for model in openapi.models %} +{% if model.class_info.name == "AModel" %} +# {{ model.class_info.name }} ({{ model.class_info.module_name }}) +{% endif %} +{% endfor %} + +# Using "openapi.enums" +{% for enum in openapi.enums %} +{% if enum.class_info.name == "AnEnum" %} +# {{ enum.class_info.name }} ({{ enum.class_info.module_name }}) +{% endif %} +{% endfor %} diff --git a/end_to_end_tests/test_end_to_end.py b/end_to_end_tests/test_end_to_end.py index 124b801d2..93a4695ac 100644 --- a/end_to_end_tests/test_end_to_end.py +++ b/end_to_end_tests/test_end_to_end.py @@ -1,20 +1,22 @@ import shutil from filecmp import cmpfiles, dircmp from pathlib import Path -from typing import Optional import pytest from click.testing import Result from typer.testing import CliRunner +from end_to_end_tests.generated_client import ( + _run_command, generate_client, generate_client_from_inline_spec, +) from openapi_python_client.cli import app def _compare_directories( record: Path, test_subject: Path, - expected_differences: Optional[dict[Path, str]] = None, - expected_missing: Optional[set[str]] = None, + expected_differences: dict[Path, str] | None = None, + expected_missing: set[str] | None = None, ignore: list[str] = None, depth=0, ): @@ -79,55 +81,30 @@ def _compare_directories( def run_e2e_test( openapi_document: str, extra_args: list[str], - expected_differences: Optional[dict[Path, str]] = None, + expected_differences: dict[Path, str] | None = None, golden_record_path: str = "golden-record", output_path: str = "my-test-api-client", - expected_missing: Optional[set[str]] = None, + expected_missing: set[str] | None = None, + specify_output_path_explicitly: bool = True, ) -> Result: - output_path = Path.cwd() / output_path - shutil.rmtree(output_path, ignore_errors=True) - result = generate(extra_args, openapi_document) - gr_path = Path(__file__).parent / golden_record_path - - expected_differences = expected_differences or {} - # Use absolute paths for expected differences for easier comparisons - expected_differences = { - output_path.joinpath(key): value for key, value in expected_differences.items() - } - _compare_directories( - gr_path, output_path, expected_differences=expected_differences, expected_missing=expected_missing - ) - - import mypy.api - - out, err, status = mypy.api.run([str(output_path), "--strict"]) - assert status == 0, f"Type checking client failed: {out}" - - shutil.rmtree(output_path) - return result - + with generate_client(openapi_document, extra_args, output_path, specify_output_path_explicitly=specify_output_path_explicitly) as g: + gr_path = Path(__file__).parent / golden_record_path + + expected_differences = expected_differences or {} + # Use absolute paths for expected differences for easier comparisons + expected_differences = { + g.output_path.joinpath(key): value for key, value in expected_differences.items() + } + _compare_directories( + gr_path, g.output_path, expected_differences=expected_differences, expected_missing=expected_missing + ) -def generate(extra_args: Optional[list[str]], openapi_document: str) -> Result: - """Generate a client from an OpenAPI document and return the path to the generated code""" - _run_command("generate", extra_args, openapi_document) + import mypy.api + out, err, status = mypy.api.run([str(g.output_path), "--strict"]) + assert status == 0, f"Type checking client failed: {out}" -def _run_command(command: str, extra_args: Optional[list[str]] = None, openapi_document: Optional[str] = None, url: Optional[str] = None, config_path: Optional[Path] = None) -> Result: - """Generate a client from an OpenAPI document and return the path to the generated code""" - runner = CliRunner() - if openapi_document is not None: - openapi_path = Path(__file__).parent / openapi_document - source_arg = f"--path={openapi_path}" - else: - source_arg = f"--url={url}" - config_path = config_path or (Path(__file__).parent / "config.yml") - args = [command, f"--config={config_path}", source_arg] - if extra_args: - args.extend(extra_args) - result = runner.invoke(app, args) - if result.exit_code != 0: - raise Exception(result.stdout) - return result + return g.generator_result def test_baseline_end_to_end_3_0(): @@ -165,21 +142,21 @@ def test_literal_enums_end_to_end(): ("setup", "setup.py", "setup.py"), ("pdm", "pyproject.toml", "pdm.pyproject.toml"), ("poetry", "pyproject.toml", "poetry.pyproject.toml"), + ("uv", "pyproject.toml", "uv.pyproject.toml"), ) ) -def test_meta(meta: str, generated_file: Optional[str], expected_file: Optional[str]): - output_path = Path.cwd() / "test-3-1-features-client" - shutil.rmtree(output_path, ignore_errors=True) - generate([f"--meta={meta}"], "3.1_specific.openapi.yaml") - - if generated_file and expected_file: - assert (output_path / generated_file).exists() - assert ( - (output_path / generated_file).read_text() == - (Path(__file__).parent / "metadata_snapshots" / expected_file).read_text() - ) - - shutil.rmtree(output_path) +def test_meta(meta: str, generated_file: str | None, expected_file: str | None): + with generate_client( + "3.1_specific.openapi.yaml", + extra_args=[f"--meta={meta}"], + output_path="test-3-1-features-client", + ) as g: + if generated_file and expected_file: + assert (g.output_path / generated_file).exists() + assert ( + (g.output_path / generated_file).read_text() == + (Path(__file__).parent / "metadata_snapshots" / expected_file).read_text() + ) def test_none_meta(): @@ -189,6 +166,17 @@ def test_none_meta(): golden_record_path="test-3-1-golden-record/test_3_1_features_client", output_path="test_3_1_features_client", expected_missing={"py.typed"}, + specify_output_path_explicitly=False, + ) + + +def test_docstrings_on_attributes(): + config_path = Path(__file__).parent / "docstrings_on_attributes.config.yml" + run_e2e_test( + "docstrings_on_attributes.yml", + [f"--config={config_path}"], + {}, + "docstrings-on-attributes-golden-record", ) @@ -197,6 +185,7 @@ def test_custom_templates(): {} ) # key: path relative to generated directory, value: expected generated content api_dir = Path("my_test_api_client").joinpath("api") + models_dir = Path("my_test_api_client").joinpath("models") golden_tpls_root_dir = Path(__file__).parent.joinpath( "custom-templates-golden-record" ) @@ -204,6 +193,7 @@ def test_custom_templates(): expected_difference_paths = [ Path("README.md"), api_dir.joinpath("__init__.py"), + models_dir.joinpath("__init__.py"), ] for expected_difference_path in expected_difference_paths: @@ -230,7 +220,7 @@ def test_bad_url(): runner = CliRunner() result = runner.invoke(app, ["generate", "--url=not_a_url"]) assert result.exit_code == 1 - assert "Could not get OpenAPI document from provided URL" in result.stdout + assert "Could not get OpenAPI document from provided URL" in result.stderr ERROR_DOCUMENTS = [path for path in Path(__file__).parent.joinpath("documents_with_errors").iterdir() if path.is_file()] @@ -238,73 +228,63 @@ def test_bad_url(): @pytest.mark.parametrize("document", ERROR_DOCUMENTS, ids=[path.stem for path in ERROR_DOCUMENTS]) def test_documents_with_errors(snapshot, document): - runner = CliRunner() - output_path = Path.cwd() / "test-documents-with-errors" - shutil.rmtree(output_path, ignore_errors=True) - result = runner.invoke(app, ["generate", f"--path={document}", "--fail-on-warning", f"--output-path={output_path}"]) - assert result.exit_code == 1 - assert result.stdout.replace(str(output_path), "/test-documents-with-errors") == snapshot - shutil.rmtree(output_path, ignore_errors=True) + with generate_client( + document, + extra_args=["--fail-on-warning"], + output_path="test-documents-with-errors", + raise_on_error=False, + ) as g: + result = g.generator_result + assert result.exit_code == 1 + output = (result.stdout + result.stderr).replace(str(g.output_path), "/test-documents-with-errors") + assert output == snapshot def test_custom_post_hooks(): - shutil.rmtree(Path.cwd() / "my-test-api-client", ignore_errors=True) - runner = CliRunner() - openapi_document = Path(__file__).parent / "baseline_openapi_3.0.json" config_path = Path(__file__).parent / "custom_post_hooks.config.yml" - result = runner.invoke(app, ["generate", f"--path={openapi_document}", f"--config={config_path}"]) - assert result.exit_code == 1 - assert "this should fail" in result.stdout - shutil.rmtree(Path.cwd() / "my-test-api-client", ignore_errors=True) + with generate_client( + "baseline_openapi_3.0.json", + [f"--config={config_path}"], + raise_on_error=False, + ) as g: + assert g.generator_result.exit_code == 1 + assert "this should fail" in g.generator_result.stderr def test_generate_dir_already_exists(): project_dir = Path.cwd() / "my-test-api-client" if not project_dir.exists(): project_dir.mkdir() - runner = CliRunner() - openapi_document = Path(__file__).parent / "baseline_openapi_3.0.json" - result = runner.invoke(app, ["generate", f"--path={openapi_document}"]) - assert result.exit_code == 1 - assert "Directory already exists" in result.stdout - shutil.rmtree(Path.cwd() / "my-test-api-client", ignore_errors=True) - - -@pytest.mark.parametrize( - ("file_name", "content", "expected_error"), - ( - ("invalid_openapi.yaml", "not a valid openapi document", "Failed to parse OpenAPI document"), - ("invalid_json.json", "Invalid JSON", "Invalid JSON"), - ("invalid_yaml.yaml", "{", "Invalid YAML"), - ), - ids=("invalid_openapi", "invalid_json", "invalid_yaml") -) -def test_invalid_openapi_document(file_name, content, expected_error): - runner = CliRunner() - openapi_document = Path.cwd() / file_name - openapi_document.write_text(content) - result = runner.invoke(app, ["generate", f"--path={openapi_document}"]) - assert result.exit_code == 1 - assert expected_error in result.stdout - openapi_document.unlink() + try: + runner = CliRunner() + openapi_document = Path(__file__).parent / "baseline_openapi_3.0.json" + result = runner.invoke(app, ["generate", f"--path={openapi_document}"]) + assert result.exit_code == 1 + assert "Directory already exists" in result.stderr + finally: + shutil.rmtree(Path.cwd() / "my-test-api-client", ignore_errors=True) def test_update_integration_tests(): - url = "https://raw.githubusercontent.com/openapi-generators/openapi-test-server/main/openapi.json" + url = "https://raw.githubusercontent.com/openapi-generators/openapi-test-server/refs/tags/v0.2.1/openapi.yaml" source_path = Path(__file__).parent.parent / "integration-tests" temp_dir = Path.cwd() / "test_update_integration_tests" shutil.rmtree(temp_dir, ignore_errors=True) - shutil.copytree(source_path, temp_dir) - config_path = source_path / "config.yaml" - _run_command( - "generate", - extra_args=["--overwrite", "--meta=pdm", f"--output-path={temp_dir}"], - url=url, - config_path=config_path - ) - _compare_directories(source_path, temp_dir, ignore=["pyproject.toml"]) - import mypy.api - out, err, status = mypy.api.run([str(temp_dir), "--strict"]) - assert status == 0, f"Type checking client failed: {out}" - shutil.rmtree(temp_dir) + try: + shutil.copytree(source_path, temp_dir) + config_path = source_path / "config.yaml" + _run_command( + "generate", + extra_args=["--overwrite", "--meta=pdm", f"--output-path={temp_dir}"], + url=url, + config_path=config_path + ) + _compare_directories(source_path, temp_dir, ignore=["pyproject.toml"]) + import mypy.api + + out, err, status = mypy.api.run([str(temp_dir), "--strict"]) + assert status == 0, f"Type checking client failed: {out=} {err=}" + + finally: + shutil.rmtree(temp_dir) diff --git a/integration-tests/integration_tests/api/body/__init__.py b/integration-tests/integration_tests/api/body/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/integration-tests/integration_tests/api/body/__init__.py +++ b/integration-tests/integration_tests/api/body/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/integration-tests/integration_tests/api/body/post_body_multipart.py b/integration-tests/integration_tests/api/body/post_body_multipart.py index 13c943ad7..32754e8cc 100644 --- a/integration-tests/integration_tests/api/body/post_body_multipart.py +++ b/integration-tests/integration_tests/api/body/post_body_multipart.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -22,25 +22,25 @@ def _get_kwargs( "url": "/body/multipart", } - _body = body.to_multipart() - - _kwargs["files"] = _body + _kwargs["files"] = body.to_multipart() _kwargs["headers"] = headers return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[PostBodyMultipartResponse200, PublicError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> PostBodyMultipartResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostBodyMultipartResponse200.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = PublicError.from_dict(response.json()) return response_400 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -48,8 +48,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[PostBodyMultipartResponse200, PublicError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[PostBodyMultipartResponse200 | PublicError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,9 +60,9 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostBodyMultipartBody, -) -> Response[Union[PostBodyMultipartResponse200, PublicError]]: +) -> Response[PostBodyMultipartResponse200 | PublicError]: """ Args: body (PostBodyMultipartBody): @@ -72,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[PostBodyMultipartResponse200, PublicError]] + Response[PostBodyMultipartResponse200 | PublicError] """ kwargs = _get_kwargs( @@ -88,9 +88,9 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostBodyMultipartBody, -) -> Optional[Union[PostBodyMultipartResponse200, PublicError]]: +) -> PostBodyMultipartResponse200 | PublicError | None: """ Args: body (PostBodyMultipartBody): @@ -100,7 +100,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[PostBodyMultipartResponse200, PublicError] + PostBodyMultipartResponse200 | PublicError """ return sync_detailed( @@ -111,9 +111,9 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostBodyMultipartBody, -) -> Response[Union[PostBodyMultipartResponse200, PublicError]]: +) -> Response[PostBodyMultipartResponse200 | PublicError]: """ Args: body (PostBodyMultipartBody): @@ -123,7 +123,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[PostBodyMultipartResponse200, PublicError]] + Response[PostBodyMultipartResponse200 | PublicError] """ kwargs = _get_kwargs( @@ -137,9 +137,9 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, body: PostBodyMultipartBody, -) -> Optional[Union[PostBodyMultipartResponse200, PublicError]]: +) -> PostBodyMultipartResponse200 | PublicError | None: """ Args: body (PostBodyMultipartBody): @@ -149,7 +149,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[PostBodyMultipartResponse200, PublicError] + PostBodyMultipartResponse200 | PublicError """ return ( diff --git a/integration-tests/integration_tests/api/parameters/__init__.py b/integration-tests/integration_tests/api/parameters/__init__.py index e69de29bb..2d7c0b23d 100644 --- a/integration-tests/integration_tests/api/parameters/__init__.py +++ b/integration-tests/integration_tests/api/parameters/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/integration-tests/integration_tests/api/parameters/post_parameters_header.py b/integration-tests/integration_tests/api/parameters/post_parameters_header.py index 0981585cc..190b7efe0 100644 --- a/integration-tests/integration_tests/api/parameters/post_parameters_header.py +++ b/integration-tests/integration_tests/api/parameters/post_parameters_header.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -36,16 +36,18 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[PostParametersHeaderResponse200, PublicError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> PostParametersHeaderResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostParametersHeaderResponse200.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = PublicError.from_dict(response.json()) return response_400 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -53,8 +55,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[PostParametersHeaderResponse200, PublicError]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[PostParametersHeaderResponse200 | PublicError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,12 +67,12 @@ def _build_response( def sync_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Response[Union[PostParametersHeaderResponse200, PublicError]]: +) -> Response[PostParametersHeaderResponse200 | PublicError]: """ Args: boolean_header (bool): @@ -83,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[PostParametersHeaderResponse200, PublicError]] + Response[PostParametersHeaderResponse200 | PublicError] """ kwargs = _get_kwargs( @@ -102,12 +104,12 @@ def sync_detailed( def sync( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Optional[Union[PostParametersHeaderResponse200, PublicError]]: +) -> PostParametersHeaderResponse200 | PublicError | None: """ Args: boolean_header (bool): @@ -120,7 +122,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[PostParametersHeaderResponse200, PublicError] + PostParametersHeaderResponse200 | PublicError """ return sync_detailed( @@ -134,12 +136,12 @@ def sync( async def asyncio_detailed( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Response[Union[PostParametersHeaderResponse200, PublicError]]: +) -> Response[PostParametersHeaderResponse200 | PublicError]: """ Args: boolean_header (bool): @@ -152,7 +154,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[PostParametersHeaderResponse200, PublicError]] + Response[PostParametersHeaderResponse200 | PublicError] """ kwargs = _get_kwargs( @@ -169,12 +171,12 @@ async def asyncio_detailed( async def asyncio( *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient | Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Optional[Union[PostParametersHeaderResponse200, PublicError]]: +) -> PostParametersHeaderResponse200 | PublicError | None: """ Args: boolean_header (bool): @@ -187,7 +189,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[PostParametersHeaderResponse200, PublicError] + PostParametersHeaderResponse200 | PublicError """ return ( diff --git a/integration-tests/integration_tests/client.py b/integration-tests/integration_tests/client.py index e80446f10..1b7055ab8 100644 --- a/integration-tests/integration_tests/client.py +++ b/integration-tests/integration_tests/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,12 +38,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -168,12 +168,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/integration-tests/integration_tests/models/__init__.py b/integration-tests/integration_tests/models/__init__.py index 275cf6faa..257cfe9fa 100644 --- a/integration-tests/integration_tests/models/__init__.py +++ b/integration-tests/integration_tests/models/__init__.py @@ -1,5 +1,7 @@ """Contains all the data models used in inputs/outputs""" +from .an_object import AnObject +from .file import File from .post_body_multipart_body import PostBodyMultipartBody from .post_body_multipart_response_200 import PostBodyMultipartResponse200 from .post_parameters_header_response_200 import PostParametersHeaderResponse200 @@ -7,6 +9,8 @@ from .public_error import PublicError __all__ = ( + "AnObject", + "File", "PostBodyMultipartBody", "PostBodyMultipartResponse200", "PostParametersHeaderResponse200", diff --git a/integration-tests/integration_tests/models/an_object.py b/integration-tests/integration_tests/models/an_object.py new file mode 100644 index 000000000..228568b8c --- /dev/null +++ b/integration-tests/integration_tests/models/an_object.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AnObject") + + +@_attrs_define +class AnObject: + """ + Attributes: + an_int (int): + a_float (float): + """ + + an_int: int + a_float: float + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + an_int = self.an_int + + a_float = self.a_float + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "an_int": an_int, + "a_float": a_float, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + an_int = d.pop("an_int") + + a_float = d.pop("a_float") + + an_object = cls( + an_int=an_int, + a_float=a_float, + ) + + an_object.additional_properties = d + return an_object + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/integration-tests/integration_tests/models/file.py b/integration-tests/integration_tests/models/file.py new file mode 100644 index 000000000..2380e8737 --- /dev/null +++ b/integration-tests/integration_tests/models/file.py @@ -0,0 +1,79 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="File") + + +@_attrs_define +class File: + """ + Attributes: + data (str | Unset): Echo of content of the 'file' input parameter from the form. + name (str | Unset): The name of the file uploaded. + content_type (str | Unset): The content type of the file uploaded. + """ + + data: str | Unset = UNSET + name: str | Unset = UNSET + content_type: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = self.data + + name = self.name + + content_type = self.content_type + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if data is not UNSET: + field_dict["data"] = data + if name is not UNSET: + field_dict["name"] = name + if content_type is not UNSET: + field_dict["content_type"] = content_type + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + data = d.pop("data", UNSET) + + name = d.pop("name", UNSET) + + content_type = d.pop("content_type", UNSET) + + file = cls( + data=data, + name=name, + content_type=content_type, + ) + + file.additional_properties = d + return file + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/integration-tests/integration_tests/models/post_body_multipart_body.py b/integration-tests/integration_tests/models/post_body_multipart_body.py index 13174200d..09f437501 100644 --- a/integration-tests/integration_tests/models/post_body_multipart_body.py +++ b/integration-tests/integration_tests/models/post_body_multipart_body.py @@ -1,10 +1,21 @@ +from __future__ import annotations + +import datetime +import json +from collections.abc import Mapping from io import BytesIO -from typing import Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .. import types +from ..types import File + +if TYPE_CHECKING: + from ..models.an_object import AnObject -from ..types import UNSET, File, Unset T = TypeVar("T", bound="PostBodyMultipartBody") @@ -14,75 +25,111 @@ class PostBodyMultipartBody: """ Attributes: a_string (str): - file (File): For the sake of this test, include a file name and content type. The payload should also be valid - UTF-8. - description (Union[Unset, str]): + files (list[File]): + description (str): + objects (list[AnObject]): + times (list[datetime.datetime]): """ a_string: str - file: File - description: Union[Unset, str] = UNSET + files: list[File] + description: str + objects: list[AnObject] + times: list[datetime.datetime] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: a_string = self.a_string - file = self.file.to_tuple() + files = [] + for files_item_data in self.files: + files_item = files_item_data.to_tuple() + + files.append(files_item) description = self.description + objects = [] + for objects_item_data in self.objects: + objects_item = objects_item_data.to_dict() + objects.append(objects_item) + + times = [] + for times_item_data in self.times: + times_item = times_item_data.isoformat() + times.append(times_item) + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "a_string": a_string, - "file": file, + "files": files, + "description": description, + "objects": objects, + "times": times, } ) - if description is not UNSET: - field_dict["description"] = description return field_dict - def to_multipart(self) -> dict[str, Any]: - a_string = (None, str(self.a_string).encode(), "text/plain") + def to_multipart(self) -> types.RequestFiles: + files: types.RequestFiles = [] - file = self.file.to_tuple() + files.append(("a_string", (None, str(self.a_string).encode(), "text/plain"))) - description = ( - self.description - if isinstance(self.description, Unset) - else (None, str(self.description).encode(), "text/plain") - ) + for files_item_element in self.files: + files.append(("files", files_item_element.to_tuple())) - field_dict: dict[str, Any] = {} - for prop_name, prop in self.additional_properties.items(): - field_dict[prop_name] = (None, str(prop).encode(), "text/plain") + files.append(("description", (None, str(self.description).encode(), "text/plain"))) - field_dict.update( - { - "a_string": a_string, - "file": file, - } - ) - if description is not UNSET: - field_dict["description"] = description + for objects_item_element in self.objects: + files.append(("objects", (None, json.dumps(objects_item_element.to_dict()).encode(), "application/json"))) - return field_dict + for times_item_element in self.times: + files.append(("times", (None, times_item_element.isoformat().encode(), "text/plain"))) + + for prop_name, prop in self.additional_properties.items(): + files.append((prop_name, (None, str(prop).encode(), "text/plain"))) + + return files @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.an_object import AnObject + + d = dict(src_dict) a_string = d.pop("a_string") - file = File(payload=BytesIO(d.pop("file"))) + files = [] + _files = d.pop("files") + for files_item_data in _files: + files_item = File(payload=BytesIO(files_item_data)) + + files.append(files_item) + + description = d.pop("description") + + objects = [] + _objects = d.pop("objects") + for objects_item_data in _objects: + objects_item = AnObject.from_dict(objects_item_data) + + objects.append(objects_item) + + times = [] + _times = d.pop("times") + for times_item_data in _times: + times_item = isoparse(times_item_data) - description = d.pop("description", UNSET) + times.append(times_item) post_body_multipart_body = cls( a_string=a_string, - file=file, + files=files, description=description, + objects=objects, + times=times, ) post_body_multipart_body.additional_properties = d diff --git a/integration-tests/integration_tests/models/post_body_multipart_response_200.py b/integration-tests/integration_tests/models/post_body_multipart_response_200.py index 65f38c082..20ba3eebd 100644 --- a/integration-tests/integration_tests/models/post_body_multipart_response_200.py +++ b/integration-tests/integration_tests/models/post_body_multipart_response_200.py @@ -1,7 +1,17 @@ -from typing import Any, TypeVar +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field +from dateutil.parser import isoparse + +if TYPE_CHECKING: + from ..models.an_object import AnObject + from ..models.file import File + T = TypeVar("T", bound="PostBodyMultipartResponse200") @@ -11,63 +21,90 @@ class PostBodyMultipartResponse200: """ Attributes: a_string (str): Echo of the 'a_string' input parameter from the form. - file_data (str): Echo of content of the 'file' input parameter from the form. description (str): Echo of the 'description' input parameter from the form. - file_name (str): The name of the file uploaded. - file_content_type (str): The content type of the file uploaded. + files (list[File]): + times (list[datetime.datetime]): + objects (list[AnObject]): """ a_string: str - file_data: str description: str - file_name: str - file_content_type: str + files: list[File] + times: list[datetime.datetime] + objects: list[AnObject] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: a_string = self.a_string - file_data = self.file_data - description = self.description - file_name = self.file_name + files = [] + for files_item_data in self.files: + files_item = files_item_data.to_dict() + files.append(files_item) + + times = [] + for times_item_data in self.times: + times_item = times_item_data.isoformat() + times.append(times_item) - file_content_type = self.file_content_type + objects = [] + for objects_item_data in self.objects: + objects_item = objects_item_data.to_dict() + objects.append(objects_item) field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "a_string": a_string, - "file_data": file_data, "description": description, - "file_name": file_name, - "file_content_type": file_content_type, + "files": files, + "times": times, + "objects": objects, } ) return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() - a_string = d.pop("a_string") + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.an_object import AnObject + from ..models.file import File - file_data = d.pop("file_data") + d = dict(src_dict) + a_string = d.pop("a_string") description = d.pop("description") - file_name = d.pop("file_name") + files = [] + _files = d.pop("files") + for files_item_data in _files: + files_item = File.from_dict(files_item_data) + + files.append(files_item) + + times = [] + _times = d.pop("times") + for times_item_data in _times: + times_item = isoparse(times_item_data) + + times.append(times_item) + + objects = [] + _objects = d.pop("objects") + for objects_item_data in _objects: + objects_item = AnObject.from_dict(objects_item_data) - file_content_type = d.pop("file_content_type") + objects.append(objects_item) post_body_multipart_response_200 = cls( a_string=a_string, - file_data=file_data, description=description, - file_name=file_name, - file_content_type=file_content_type, + files=files, + times=times, + objects=objects, ) post_body_multipart_response_200.additional_properties = d diff --git a/integration-tests/integration_tests/models/post_parameters_header_response_200.py b/integration-tests/integration_tests/models/post_parameters_header_response_200.py index ff44f5644..d5baeabbd 100644 --- a/integration-tests/integration_tests/models/post_parameters_header_response_200.py +++ b/integration-tests/integration_tests/models/post_parameters_header_response_200.py @@ -1,3 +1,6 @@ +from __future__ import annotations + +from collections.abc import Mapping from typing import Any, TypeVar from attrs import define as _attrs_define @@ -45,8 +48,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) boolean = d.pop("boolean") string = d.pop("string") diff --git a/integration-tests/integration_tests/models/problem.py b/integration-tests/integration_tests/models/problem.py index f61f42b5d..a7f270874 100644 --- a/integration-tests/integration_tests/models/problem.py +++ b/integration-tests/integration_tests/models/problem.py @@ -1,4 +1,7 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -12,12 +15,12 @@ class Problem: """ Attributes: - parameter_name (Union[Unset, str]): - description (Union[Unset, str]): + parameter_name (str | Unset): + description (str | Unset): """ - parameter_name: Union[Unset, str] = UNSET - description: Union[Unset, str] = UNSET + parameter_name: str | Unset = UNSET + description: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -36,8 +39,8 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: - d = src_dict.copy() + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) parameter_name = d.pop("parameter_name", UNSET) description = d.pop("description", UNSET) diff --git a/integration-tests/integration_tests/models/public_error.py b/integration-tests/integration_tests/models/public_error.py index 5e9d53c26..40c711bed 100644 --- a/integration-tests/integration_tests/models/public_error.py +++ b/integration-tests/integration_tests/models/public_error.py @@ -1,4 +1,7 @@ -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,35 +19,35 @@ class PublicError: """ Attributes: - errors (Union[Unset, list[str]]): - extra_parameters (Union[Unset, list[str]]): - invalid_parameters (Union[Unset, list['Problem']]): - missing_parameters (Union[Unset, list[str]]): + errors (list[str] | Unset): + extra_parameters (list[str] | Unset): + invalid_parameters (list[Problem] | Unset): + missing_parameters (list[str] | Unset): """ - errors: Union[Unset, list[str]] = UNSET - extra_parameters: Union[Unset, list[str]] = UNSET - invalid_parameters: Union[Unset, list["Problem"]] = UNSET - missing_parameters: Union[Unset, list[str]] = UNSET + errors: list[str] | Unset = UNSET + extra_parameters: list[str] | Unset = UNSET + invalid_parameters: list[Problem] | Unset = UNSET + missing_parameters: list[str] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - errors: Union[Unset, list[str]] = UNSET + errors: list[str] | Unset = UNSET if not isinstance(self.errors, Unset): errors = self.errors - extra_parameters: Union[Unset, list[str]] = UNSET + extra_parameters: list[str] | Unset = UNSET if not isinstance(self.extra_parameters, Unset): extra_parameters = self.extra_parameters - invalid_parameters: Union[Unset, list[dict[str, Any]]] = UNSET + invalid_parameters: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.invalid_parameters, Unset): invalid_parameters = [] for invalid_parameters_item_data in self.invalid_parameters: invalid_parameters_item = invalid_parameters_item_data.to_dict() invalid_parameters.append(invalid_parameters_item) - missing_parameters: Union[Unset, list[str]] = UNSET + missing_parameters: list[str] | Unset = UNSET if not isinstance(self.missing_parameters, Unset): missing_parameters = self.missing_parameters @@ -63,20 +66,22 @@ def to_dict(self) -> dict[str, Any]: return field_dict @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.problem import Problem - d = src_dict.copy() + d = dict(src_dict) errors = cast(list[str], d.pop("errors", UNSET)) extra_parameters = cast(list[str], d.pop("extra_parameters", UNSET)) - invalid_parameters = [] _invalid_parameters = d.pop("invalid_parameters", UNSET) - for invalid_parameters_item_data in _invalid_parameters or []: - invalid_parameters_item = Problem.from_dict(invalid_parameters_item_data) + invalid_parameters: list[Problem] | Unset = UNSET + if _invalid_parameters is not UNSET: + invalid_parameters = [] + for invalid_parameters_item_data in _invalid_parameters: + invalid_parameters_item = Problem.from_dict(invalid_parameters_item_data) - invalid_parameters.append(invalid_parameters_item) + invalid_parameters.append(invalid_parameters_item) missing_parameters = cast(list[str], d.pop("missing_parameters", UNSET)) diff --git a/integration-tests/integration_tests/types.py b/integration-tests/integration_tests/types.py index b9ed58b8a..b64af0952 100644 --- a/integration-tests/integration_tests/types.py +++ b/integration-tests/integration_tests/types.py @@ -1,8 +1,8 @@ """Contains some shared types for properties""" -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Literal, Optional, TypeVar +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -14,7 +14,15 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]] +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define @@ -22,10 +30,10 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -40,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/integration-tests/pdm.lock b/integration-tests/pdm.lock index a854a988f..f2350c04f 100644 --- a/integration-tests/pdm.lock +++ b/integration-tests/pdm.lock @@ -5,16 +5,16 @@ groups = ["default", "dev"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:a575c5fc1f04f52530c52becbcc2f40498a54612d0eeeaddf6701fe5336986ac" +content_hash = "sha256:9404cbb9c293ee893b3e763b97fc5db2cb27fc7911dabedc0c3306a965a69a44" [[metadata.targets]] -requires_python = "~=3.9" +requires_python = "~=3.10" [[package]] name = "anyio" -version = "4.7.0" +version = "4.11.0" requires_python = ">=3.9" -summary = "High level compatibility layer for multiple asynchronous event loop implementations" +summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", @@ -23,30 +23,42 @@ dependencies = [ "typing-extensions>=4.5; python_version < \"3.13\"", ] files = [ - {file = "anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352"}, - {file = "anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48"}, + {file = "anyio-4.11.0-py3-none-any.whl", hash = "sha256:0287e96f4d26d4149305414d4e3bc32f0dcd0862365a4bddea19d7a1ec38c4fc"}, + {file = "anyio-4.11.0.tar.gz", hash = "sha256:82a8d0b81e318cc5ce71a5f1f8b5c4e63619620b63141ef8c995fa0db95a57c4"}, ] [[package]] name = "attrs" -version = "24.3.0" -requires_python = ">=3.8" +version = "25.4.0" +requires_python = ">=3.9" summary = "Classes Without Boilerplate" groups = ["default"] files = [ - {file = "attrs-24.3.0-py3-none-any.whl", hash = "sha256:ac96cd038792094f438ad1f6ff80837353805ac950cd2aa0e0625ef19850c308"}, - {file = "attrs-24.3.0.tar.gz", hash = "sha256:8f5c07333d543103541ba7be0e2ce16eeee8130cb0b3f9238ab904ce1e85baff"}, + {file = "attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373"}, + {file = "attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11"}, +] + +[[package]] +name = "backports-asyncio-runner" +version = "1.2.0" +requires_python = "<3.11,>=3.8" +summary = "Backport of asyncio.Runner, a context manager that controls event loop life cycle." +groups = ["dev"] +marker = "python_version < \"3.11\"" +files = [ + {file = "backports_asyncio_runner-1.2.0-py3-none-any.whl", hash = "sha256:0da0a936a8aeb554eccb426dc55af3ba63bcdc69fa1a600b5bb305413a4477b5"}, + {file = "backports_asyncio_runner-1.2.0.tar.gz", hash = "sha256:a5aa7b2b7d8f8bfcaa2b57313f70792df84e32a2a746f585213373f900b42162"}, ] [[package]] name = "certifi" -version = "2024.12.14" -requires_python = ">=3.6" +version = "2025.10.5" +requires_python = ">=3.7" summary = "Python package for providing Mozilla's CA Bundle." groups = ["default"] files = [ - {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, - {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, + {file = "certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de"}, + {file = "certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43"}, ] [[package]] @@ -63,43 +75,43 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.2" +version = "1.3.0" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" groups = ["default", "dev"] marker = "python_version < \"3.11\"" +dependencies = [ + "typing-extensions>=4.6.0; python_version < \"3.13\"", +] files = [ - {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, - {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, + {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, + {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] [[package]] name = "h11" -version = "0.14.0" -requires_python = ">=3.7" +version = "0.16.0" +requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] -dependencies = [ - "typing-extensions; python_version < \"3.8\"", -] files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] name = "httpcore" -version = "1.0.7" +version = "1.0.9" requires_python = ">=3.8" summary = "A minimal low-level HTTP client." groups = ["default"] dependencies = [ "certifi", - "h11<0.15,>=0.13", + "h11>=0.16", ] files = [ - {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"}, - {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"}, + {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, + {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, ] [[package]] @@ -121,131 +133,162 @@ files = [ [[package]] name = "idna" -version = "3.10" -requires_python = ">=3.6" +version = "3.11" +requires_python = ">=3.8" summary = "Internationalized Domain Names in Applications (IDNA)" groups = ["default"] files = [ - {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, - {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, + {file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"}, + {file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"}, ] [[package]] name = "iniconfig" -version = "2.0.0" -requires_python = ">=3.7" +version = "2.3.0" +requires_python = ">=3.10" summary = "brain-dead simple config-ini parsing" groups = ["dev"] files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"}, + {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, ] [[package]] name = "mypy" -version = "1.14.0" -requires_python = ">=3.8" +version = "1.18.2" +requires_python = ">=3.9" summary = "Optional static typing for Python" groups = ["dev"] dependencies = [ "mypy-extensions>=1.0.0", + "pathspec>=0.9.0", "tomli>=1.1.0; python_version < \"3.11\"", "typing-extensions>=4.6.0", ] files = [ - {file = "mypy-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e971c1c667007f9f2b397ffa80fa8e1e0adccff336e5e77e74cb5f22868bee87"}, - {file = "mypy-1.14.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e86aaeaa3221a278c66d3d673b297232947d873773d61ca3ee0e28b2ff027179"}, - {file = "mypy-1.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1628c5c3ce823d296e41e2984ff88c5861499041cb416a8809615d0c1f41740e"}, - {file = "mypy-1.14.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7fadb29b77fc14a0dd81304ed73c828c3e5cde0016c7e668a86a3e0dfc9f3af3"}, - {file = "mypy-1.14.0-cp310-cp310-win_amd64.whl", hash = "sha256:3fa76988dc760da377c1e5069200a50d9eaaccf34f4ea18428a3337034ab5a44"}, - {file = "mypy-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6e73c8a154eed31db3445fe28f63ad2d97b674b911c00191416cf7f6459fd49a"}, - {file = "mypy-1.14.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:273e70fcb2e38c5405a188425aa60b984ffdcef65d6c746ea5813024b68c73dc"}, - {file = "mypy-1.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1daca283d732943731a6a9f20fdbcaa927f160bc51602b1d4ef880a6fb252015"}, - {file = "mypy-1.14.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7e68047bedb04c1c25bba9901ea46ff60d5eaac2d71b1f2161f33107e2b368eb"}, - {file = "mypy-1.14.0-cp311-cp311-win_amd64.whl", hash = "sha256:7a52f26b9c9b1664a60d87675f3bae00b5c7f2806e0c2800545a32c325920bcc"}, - {file = "mypy-1.14.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d5326ab70a6db8e856d59ad4cb72741124950cbbf32e7b70e30166ba7bbf61dd"}, - {file = "mypy-1.14.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bf4ec4980bec1e0e24e5075f449d014011527ae0055884c7e3abc6a99cd2c7f1"}, - {file = "mypy-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:390dfb898239c25289495500f12fa73aa7f24a4c6d90ccdc165762462b998d63"}, - {file = "mypy-1.14.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7e026d55ddcd76e29e87865c08cbe2d0104e2b3153a523c529de584759379d3d"}, - {file = "mypy-1.14.0-cp312-cp312-win_amd64.whl", hash = "sha256:585ed36031d0b3ee362e5107ef449a8b5dfd4e9c90ccbe36414ee405ee6b32ba"}, - {file = "mypy-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9f6f4c0b27401d14c483c622bc5105eff3911634d576bbdf6695b9a7c1ba741"}, - {file = "mypy-1.14.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:56b2280cedcb312c7a79f5001ae5325582d0d339bce684e4a529069d0e7ca1e7"}, - {file = "mypy-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:342de51c48bab326bfc77ce056ba08c076d82ce4f5a86621f972ed39970f94d8"}, - {file = "mypy-1.14.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:00df23b42e533e02a6f0055e54de9a6ed491cd8b7ea738647364fd3a39ea7efc"}, - {file = "mypy-1.14.0-cp313-cp313-win_amd64.whl", hash = "sha256:e8c8387e5d9dff80e7daf961df357c80e694e942d9755f3ad77d69b0957b8e3f"}, - {file = "mypy-1.14.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:14117b9da3305b39860d0aa34b8f1ff74d209a368829a584eb77524389a9c13e"}, - {file = "mypy-1.14.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af98c5a958f9c37404bd4eef2f920b94874507e146ed6ee559f185b8809c44cc"}, - {file = "mypy-1.14.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f0b343a1d3989547024377c2ba0dca9c74a2428ad6ed24283c213af8dbb0710b"}, - {file = "mypy-1.14.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:cdb5563c1726c85fb201be383168f8c866032db95e1095600806625b3a648cb7"}, - {file = "mypy-1.14.0-cp39-cp39-win_amd64.whl", hash = "sha256:74e925649c1ee0a79aa7448baf2668d81cc287dc5782cff6a04ee93f40fb8d3f"}, - {file = "mypy-1.14.0-py3-none-any.whl", hash = "sha256:2238d7f93fc4027ed1efc944507683df3ba406445a2b6c96e79666a045aadfab"}, - {file = "mypy-1.14.0.tar.gz", hash = "sha256:822dbd184d4a9804df5a7d5335a68cf7662930e70b8c1bc976645d1509f9a9d6"}, + {file = "mypy-1.18.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c1eab0cf6294dafe397c261a75f96dc2c31bffe3b944faa24db5def4e2b0f77c"}, + {file = "mypy-1.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7a780ca61fc239e4865968ebc5240bb3bf610ef59ac398de9a7421b54e4a207e"}, + {file = "mypy-1.18.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:448acd386266989ef11662ce3c8011fd2a7b632e0ec7d61a98edd8e27472225b"}, + {file = "mypy-1.18.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f9e171c465ad3901dc652643ee4bffa8e9fef4d7d0eece23b428908c77a76a66"}, + {file = "mypy-1.18.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:592ec214750bc00741af1f80cbf96b5013d81486b7bb24cb052382c19e40b428"}, + {file = "mypy-1.18.2-cp310-cp310-win_amd64.whl", hash = "sha256:7fb95f97199ea11769ebe3638c29b550b5221e997c63b14ef93d2e971606ebed"}, + {file = "mypy-1.18.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:807d9315ab9d464125aa9fcf6d84fde6e1dc67da0b6f80e7405506b8ac72bc7f"}, + {file = "mypy-1.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:776bb00de1778caf4db739c6e83919c1d85a448f71979b6a0edd774ea8399341"}, + {file = "mypy-1.18.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1379451880512ffce14505493bd9fe469e0697543717298242574882cf8cdb8d"}, + {file = "mypy-1.18.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1331eb7fd110d60c24999893320967594ff84c38ac6d19e0a76c5fd809a84c86"}, + {file = "mypy-1.18.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3ca30b50a51e7ba93b00422e486cbb124f1c56a535e20eff7b2d6ab72b3b2e37"}, + {file = "mypy-1.18.2-cp311-cp311-win_amd64.whl", hash = "sha256:664dc726e67fa54e14536f6e1224bcfce1d9e5ac02426d2326e2bb4e081d1ce8"}, + {file = "mypy-1.18.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:33eca32dd124b29400c31d7cf784e795b050ace0e1f91b8dc035672725617e34"}, + {file = "mypy-1.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a3c47adf30d65e89b2dcd2fa32f3aeb5e94ca970d2c15fcb25e297871c8e4764"}, + {file = "mypy-1.18.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d6c838e831a062f5f29d11c9057c6009f60cb294fea33a98422688181fe2893"}, + {file = "mypy-1.18.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01199871b6110a2ce984bde85acd481232d17413868c9807e95c1b0739a58914"}, + {file = "mypy-1.18.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a2afc0fa0b0e91b4599ddfe0f91e2c26c2b5a5ab263737e998d6817874c5f7c8"}, + {file = "mypy-1.18.2-cp312-cp312-win_amd64.whl", hash = "sha256:d8068d0afe682c7c4897c0f7ce84ea77f6de953262b12d07038f4d296d547074"}, + {file = "mypy-1.18.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:07b8b0f580ca6d289e69209ec9d3911b4a26e5abfde32228a288eb79df129fcc"}, + {file = "mypy-1.18.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ed4482847168439651d3feee5833ccedbf6657e964572706a2adb1f7fa4dfe2e"}, + {file = "mypy-1.18.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c3ad2afadd1e9fea5cf99a45a822346971ede8685cc581ed9cd4d42eaf940986"}, + {file = "mypy-1.18.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a431a6f1ef14cf8c144c6b14793a23ec4eae3db28277c358136e79d7d062f62d"}, + {file = "mypy-1.18.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7ab28cc197f1dd77a67e1c6f35cd1f8e8b73ed2217e4fc005f9e6a504e46e7ba"}, + {file = "mypy-1.18.2-cp313-cp313-win_amd64.whl", hash = "sha256:0e2785a84b34a72ba55fb5daf079a1003a34c05b22238da94fcae2bbe46f3544"}, + {file = "mypy-1.18.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:62f0e1e988ad41c2a110edde6c398383a889d95b36b3e60bcf155f5164c4fdce"}, + {file = "mypy-1.18.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8795a039bab805ff0c1dfdb8cd3344642c2b99b8e439d057aba30850b8d3423d"}, + {file = "mypy-1.18.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6ca1e64b24a700ab5ce10133f7ccd956a04715463d30498e64ea8715236f9c9c"}, + {file = "mypy-1.18.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d924eef3795cc89fecf6bedc6ed32b33ac13e8321344f6ddbf8ee89f706c05cb"}, + {file = "mypy-1.18.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20c02215a080e3a2be3aa50506c67242df1c151eaba0dcbc1e4e557922a26075"}, + {file = "mypy-1.18.2-cp314-cp314-win_amd64.whl", hash = "sha256:749b5f83198f1ca64345603118a6f01a4e99ad4bf9d103ddc5a3200cc4614adf"}, + {file = "mypy-1.18.2-py3-none-any.whl", hash = "sha256:22a1748707dd62b58d2ae53562ffc4d7f8bcc727e8ac7cbc69c053ddc874d47e"}, + {file = "mypy-1.18.2.tar.gz", hash = "sha256:06a398102a5f203d7477b2923dda3634c36727fa5c237d8f859ef90c42a9924b"}, ] [[package]] name = "mypy-extensions" -version = "1.0.0" -requires_python = ">=3.5" +version = "1.1.0" +requires_python = ">=3.8" summary = "Type system extensions for programs checked with the mypy type checker." groups = ["dev"] files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, ] [[package]] name = "packaging" -version = "24.2" +version = "25.0" requires_python = ">=3.8" summary = "Core utilities for Python packages" groups = ["dev"] files = [ - {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, - {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, ] [[package]] -name = "pluggy" -version = "1.5.0" +name = "pathspec" +version = "0.12.1" requires_python = ">=3.8" +summary = "Utility library for gitignore style pattern matching of file paths." +groups = ["dev"] +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +requires_python = ">=3.9" summary = "plugin and hook calling mechanisms for python" groups = ["dev"] files = [ - {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, - {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, ] [[package]] -name = "pytest" -version = "8.3.4" +name = "pygments" +version = "2.19.2" requires_python = ">=3.8" +summary = "Pygments is a syntax highlighting package written in Python." +groups = ["dev"] +files = [ + {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"}, + {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"}, +] + +[[package]] +name = "pytest" +version = "8.4.2" +requires_python = ">=3.9" summary = "pytest: simple powerful testing with Python" groups = ["dev"] dependencies = [ - "colorama; sys_platform == \"win32\"", - "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", - "iniconfig", - "packaging", + "colorama>=0.4; sys_platform == \"win32\"", + "exceptiongroup>=1; python_version < \"3.11\"", + "iniconfig>=1", + "packaging>=20", "pluggy<2,>=1.5", + "pygments>=2.7.2", "tomli>=1; python_version < \"3.11\"", ] files = [ - {file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"}, - {file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"}, + {file = "pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79"}, + {file = "pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01"}, ] [[package]] name = "pytest-asyncio" -version = "0.25.0" +version = "1.2.0" requires_python = ">=3.9" summary = "Pytest support for asyncio" groups = ["dev"] dependencies = [ + "backports-asyncio-runner<2,>=1.1; python_version < \"3.11\"", "pytest<9,>=8.2", + "typing-extensions>=4.12; python_version < \"3.13\"", ] files = [ - {file = "pytest_asyncio-0.25.0-py3-none-any.whl", hash = "sha256:db5432d18eac6b7e28b46dcd9b69921b55c3b1086e85febfe04e70b18d9e81b3"}, - {file = "pytest_asyncio-0.25.0.tar.gz", hash = "sha256:8c0610303c9e0442a5db8604505fc0f545456ba1528824842b37b4a626cbf609"}, + {file = "pytest_asyncio-1.2.0-py3-none-any.whl", hash = "sha256:8e17ae5e46d8e7efe51ab6494dd2010f4ca8dae51652aa3c8d55acf50bfb2e99"}, + {file = "pytest_asyncio-1.2.0.tar.gz", hash = "sha256:c609a64a2a8768462d0c99811ddb8bd2583c33fd33cf7f21af1c142e824ffb57"}, ] [[package]] @@ -286,53 +329,74 @@ files = [ [[package]] name = "tomli" -version = "2.2.1" +version = "2.3.0" requires_python = ">=3.8" summary = "A lil' TOML parser" groups = ["dev"] marker = "python_version < \"3.11\"" files = [ - {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, - {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, - {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, - {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, - {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, - {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, - {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, - {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, - {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, - {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, + {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, + {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, + {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, + {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, + {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, + {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, + {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, + {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, + {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, + {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, + {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, + {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.9.0.20251008" +requires_python = ">=3.9" +summary = "Typing stubs for python-dateutil" +groups = ["dev"] +files = [ + {file = "types_python_dateutil-2.9.0.20251008-py3-none-any.whl", hash = "sha256:b9a5232c8921cf7661b29c163ccc56055c418ab2c6eabe8f917cbcc73a4c4157"}, + {file = "types_python_dateutil-2.9.0.20251008.tar.gz", hash = "sha256:c3826289c170c93ebd8360c3485311187df740166dbab9dd3b792e69f2bc1f9c"}, ] [[package]] name = "typing-extensions" -version = "4.12.2" -requires_python = ">=3.8" -summary = "Backported and Experimental Type Hints for Python 3.8+" +version = "4.15.0" +requires_python = ">=3.9" +summary = "Backported and Experimental Type Hints for Python 3.9+" groups = ["default", "dev"] files = [ - {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, - {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, + {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, + {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, ] diff --git a/integration-tests/pdm.minimal.lock b/integration-tests/pdm.minimal.lock new file mode 100644 index 000000000..18e20097e --- /dev/null +++ b/integration-tests/pdm.minimal.lock @@ -0,0 +1,381 @@ +# This file is @generated by PDM. +# It is not intended for manual editing. + +[metadata] +groups = ["default", "dev"] +strategy = ["direct_minimal_versions", "inherit_metadata"] +lock_version = "4.5.0" +content_hash = "sha256:9404cbb9c293ee893b3e763b97fc5db2cb27fc7911dabedc0c3306a965a69a44" + +[[metadata.targets]] +requires_python = "~=3.10" + +[[package]] +name = "anyio" +version = "3.7.1" +requires_python = ">=3.7" +summary = "High level compatibility layer for multiple asynchronous event loop implementations" +groups = ["default"] +dependencies = [ + "exceptiongroup; python_version < \"3.11\"", + "idna>=2.8", + "sniffio>=1.1", + "typing-extensions; python_version < \"3.8\"", +] +files = [ + {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, + {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, +] + +[[package]] +name = "attrs" +version = "22.2.0" +requires_python = ">=3.6" +summary = "Classes Without Boilerplate" +groups = ["default"] +files = [ + {file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"}, + {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, +] + +[[package]] +name = "certifi" +version = "2025.10.5" +requires_python = ">=3.7" +summary = "Python package for providing Mozilla's CA Bundle." +groups = ["default"] +files = [ + {file = "certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de"}, + {file = "certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +summary = "Cross-platform colored terminal text." +groups = ["dev"] +marker = "sys_platform == \"win32\"" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.3.0" +requires_python = ">=3.7" +summary = "Backport of PEP 654 (exception groups)" +groups = ["default", "dev"] +marker = "python_version < \"3.11\"" +dependencies = [ + "typing-extensions>=4.6.0; python_version < \"3.13\"", +] +files = [ + {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, + {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, +] + +[[package]] +name = "h11" +version = "0.12.0" +requires_python = ">=3.6" +summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +groups = ["default"] +files = [ + {file = "h11-0.12.0-py3-none-any.whl", hash = "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6"}, + {file = "h11-0.12.0.tar.gz", hash = "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042"}, +] + +[[package]] +name = "httpcore" +version = "0.15.0" +requires_python = ">=3.7" +summary = "A minimal low-level HTTP client." +groups = ["default"] +dependencies = [ + "anyio==3.*", + "certifi", + "h11<0.13,>=0.11", + "sniffio==1.*", +] +files = [ + {file = "httpcore-0.15.0-py3-none-any.whl", hash = "sha256:1105b8b73c025f23ff7c36468e4432226cbb959176eab66864b8e31c4ee27fa6"}, + {file = "httpcore-0.15.0.tar.gz", hash = "sha256:18b68ab86a3ccf3e7dc0f43598eaddcf472b602aba29f9aa6ab85fe2ada3980b"}, +] + +[[package]] +name = "httpx" +version = "0.23.0" +requires_python = ">=3.7" +summary = "The next generation HTTP client." +groups = ["default"] +dependencies = [ + "certifi", + "httpcore<0.16.0,>=0.15.0", + "rfc3986[idna2008]<2,>=1.3", + "sniffio", +] +files = [ + {file = "httpx-0.23.0-py3-none-any.whl", hash = "sha256:42974f577483e1e932c3cdc3cd2303e883cbfba17fe228b0f63589764d7b9c4b"}, + {file = "httpx-0.23.0.tar.gz", hash = "sha256:f28eac771ec9eb4866d3fb4ab65abd42d38c424739e80c08d8d20570de60b0ef"}, +] + +[[package]] +name = "idna" +version = "3.11" +requires_python = ">=3.8" +summary = "Internationalized Domain Names in Applications (IDNA)" +groups = ["default"] +files = [ + {file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"}, + {file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"}, +] + +[[package]] +name = "iniconfig" +version = "2.3.0" +requires_python = ">=3.10" +summary = "brain-dead simple config-ini parsing" +groups = ["dev"] +files = [ + {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"}, + {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, +] + +[[package]] +name = "mypy" +version = "1.13.0" +requires_python = ">=3.8" +summary = "Optional static typing for Python" +groups = ["dev"] +dependencies = [ + "mypy-extensions>=1.0.0", + "tomli>=1.1.0; python_version < \"3.11\"", + "typing-extensions>=4.6.0", +] +files = [ + {file = "mypy-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80"}, + {file = "mypy-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7"}, + {file = "mypy-1.13.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f"}, + {file = "mypy-1.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d"}, + {file = "mypy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b"}, + {file = "mypy-1.13.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73"}, + {file = "mypy-1.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e"}, + {file = "mypy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2"}, + {file = "mypy-1.13.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0"}, + {file = "mypy-1.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62"}, + {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, + {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, + {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, + {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, + {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, +] + +[[package]] +name = "mypy-extensions" +version = "1.1.0" +requires_python = ">=3.8" +summary = "Type system extensions for programs checked with the mypy type checker." +groups = ["dev"] +files = [ + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, +] + +[[package]] +name = "packaging" +version = "25.0" +requires_python = ">=3.8" +summary = "Core utilities for Python packages" +groups = ["dev"] +files = [ + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +requires_python = ">=3.9" +summary = "plugin and hook calling mechanisms for python" +groups = ["dev"] +files = [ + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, +] + +[[package]] +name = "pytest" +version = "8.0.1" +requires_python = ">=3.8" +summary = "pytest: simple powerful testing with Python" +groups = ["dev"] +dependencies = [ + "colorama; sys_platform == \"win32\"", + "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", + "iniconfig", + "packaging", + "pluggy<2.0,>=1.3.0", + "tomli>=1.0.0; python_version < \"3.11\"", +] +files = [ + {file = "pytest-8.0.1-py3-none-any.whl", hash = "sha256:3e4f16fe1c0a9dc9d9389161c127c3edc5d810c38d6793042fb81d9f48a59fca"}, + {file = "pytest-8.0.1.tar.gz", hash = "sha256:267f6563751877d772019b13aacbe4e860d73fe8f651f28112e9ac37de7513ae"}, +] + +[[package]] +name = "pytest-asyncio" +version = "0.23.5" +requires_python = ">=3.8" +summary = "Pytest support for asyncio" +groups = ["dev"] +dependencies = [ + "pytest<9,>=7.0.0", +] +files = [ + {file = "pytest-asyncio-0.23.5.tar.gz", hash = "sha256:3a048872a9c4ba14c3e90cc1aa20cbc2def7d01c7c8db3777ec281ba9c057675"}, + {file = "pytest_asyncio-0.23.5-py3-none-any.whl", hash = "sha256:4e7093259ba018d58ede7d5315131d21923a60f8a6e9ee266ce1589685c89eac"}, +] + +[[package]] +name = "python-dateutil" +version = "2.8.0" +requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +summary = "Extensions to the standard Python datetime module" +groups = ["default"] +dependencies = [ + "six>=1.5", +] +files = [ + {file = "python-dateutil-2.8.0.tar.gz", hash = "sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e"}, + {file = "python_dateutil-2.8.0-py2.py3-none-any.whl", hash = "sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb"}, +] + +[[package]] +name = "rfc3986" +version = "1.5.0" +summary = "Validating URI References per RFC 3986" +groups = ["default"] +files = [ + {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, + {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, +] + +[[package]] +name = "rfc3986" +version = "1.5.0" +extras = ["idna2008"] +summary = "Validating URI References per RFC 3986" +groups = ["default"] +dependencies = [ + "idna", + "rfc3986==1.5.0", +] +files = [ + {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, + {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, +] + +[[package]] +name = "six" +version = "1.17.0" +requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +summary = "Python 2 and 3 compatibility utilities" +groups = ["default"] +files = [ + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, +] + +[[package]] +name = "sniffio" +version = "1.3.1" +requires_python = ">=3.7" +summary = "Sniff out which async library your code is running under" +groups = ["default"] +files = [ + {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, + {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, +] + +[[package]] +name = "tomli" +version = "2.3.0" +requires_python = ">=3.8" +summary = "A lil' TOML parser" +groups = ["dev"] +marker = "python_version < \"3.11\"" +files = [ + {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, + {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, + {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, + {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, + {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, + {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, + {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, + {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, + {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, + {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, + {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, + {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, + {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.9.0.20240315" +requires_python = ">=3.8" +summary = "Typing stubs for python-dateutil" +groups = ["dev"] +files = [ + {file = "types-python-dateutil-2.9.0.20240315.tar.gz", hash = "sha256:c1f6310088eb9585da1b9f811765b989ed2e2cdd4203c1a367e944b666507e4e"}, + {file = "types_python_dateutil-2.9.0.20240315-py3-none-any.whl", hash = "sha256:78aa9124f360df90bb6e85eb1a4d06e75425445bf5ecb13774cb0adef7ff3956"}, +] + +[[package]] +name = "typing-extensions" +version = "4.15.0" +requires_python = ">=3.9" +summary = "Backported and Experimental Type Hints for Python 3.9+" +groups = ["default", "dev"] +files = [ + {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, + {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, +] diff --git a/integration-tests/pyproject.toml b/integration-tests/pyproject.toml index cbcff74c6..b95a0aef7 100644 --- a/integration-tests/pyproject.toml +++ b/integration-tests/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "integration-tests" -version = "0.0.1" +version = "0.1.0" description = "A client library for accessing OpenAPI Test Server" authors = [] readme = "README.md" -requires-python = ">=3.9,<4.0" +requires-python = ">=3.10,<4.0" dependencies = [ - "httpx>=0.20.0,<0.29.0", + "httpx>=0.23.0,<0.29.0", "attrs>=22.2.0", "python-dateutil>=2.8.0", ] @@ -16,17 +16,21 @@ distribution = true [tool.pdm.dev-dependencies] dev = [ - "pytest", - "mypy", + "pytest>8", + "mypy>=1.13", "pytest-asyncio>=0.23.5", + "types-python-dateutil>=2.9", ] [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" - + [tool.ruff] line-length = 120 [tool.ruff.lint] select = ["F", "I"] + +[tool.mypy] +# Just to get mypy to _not_ look at the parent directory's config diff --git a/integration-tests/tests/test_api/test_body/test_post_body_multipart.py b/integration-tests/tests/test_api/test_body/test_post_body_multipart.py index 54498ebc5..d6c211daf 100644 --- a/integration-tests/tests/test_api/test_body/test_post_body_multipart.py +++ b/integration-tests/tests/test_api/test_body/test_post_body_multipart.py @@ -1,3 +1,4 @@ +from datetime import datetime, timedelta, timezone from io import BytesIO from typing import Any @@ -5,49 +6,67 @@ from integration_tests.api.body import post_body_multipart from integration_tests.client import Client +from integration_tests.models import AnObject, PublicError from integration_tests.models.post_body_multipart_body import PostBodyMultipartBody from integration_tests.models.post_body_multipart_response_200 import PostBodyMultipartResponse200 -from integration_tests.types import File +from integration_tests.types import File, Response + +body = PostBodyMultipartBody( + a_string="a test string", + description="super descriptive thing", + files=[ + File( + payload=BytesIO(b"some file content"), + file_name="cool_stuff.txt", + mime_type="application/openapi-python-client", + ), + File( + payload=BytesIO(b"more file content"), + file_name=None, + mime_type=None, + ), + ], + times=[datetime.now(timezone.utc) - timedelta(days=1), datetime.now(timezone.utc)], + objects=[ + AnObject( + an_int=1, + a_float=2.3, + ), + AnObject( + an_int=4, + a_float=5.6, + ), + ], +) -def test(client: Client) -> None: - a_string = "a test string" - payload = b"some file content" - file_name = "cool_stuff.txt" - mime_type = "application/openapi-python-client" - description = "super descriptive thing" +def check_response(response: Response[PostBodyMultipartResponse200 | PublicError]) -> None: + content = response.parsed + if not isinstance(content, PostBodyMultipartResponse200): + raise AssertionError(f"Received status {response.status_code} from test server with payload: {content!r}") + + assert content.a_string == body.a_string + assert content.description == body.description + assert content.times == body.times + assert content.objects == body.objects + assert len(content.files) == len(body.files) + for i, file in enumerate(content.files): + body.files[i].payload.seek(0) + assert file.data == body.files[i].payload.read().decode() + assert file.name == body.files[i].file_name + assert file.content_type == body.files[i].mime_type + +def test(client: Client) -> None: response = post_body_multipart.sync_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) - content = response.parsed - if not isinstance(content, PostBodyMultipartResponse200): - raise AssertionError(f"Received status {response.status_code} from test server with payload: {content!r}") - - assert content.a_string == a_string - assert content.file_name == file_name - assert content.file_content_type == mime_type - assert content.file_data.encode() == payload - assert content.description == description + check_response(response) def test_custom_hooks() -> None: - a_string = "a test string" - payload = b"some file content" - file_name = "cool_stuff.txt" - mime_type = "application/openapi-python-client" - description = "super descriptive thing" - request_hook_called = False response_hook_called = False @@ -65,15 +84,7 @@ def log_response(*_: Any, **__: Any) -> None: post_body_multipart.sync_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) assert request_hook_called @@ -81,149 +92,51 @@ def log_response(*_: Any, **__: Any) -> None: def test_context_manager(client: Client) -> None: - a_string = "a test string" - payload = b"some file content" - file_name = "cool_stuff.txt" - mime_type = "application/openapi-python-client" - description = "super descriptive thing" - with client as client: post_body_multipart.sync_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) response = post_body_multipart.sync_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) with pytest.raises(RuntimeError): post_body_multipart.sync_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) - content = response.parsed - if not isinstance(content, PostBodyMultipartResponse200): - raise AssertionError(f"Received status {response.status_code} from test server with payload: {content!r}") - - assert content.a_string == a_string - assert content.file_name == file_name - assert content.file_content_type == mime_type - assert content.file_data.encode() == payload - assert content.description == description + check_response(response) @pytest.mark.asyncio async def test_async(client: Client) -> None: - a_string = "a test string" - payload = b"some file content" - file_name = "cool_stuff.txt" - mime_type = "application/openapi-python-client" - description = "super descriptive thing" - response = await post_body_multipart.asyncio_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) - content = response.parsed - if not isinstance(content, PostBodyMultipartResponse200): - raise AssertionError(f"Received status {response.status_code} from test server with payload: {content!r}") - - assert content.a_string == a_string - assert content.file_name == file_name - assert content.file_content_type == mime_type - assert content.file_data.encode() == payload - assert content.description == description + check_response(response) @pytest.mark.asyncio async def test_async_context_manager(client: Client) -> None: - a_string = "a test string" - payload = b"some file content" - file_name = "cool_stuff.txt" - mime_type = "application/openapi-python-client" - description = "super descriptive thing" - async with client as client: await post_body_multipart.asyncio_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) response = await post_body_multipart.asyncio_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) with pytest.raises(RuntimeError): await post_body_multipart.asyncio_detailed( client=client, - body=PostBodyMultipartBody( - a_string=a_string, - file=File( - payload=BytesIO(payload), - file_name=file_name, - mime_type=mime_type, - ), - description=description, - ), + body=body, ) - content = response.parsed - if not isinstance(content, PostBodyMultipartResponse200): - raise AssertionError(f"Received status {response.status_code} from test server with payload: {content!r}") - - assert content.a_string == a_string - assert content.file_name == file_name - assert content.file_content_type == mime_type - assert content.file_data.encode() == payload - assert content.description == description + check_response(response) diff --git a/knope.toml b/knope.toml index 5ea5b3ddb..7859e93b5 100644 --- a/knope.toml +++ b/knope.toml @@ -1,6 +1,9 @@ [package] versioned_files = ["pyproject.toml"] changelog = "CHANGELOG.md" +extra_changelog_sections = [ + { name = "Notes", types = ["note"] } +] [github] owner = "openapi-generators" diff --git a/openapi_python_client/__init__.py b/openapi_python_client/__init__.py index af6944ae4..52d34b4fc 100644 --- a/openapi_python_client/__init__.py +++ b/openapi_python_client/__init__.py @@ -8,7 +8,7 @@ from importlib.metadata import version from pathlib import Path from subprocess import CalledProcessError -from typing import Any, Optional, Union +from typing import Any import httpcore import httpx @@ -42,7 +42,7 @@ def __init__( *, openapi: GeneratorData, config: Config, - custom_template_path: Optional[Path] = None, + custom_template_path: Path | None = None, ) -> None: self.openapi: GeneratorData = openapi self.config = config @@ -90,6 +90,7 @@ def __init__( self.env.filters.update(TEMPLATE_FILTERS) self.env.globals.update( + config=config, utils=utils, python_identifier=lambda x: utils.PythonIdentifier(x, config.field_prefix), class_name=lambda x: utils.ClassName(x, config.field_prefix), @@ -183,7 +184,7 @@ def _build_metadata(self) -> None: readme = self.project_dir / "README.md" readme_template = self.env.get_template("README.md.jinja") readme.write_text( - readme_template.render(poetry=self.config.meta_type == MetaType.POETRY), + readme_template.render(meta=self.config.meta_type), encoding=self.config.file_encoding, ) @@ -291,8 +292,8 @@ def _build_api(self) -> None: def _get_project_for_url_or_path( config: Config, - custom_template_path: Optional[Path] = None, -) -> Union[Project, GeneratorError]: + custom_template_path: Path | None = None, +) -> Project | GeneratorError: data_dict = _get_document(source=config.document_source, timeout=config.http_timeout) if isinstance(data_dict, GeneratorError): return data_dict @@ -309,7 +310,7 @@ def _get_project_for_url_or_path( def generate( *, config: Config, - custom_template_path: Optional[Path] = None, + custom_template_path: Path | None = None, ) -> Sequence[GeneratorError]: """ Generate the client library @@ -326,7 +327,7 @@ def generate( return project.build() -def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[dict[str, Any], GeneratorError]: +def _load_yaml_or_json(data: bytes, content_type: str | None) -> dict[str, Any] | GeneratorError: if content_type == "application/json": try: return json.loads(data.decode()) @@ -340,9 +341,9 @@ def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[dict[s return GeneratorError(header=f"Invalid YAML from provided source: {err}") -def _get_document(*, source: Union[str, Path], timeout: int) -> Union[dict[str, Any], GeneratorError]: +def _get_document(*, source: str | Path, timeout: int) -> dict[str, Any] | GeneratorError: yaml_bytes: bytes - content_type: Optional[str] + content_type: str | None if isinstance(source, str): try: response = httpx.get(source, timeout=timeout) diff --git a/openapi_python_client/cli.py b/openapi_python_client/cli.py index 92d91f943..3972703ae 100644 --- a/openapi_python_client/cli.py +++ b/openapi_python_client/cli.py @@ -2,11 +2,10 @@ from collections.abc import Sequence from pathlib import Path from pprint import pformat -from typing import Optional, Union import typer -from openapi_python_client import MetaType +from openapi_python_client import MetaType, __version__ from openapi_python_client.config import Config, ConfigFile from openapi_python_client.parser.errors import ErrorLevel, GeneratorError, ParseError @@ -14,8 +13,6 @@ def _version_callback(value: bool) -> None: - from openapi_python_client import __version__ - if value: typer.echo(f"openapi-python-client version: {__version__}") raise typer.Exit() @@ -23,15 +20,15 @@ def _version_callback(value: bool) -> None: def _process_config( *, - url: Optional[str], - path: Optional[Path], - config_path: Optional[Path], + url: str | None, + path: Path | None, + config_path: Path | None, meta_type: MetaType, file_encoding: str, overwrite: bool, - output_path: Optional[Path], + output_path: Path | None, ) -> Config: - source: Union[Path, str] + source: Path | str if url and not path: source = url elif path and not url: @@ -72,16 +69,16 @@ def cli( def _print_parser_error(err: GeneratorError, color: str) -> None: typer.secho(err.header, bold=True, fg=color, err=True) - typer.echo() + typer.echo(err=True) if err.detail: typer.secho(err.detail, fg=color, err=True) - typer.echo() + typer.echo(err=True) if isinstance(err, ParseError) and err.data is not None: formatted_data = pformat(err.data) typer.secho(formatted_data, fg=color, err=True) - typer.echo() + typer.echo(err=True) def handle_errors(errors: Sequence[GeneratorError], fail_on_warning: bool = False) -> None: @@ -127,9 +124,9 @@ def handle_errors(errors: Sequence[GeneratorError], fail_on_warning: bool = Fals @app.command() def generate( - url: Optional[str] = typer.Option(None, help="A URL to read the OpenAPI document from"), - path: Optional[Path] = typer.Option(None, help="A path to the OpenAPI document"), - custom_template_path: Optional[Path] = typer.Option( + url: str | None = typer.Option(None, help="A URL to read the OpenAPI document from"), + path: Path | None = typer.Option(None, help="A path to the OpenAPI document"), + custom_template_path: Path | None = typer.Option( None, help="A path to a directory containing custom template(s)", file_okay=False, @@ -142,10 +139,10 @@ def generate( help="The type of metadata you want to generate.", ), file_encoding: str = typer.Option("utf-8", help="Encoding used when writing generated"), - config_path: Optional[Path] = typer.Option(None, "--config", help="Path to the config file to use"), + config_path: Path | None = typer.Option(None, "--config", help="Path to the config file to use"), fail_on_warning: bool = False, overwrite: bool = typer.Option(False, help="Overwrite the existing client if it exists"), - output_path: Optional[Path] = typer.Option( + output_path: Path | None = typer.Option( None, help="Path to write the generated code to. " "Defaults to the OpenAPI document title converted to kebab or snake case (depending on meta type). " @@ -153,7 +150,7 @@ def generate( ), ) -> None: """Generate a new OpenAPI Client library""" - from . import generate + from . import generate # noqa: PLC0415 config = _process_config( url=url, diff --git a/openapi_python_client/config.py b/openapi_python_client/config.py index 9cc002d12..0cba32599 100644 --- a/openapi_python_client/config.py +++ b/openapi_python_client/config.py @@ -2,7 +2,6 @@ import mimetypes from enum import Enum from pathlib import Path -from typing import Optional, Union from attr import define from pydantic import BaseModel @@ -15,8 +14,8 @@ class ClassOverride(BaseModel): See https://github.com/openapi-generators/openapi-python-client#class_overrides """ - class_name: Optional[str] = None - module_name: Optional[str] = None + class_name: str | None = None + module_name: str | None = None class MetaType(str, Enum): @@ -26,6 +25,7 @@ class MetaType(str, Enum): POETRY = "poetry" SETUP = "setup" PDM = "pdm" + UV = "uv" class ConfigFile(BaseModel): @@ -34,13 +34,14 @@ class ConfigFile(BaseModel): See https://github.com/openapi-generators/openapi-python-client#configuration """ - class_overrides: Optional[dict[str, ClassOverride]] = None - content_type_overrides: Optional[dict[str, str]] = None - project_name_override: Optional[str] = None - package_name_override: Optional[str] = None - package_version_override: Optional[str] = None + class_overrides: dict[str, ClassOverride] | None = None + content_type_overrides: dict[str, str] | None = None + project_name_override: str | None = None + package_name_override: str | None = None + package_version_override: str | None = None use_path_prefixes_for_title_model_names: bool = True - post_hooks: Optional[list[str]] = None + post_hooks: list[str] | None = None + docstrings_on_attributes: bool = False field_prefix: str = "field_" generate_all_tags: bool = False http_timeout: int = 5 @@ -65,40 +66,41 @@ class Config: meta_type: MetaType class_overrides: dict[str, ClassOverride] - project_name_override: Optional[str] - package_name_override: Optional[str] - package_version_override: Optional[str] + project_name_override: str | None + package_name_override: str | None + package_version_override: str | None use_path_prefixes_for_title_model_names: bool post_hooks: list[str] + docstrings_on_attributes: bool field_prefix: str generate_all_tags: bool http_timeout: int literal_enums: bool - document_source: Union[Path, str] + document_source: Path | str file_encoding: str content_type_overrides: dict[str, str] overwrite: bool - output_path: Optional[Path] + output_path: Path | None @staticmethod def from_sources( config_file: ConfigFile, meta_type: MetaType, - document_source: Union[Path, str], + document_source: Path | str, file_encoding: str, overwrite: bool, - output_path: Optional[Path], + output_path: Path | None, ) -> "Config": if config_file.post_hooks is not None: post_hooks = config_file.post_hooks elif meta_type == MetaType.NONE: post_hooks = [ - "ruff check . --fix --extend-select=I", + "ruff check . --fix-only --extend-select=I", "ruff format .", ] else: post_hooks = [ - "ruff check --fix .", + "ruff check --fix-only .", "ruff format .", ] @@ -111,6 +113,7 @@ def from_sources( package_version_override=config_file.package_version_override, use_path_prefixes_for_title_model_names=config_file.use_path_prefixes_for_title_model_names, post_hooks=post_hooks, + docstrings_on_attributes=config_file.docstrings_on_attributes, field_prefix=config_file.field_prefix, generate_all_tags=config_file.generate_all_tags, http_timeout=config_file.http_timeout, diff --git a/openapi_python_client/parser/bodies.py b/openapi_python_client/parser/bodies.py index c51966412..679fef601 100644 --- a/openapi_python_client/parser/bodies.py +++ b/openapi_python_client/parser/bodies.py @@ -1,5 +1,4 @@ import sys -from typing import Union import attr @@ -9,6 +8,7 @@ Schemas, property_from_data, ) +from openapi_python_client.parser.properties.schemas import get_reference_simple_name from .. import schema as oai from ..config import Config @@ -44,10 +44,10 @@ def body_from_data( *, data: oai.Operation, schemas: Schemas, - request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]], + request_bodies: dict[str, oai.RequestBody | oai.Reference], config: Config, endpoint_name: str, -) -> tuple[list[Union[Body, ParseError]], Schemas]: +) -> tuple[list[Body | ParseError], Schemas]: """Adds form or JSON body to Endpoint if included in data""" body = _resolve_reference(data.request_body, request_bodies) if isinstance(body, ParseError): @@ -55,7 +55,7 @@ def body_from_data( if body is None: return [], schemas - bodies: list[Union[Body, ParseError]] = [] + bodies: list[Body | ParseError] = [] body_content = body.content prefix_type_names = len(body_content) > 1 @@ -131,14 +131,14 @@ def body_from_data( def _resolve_reference( - body: Union[oai.RequestBody, oai.Reference, None], request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]] -) -> Union[oai.RequestBody, ParseError, None]: + body: oai.RequestBody | oai.Reference | None, request_bodies: dict[str, oai.RequestBody | oai.Reference] +) -> oai.RequestBody | ParseError | None: if body is None: return None references_seen = [] while isinstance(body, oai.Reference) and body.ref not in references_seen: references_seen.append(body.ref) - body = request_bodies.get(body.ref.split("/")[-1]) + body = request_bodies.get(get_reference_simple_name(body.ref)) if isinstance(body, oai.Reference): return ParseError(detail="Circular $ref in request body", data=body) if body is None and references_seen: diff --git a/openapi_python_client/parser/errors.py b/openapi_python_client/parser/errors.py index 36322f0cf..00f522b9e 100644 --- a/openapi_python_client/parser/errors.py +++ b/openapi_python_client/parser/errors.py @@ -1,6 +1,5 @@ from dataclasses import dataclass from enum import Enum -from typing import Optional __all__ = ["ErrorLevel", "GeneratorError", "ParameterError", "ParseError", "PropertyError"] @@ -18,7 +17,7 @@ class ErrorLevel(Enum): class GeneratorError: """Base data struct containing info on an error that occurred""" - detail: Optional[str] = None + detail: str | None = None level: ErrorLevel = ErrorLevel.ERROR header: str = "Unable to generate the client" @@ -28,7 +27,7 @@ class ParseError(GeneratorError): """An error raised when there's a problem parsing an OpenAPI document""" level: ErrorLevel = ErrorLevel.WARNING - data: Optional[BaseModel] = None + data: BaseModel | None = None header: str = "Unable to parse this part of your OpenAPI document: " diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index 117b2ee30..4f83ae93e 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -2,8 +2,7 @@ from collections.abc import Iterator from copy import deepcopy from dataclasses import dataclass, field -from http import HTTPStatus -from typing import Any, Optional, Protocol, Union +from typing import Any, Protocol from pydantic import ValidationError @@ -26,7 +25,7 @@ property_from_data, ) from .properties.schemas import parameter_from_reference -from .responses import Response, response_from_data +from .responses import HTTPStatusPattern, Responses, response_from_data _PATH_PARAM_REGEX = re.compile("{([a-zA-Z_-][a-zA-Z0-9_-]*)}") @@ -50,7 +49,8 @@ def from_data( data: dict[str, oai.PathItem], schemas: Schemas, parameters: Parameters, - request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]], + request_bodies: dict[str, oai.RequestBody | oai.Reference], + responses: dict[str, oai.Response | oai.Reference], config: Config, ) -> tuple[dict[utils.PythonIdentifier, "EndpointCollection"], Schemas, Parameters]: """Parse the openapi paths data to get EndpointCollections by tag""" @@ -60,7 +60,7 @@ def from_data( for path, path_data in data.items(): for method in methods: - operation: Optional[oai.Operation] = getattr(path_data, method) + operation: oai.Operation | None = getattr(path_data, method) if operation is None: continue @@ -78,6 +78,7 @@ def from_data( schemas=schemas, parameters=parameters, request_bodies=request_bodies, + responses=responses, config=config, ) # Add `PathItem` parameters @@ -124,7 +125,7 @@ class RequestBodyParser(Protocol): def __call__( self, *, body: oai.RequestBody, schemas: Schemas, parent_name: str, config: Config - ) -> tuple[Union[Property, PropertyError, None], Schemas]: ... # pragma: no cover + ) -> tuple[Property | PropertyError | None, Schemas]: ... # pragma: no cover @dataclass @@ -135,45 +136,41 @@ class Endpoint: path: str method: str - description: Optional[str] + description: str | None name: str requires_security: bool tags: list[PythonIdentifier] - summary: Optional[str] = "" + summary: str | None = "" relative_imports: set[str] = field(default_factory=set) query_parameters: list[Property] = field(default_factory=list) path_parameters: list[Property] = field(default_factory=list) header_parameters: list[Property] = field(default_factory=list) cookie_parameters: list[Property] = field(default_factory=list) - responses: list[Response] = field(default_factory=list) + responses: Responses = field(default_factory=lambda: Responses(patterns=[], default=None)) bodies: list[Body] = field(default_factory=list) errors: list[ParseError] = field(default_factory=list) @staticmethod def _add_responses( - *, endpoint: "Endpoint", data: oai.Responses, schemas: Schemas, config: Config + *, + endpoint: "Endpoint", + data: oai.Responses, + schemas: Schemas, + responses: dict[str, oai.Response | oai.Reference], + config: Config, ) -> tuple["Endpoint", Schemas]: endpoint = deepcopy(endpoint) for code, response_data in data.items(): - status_code: HTTPStatus - try: - status_code = HTTPStatus(int(code)) - except ValueError: - endpoint.errors.append( - ParseError( - detail=( - f"Invalid response status code {code} (not a valid HTTP " - f"status code), response will be omitted from generated " - f"client" - ) - ) - ) + status_code = HTTPStatusPattern.parse(code) + if isinstance(status_code, ParseError): + endpoint.errors.append(status_code) continue response, schemas = response_from_data( status_code=status_code, data=response_data, schemas=schemas, + responses=responses, parent_name=endpoint.name, config=config, ) @@ -182,7 +179,7 @@ def _add_responses( endpoint.errors.append( ParseError( detail=( - f"Cannot parse response for status code {status_code}{detail_suffix}, " + f"Cannot parse response for status code {code}{detail_suffix}, " f"response will be omitted from generated client" ), data=response.data, @@ -193,18 +190,22 @@ def _add_responses( # No reasons to use lazy imports in endpoints, so add lazy imports to relative here. endpoint.relative_imports |= response.prop.get_lazy_imports(prefix=models_relative_prefix) endpoint.relative_imports |= response.prop.get_imports(prefix=models_relative_prefix) - endpoint.responses.append(response) + if response.is_default(): + endpoint.responses.default = response + else: + endpoint.responses.patterns.append(response) + endpoint.responses.patterns.sort() return endpoint, schemas @staticmethod def add_parameters( *, endpoint: "Endpoint", - data: Union[oai.Operation, oai.PathItem], + data: oai.Operation | oai.PathItem, schemas: Schemas, parameters: Parameters, config: Config, - ) -> tuple[Union["Endpoint", ParseError], Schemas, Parameters]: + ) -> tuple["Endpoint | ParseError", Schemas, Parameters]: """Process the defined `parameters` for an Endpoint. Any existing parameters will be ignored, so earlier instances of a parameter take precedence. PathItem @@ -311,8 +312,8 @@ def _check_parameters_for_conflicts( self, *, config: Config, - previously_modified_params: Optional[set[tuple[oai.ParameterLocation, str]]] = None, - ) -> Union["Endpoint", ParseError]: + previously_modified_params: set[tuple[oai.ParameterLocation, str]] | None = None, + ) -> "Endpoint | ParseError": """Check for conflicting parameters For parameters that have the same python_name but are in different locations, append the location to the @@ -365,7 +366,7 @@ def _check_parameters_for_conflicts( return self @staticmethod - def sort_parameters(*, endpoint: "Endpoint") -> Union["Endpoint", ParseError]: + def sort_parameters(*, endpoint: "Endpoint") -> "Endpoint | ParseError": """ Sorts the path parameters of an `endpoint` so that they match the order declared in `endpoint.path`. @@ -402,9 +403,10 @@ def from_data( tags: list[PythonIdentifier], schemas: Schemas, parameters: Parameters, - request_bodies: dict[str, Union[oai.RequestBody, oai.Reference]], + request_bodies: dict[str, oai.RequestBody | oai.Reference], + responses: dict[str, oai.Response | oai.Reference], config: Config, - ) -> tuple[Union["Endpoint", ParseError], Schemas, Parameters]: + ) -> tuple["Endpoint | ParseError", Schemas, Parameters]: """Construct an endpoint from the OpenAPI data""" if data.operationId is None: @@ -431,7 +433,13 @@ def from_data( ) if isinstance(result, ParseError): return result, schemas, parameters - result, schemas = Endpoint._add_responses(endpoint=result, data=data.responses, schemas=schemas, config=config) + result, schemas = Endpoint._add_responses( + endpoint=result, + data=data.responses, + schemas=schemas, + responses=responses, + config=config, + ) if isinstance(result, ParseError): return result, schemas, parameters bodies, schemas = body_from_data( @@ -461,12 +469,12 @@ def from_data( def response_type(self) -> str: """Get the Python type of any response from this endpoint""" - types = sorted({response.prop.get_type_string(quoted=False) for response in self.responses}) + types = sorted({response.prop.get_type_string() for response in self.responses}) if len(types) == 0: return "Any" if len(types) == 1: - return self.responses[0].prop.get_type_string(quoted=False) - return f"Union[{', '.join(types)}]" + return types[0] + return " | ".join(types) def iter_all_parameters(self) -> Iterator[tuple[oai.ParameterLocation, Property]]: """Iterate through all the parameters of this endpoint""" @@ -491,15 +499,15 @@ class GeneratorData: """All the data needed to generate a client""" title: str - description: Optional[str] + description: str | None version: str - models: Iterator[ModelProperty] + models: list[ModelProperty] errors: list[ParseError] endpoint_collections_by_tag: dict[utils.PythonIdentifier, EndpointCollection] - enums: Iterator[Union[EnumProperty, LiteralEnumProperty]] + enums: list[EnumProperty | LiteralEnumProperty] @staticmethod - def from_dict(data: dict[str, Any], *, config: Config) -> Union["GeneratorData", GeneratorError]: + def from_dict(data: dict[str, Any], *, config: Config) -> "GeneratorData | GeneratorError": """Create an OpenAPI from dict""" try: openapi = oai.OpenAPI.model_validate(data) @@ -521,14 +529,20 @@ def from_dict(data: dict[str, Any], *, config: Config) -> Union["GeneratorData", config=config, ) request_bodies = (openapi.components and openapi.components.requestBodies) or {} + responses = (openapi.components and openapi.components.responses) or {} endpoint_collections_by_tag, schemas, parameters = EndpointCollection.from_data( - data=openapi.paths, schemas=schemas, parameters=parameters, request_bodies=request_bodies, config=config + data=openapi.paths, + schemas=schemas, + parameters=parameters, + request_bodies=request_bodies, + responses=responses, + config=config, ) - enums = ( - prop for prop in schemas.classes_by_name.values() if isinstance(prop, (EnumProperty, LiteralEnumProperty)) - ) - models = (prop for prop in schemas.classes_by_name.values() if isinstance(prop, ModelProperty)) + enums = [ + prop for prop in schemas.classes_by_name.values() if isinstance(prop, EnumProperty | LiteralEnumProperty) + ] + models = [prop for prop in schemas.classes_by_name.values() if isinstance(prop, ModelProperty)] return GeneratorData( title=openapi.info.title, diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index ba667347b..ba81d27c6 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -40,6 +40,7 @@ Parameters, ReferencePath, Schemas, + get_reference_simple_name, parse_reference_path, update_parameters_with_data, update_schemas_with_data, @@ -324,17 +325,30 @@ def _create_schemas( while still_making_progress: still_making_progress = False errors = [] - next_round = [] + next_round: list[tuple[str, oai.Reference | oai.Schema]] = [] # Only accumulate errors from the last round, since we might fix some along the way for name, data in to_process: - if isinstance(data, oai.Reference): - schemas.errors.append(PropertyError(data=data, detail="Reference schemas are not supported.")) - continue + schema_data: oai.Reference | oai.Schema | None = data ref_path = parse_reference_path(f"#/components/schemas/{name}") if isinstance(ref_path, ParseError): schemas.errors.append(PropertyError(detail=ref_path.detail, data=data)) continue - schemas_or_err = update_schemas_with_data(ref_path=ref_path, data=data, schemas=schemas, config=config) + if isinstance(data, oai.Reference): + # Fully dereference reference schemas + seen = [name] + while isinstance(schema_data, oai.Reference): + data_ref_schema = get_reference_simple_name(schema_data.ref) + if data_ref_schema in seen: + schemas.errors.append(PropertyError(detail="Circular schema references found", data=data)) + break + # use derefenced schema definition for this schema + schema_data = components.get(data_ref_schema) + if isinstance(schema_data, oai.Schema): + schemas_or_err = update_schemas_with_data( + ref_path=ref_path, data=schema_data, schemas=schemas, config=config + ) + else: + schemas.errors.append(PropertyError(detail="Referent schema not found", data=data)) if isinstance(schemas_or_err, PropertyError): next_round.append((name, data)) errors.append(schemas_or_err) diff --git a/openapi_python_client/parser/properties/any.py b/openapi_python_client/parser/properties/any.py index b760a1568..65fcf40c4 100644 --- a/openapi_python_client/parser/properties/any.py +++ b/openapi_python_client/parser/properties/any.py @@ -33,7 +33,7 @@ def build( @classmethod def convert_value(cls, value: Any) -> Value | None: - from .string import StringProperty + from .string import StringProperty # noqa: PLC0415 if value is None: return value diff --git a/openapi_python_client/parser/properties/const.py b/openapi_python_client/parser/properties/const.py index 8b9967f19..216941eb8 100644 --- a/openapi_python_client/parser/properties/const.py +++ b/openapi_python_client/parser/properties/const.py @@ -93,13 +93,10 @@ def get_type_string( self, no_optional: bool = False, json: bool = False, - *, - multipart: bool = False, - quoted: bool = False, ) -> str: lit = f"Literal[{self.value.python_code}]" if not no_optional and not self.required: - return f"Union[{lit}, Unset]" + return f"{lit} | Unset" return lit def get_imports(self, *, prefix: str) -> set[str]: @@ -113,6 +110,6 @@ def get_imports(self, *, prefix: str) -> set[str]: if self.required: return {"from typing import Literal, cast"} return { - "from typing import Literal, Union, cast", + "from typing import Literal, cast", f"from {prefix}types import UNSET, Unset", } diff --git a/openapi_python_client/parser/properties/enum_property.py b/openapi_python_client/parser/properties/enum_property.py index fc7f20bd9..725aaceba 100644 --- a/openapi_python_client/parser/properties/enum_property.py +++ b/openapi_python_client/parser/properties/enum_property.py @@ -2,7 +2,7 @@ __all__ = ["EnumProperty", "ValueType"] -from typing import Any, ClassVar, Union, cast +from typing import Any, ClassVar, cast from attr import evolve from attrs import define @@ -16,7 +16,7 @@ from .schemas import Class, Schemas from .union import UnionProperty -ValueType = Union[str, int] +ValueType = str | int @define @@ -98,9 +98,7 @@ def build( # noqa: PLR0911 value_type = next(iter(value_types)) if value_type not in (str, int): return PropertyError(header=f"Unsupported enum type {value_type}", data=data), schemas - value_list = cast( - Union[list[int], list[str]], unchecked_value_list - ) # We checked this with all the value_types stuff + value_list = cast(list[int] | list[str], unchecked_value_list) # We checked this with all the value_types stuff if len(value_list) < len(enum): # Only one of the values was None, that becomes a union data.oneOf = [ @@ -121,7 +119,8 @@ def build( # noqa: PLR0911 if parent_name: class_name = f"{utils.pascal_case(parent_name)}{utils.pascal_case(class_name)}" class_info = Class.from_string(string=class_name, config=config) - values = EnumProperty.values_from_list(value_list, class_info) + var_names = data.model_extra.get("x-enum-varnames", []) if data.model_extra else [] + values = EnumProperty.values_from_list(value_list, class_info, var_names) if class_info.name in schemas.classes_by_name: existing = schemas.classes_by_name[class_info.name] @@ -164,10 +163,10 @@ def convert_value(self, value: Any) -> Value | PropertyError | None: return PropertyError(detail=f"Value {value} is not valid for enum {self.name}") return PropertyError(detail=f"Cannot convert {value} to enum {self.name} of type {self.value_type}") - def get_base_type_string(self, *, quoted: bool = False) -> str: + def get_base_type_string(self) -> str: return self.class_info.name - def get_base_json_type_string(self, *, quoted: bool = False) -> str: + def get_base_json_type_string(self) -> str: return self.value_type.__name__ def get_imports(self, *, prefix: str) -> set[str]: @@ -183,14 +182,21 @@ def get_imports(self, *, prefix: str) -> set[str]: return imports @staticmethod - def values_from_list(values: list[str] | list[int], class_info: Class) -> dict[str, ValueType]: + def values_from_list( + values: list[str] | list[int], class_info: Class, var_names: list[str] + ) -> dict[str, ValueType]: """Convert a list of values into dict of {name: value}, where value can sometimes be None""" output: dict[str, ValueType] = {} + use_var_names = len(var_names) == len(values) for i, value in enumerate(values): - value = cast(Union[str, int], value) + value = cast(str | int, value) if isinstance(value, int): - if value < 0: + if use_var_names: + key = var_names[i] + sanitized_key = utils.snake_case(key).upper() + output[sanitized_key] = value + elif value < 0: output[f"VALUE_NEGATIVE_{-value}"] = value else: output[f"VALUE_{value}"] = value diff --git a/openapi_python_client/parser/properties/file.py b/openapi_python_client/parser/properties/file.py index 505876b63..90bbf6aec 100644 --- a/openapi_python_client/parser/properties/file.py +++ b/openapi_python_client/parser/properties/file.py @@ -22,7 +22,7 @@ class FileProperty(PropertyProtocol): _type_string: ClassVar[str] = "File" # Return type of File.to_tuple() - _json_type_string: ClassVar[str] = "FileJsonType" + _json_type_string: ClassVar[str] = "FileTypes" template: ClassVar[str] = "file_property.py.jinja" @classmethod @@ -63,5 +63,5 @@ def get_imports(self, *, prefix: str) -> set[str]: back to the root of the generated client. """ imports = super().get_imports(prefix=prefix) - imports.update({f"from {prefix}types import File, FileJsonType", "from io import BytesIO"}) + imports.update({f"from {prefix}types import File, FileTypes", "from io import BytesIO"}) return imports diff --git a/openapi_python_client/parser/properties/list_property.py b/openapi_python_client/parser/properties/list_property.py index bf0756fe3..26ab0fdab 100644 --- a/openapi_python_client/parser/properties/list_property.py +++ b/openapi_python_client/parser/properties/list_property.py @@ -56,7 +56,7 @@ def build( `(result, schemas)` where `schemas` is an updated version of the input named the same including any inner classes that were defined and `result` is either the `ListProperty` or a `PropertyError`. """ - from . import property_from_data + from . import property_from_data # noqa: PLC0415 if data.items is None and not data.prefixItems: return ( @@ -105,11 +105,11 @@ def build( def convert_value(self, value: Any) -> Value | None | PropertyError: return None # pragma: no cover - def get_base_type_string(self, *, quoted: bool = False) -> str: - return f"list[{self.inner_property.get_type_string(quoted=not self.inner_property.is_base_type)}]" + def get_base_type_string(self) -> str: + return f"list[{self.inner_property.get_type_string()}]" - def get_base_json_type_string(self, *, quoted: bool = False) -> str: - return f"list[{self.inner_property.get_type_string(json=True, quoted=not self.inner_property.is_base_type)}]" + def get_base_json_type_string(self) -> str: + return f"list[{self.inner_property.get_type_string(json=True)}]" def get_instance_type_string(self) -> str: """Get a string representation of runtime type that should be used for `isinstance` checks""" @@ -137,9 +137,6 @@ def get_type_string( self, no_optional: bool = False, json: bool = False, - *, - multipart: bool = False, - quoted: bool = False, ) -> str: """ Get a string representation of type that should be used when declaring this property @@ -150,11 +147,9 @@ def get_type_string( """ if json: type_string = self.get_base_json_type_string() - elif multipart: - type_string = "tuple[None, bytes, str]" else: type_string = self.get_base_type_string() if no_optional or self.required: return type_string - return f"Union[Unset, {type_string}]" + return f"{type_string} | Unset" diff --git a/openapi_python_client/parser/properties/literal_enum_property.py b/openapi_python_client/parser/properties/literal_enum_property.py index 669b62f58..f0e0306a2 100644 --- a/openapi_python_client/parser/properties/literal_enum_property.py +++ b/openapi_python_client/parser/properties/literal_enum_property.py @@ -2,7 +2,7 @@ __all__ = ["LiteralEnumProperty"] -from typing import Any, ClassVar, Union, cast +from typing import Any, ClassVar, cast from attr import evolve from attrs import define @@ -16,7 +16,7 @@ from .schemas import Class, Schemas from .union import UnionProperty -ValueType = Union[str, int] +ValueType = str | int @define @@ -97,9 +97,7 @@ def build( # noqa: PLR0911 value_type = next(iter(value_types)) if value_type not in (str, int): return PropertyError(header=f"Unsupported enum type {value_type}", data=data), schemas - value_list = cast( - Union[list[int], list[str]], unchecked_value_list - ) # We checked this with all the value_types stuff + value_list = cast(list[int] | list[str], unchecked_value_list) # We checked this with all the value_types stuff if len(value_list) < len(enum): # Only one of the values was None, that becomes a union data.oneOf = [ @@ -162,10 +160,10 @@ def convert_value(self, value: Any) -> Value | PropertyError | None: return PropertyError(detail=f"Value {value} is not valid for enum {self.name}") return PropertyError(detail=f"Cannot convert {value} to enum {self.name} of type {self.value_type}") - def get_base_type_string(self, *, quoted: bool = False) -> str: + def get_base_type_string(self) -> str: return self.class_info.name - def get_base_json_type_string(self, *, quoted: bool = False) -> str: + def get_base_json_type_string(self) -> str: return self.value_type.__name__ def get_instance_type_string(self) -> str: diff --git a/openapi_python_client/parser/properties/merge_properties.py b/openapi_python_client/parser/properties/merge_properties.py index db6424a7c..57b4bccbe 100644 --- a/openapi_python_client/parser/properties/merge_properties.py +++ b/openapi_python_client/parser/properties/merge_properties.py @@ -105,9 +105,9 @@ def _merge_string_with_format(prop1: Property, prop2: Property) -> Property | No def _merge_numeric(prop1: Property, prop2: Property) -> IntProperty | None | PropertyError: """Merge IntProperty with FloatProperty""" - if isinstance(prop1, IntProperty) and isinstance(prop2, (IntProperty, FloatProperty)): + if isinstance(prop1, IntProperty) and isinstance(prop2, IntProperty | FloatProperty): return _merge_common_attributes(prop1, prop2) - elif isinstance(prop2, IntProperty) and isinstance(prop1, (IntProperty, FloatProperty)): + elif isinstance(prop2, IntProperty) and isinstance(prop1, IntProperty | FloatProperty): # Use the IntProperty as a base since it's more restrictive, but keep the correct override order return _merge_common_attributes(prop2, prop1, prop2) else: diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index 762624501..c304d965e 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -140,8 +140,8 @@ def self_import(self) -> str: """Constructs a self import statement from this ModelProperty's attributes""" return f"models.{self.class_info.module_name} import {self.class_info.name}" - def get_base_type_string(self, *, quoted: bool = False) -> str: - return f'"{self.class_info.name}"' if quoted else self.class_info.name + def get_base_type_string(self) -> str: + return self.class_info.name def get_imports(self, *, prefix: str) -> set[str]: """ @@ -188,9 +188,6 @@ def get_type_string( self, no_optional: bool = False, json: bool = False, - *, - multipart: bool = False, - quoted: bool = False, ) -> str: """ Get a string representation of type that should be used when declaring this property @@ -201,18 +198,12 @@ def get_type_string( """ if json: type_string = self.get_base_json_type_string() - elif multipart: - type_string = "tuple[None, bytes, str]" else: type_string = self.get_base_type_string() - if quoted: - if type_string == self.class_info.name: - type_string = f"'{type_string}'" - if no_optional or self.required: return type_string - return f"Union[Unset, {type_string}]" + return f"{type_string} | Unset" from .property import Property # noqa: E402 @@ -245,8 +236,8 @@ def _process_properties( # noqa: PLR0912, PLR0911 config: Config, roots: set[ReferencePath | utils.ClassName], ) -> _PropertyData | PropertyError: - from . import property_from_data - from .merge_properties import merge_properties + from . import property_from_data # noqa: PLC0415 + from .merge_properties import merge_properties # noqa: PLC0415 properties: dict[str, Property] = {} relative_imports: set[str] = set() @@ -356,7 +347,7 @@ def _get_additional_properties( config: Config, roots: set[ReferencePath | utils.ClassName], ) -> tuple[Property | None | PropertyError, Schemas]: - from . import property_from_data + from . import property_from_data # noqa: PLC0415 if schema_additional is None: return ANY_ADDITIONAL_PROPERTY, schemas diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index 6e73a01ae..5927c6e91 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -1,8 +1,7 @@ __all__ = ["Property"] -from typing import Union -from typing_extensions import TypeAlias +from typing import TypeAlias from .any import AnyProperty from .boolean import BooleanProperty @@ -21,21 +20,21 @@ from .union import UnionProperty from .uuid import UuidProperty -Property: TypeAlias = Union[ - AnyProperty, - BooleanProperty, - ConstProperty, - DateProperty, - DateTimeProperty, - EnumProperty, - LiteralEnumProperty, - FileProperty, - FloatProperty, - IntProperty, - ListProperty, - ModelProperty, - NoneProperty, - StringProperty, - UnionProperty, - UuidProperty, -] +Property: TypeAlias = ( + AnyProperty + | BooleanProperty + | ConstProperty + | DateProperty + | DateTimeProperty + | EnumProperty + | LiteralEnumProperty + | FileProperty + | FloatProperty + | IntProperty + | ListProperty + | ModelProperty + | NoneProperty + | StringProperty + | UnionProperty + | UuidProperty +) diff --git a/openapi_python_client/parser/properties/protocol.py b/openapi_python_client/parser/properties/protocol.py index 9a5b51828..138fa7002 100644 --- a/openapi_python_client/parser/properties/protocol.py +++ b/openapi_python_client/parser/properties/protocol.py @@ -88,21 +88,18 @@ def set_python_name(self, new_name: str, config: Config, skip_snake_case: bool = PythonIdentifier(value=new_name, prefix=config.field_prefix, skip_snake_case=skip_snake_case), ) - def get_base_type_string(self, *, quoted: bool = False) -> str: + def get_base_type_string(self) -> str: """Get the string describing the Python type of this property. Base types no require quoting.""" - return f'"{self._type_string}"' if not self.is_base_type and quoted else self._type_string + return self._type_string - def get_base_json_type_string(self, *, quoted: bool = False) -> str: + def get_base_json_type_string(self) -> str: """Get the string describing the JSON type of this property. Base types no require quoting.""" - return f'"{self._json_type_string}"' if not self.is_base_type and quoted else self._json_type_string + return self._json_type_string def get_type_string( self, no_optional: bool = False, json: bool = False, - *, - multipart: bool = False, - quoted: bool = False, ) -> str: """ Get a string representation of type that should be used when declaring this property @@ -110,23 +107,19 @@ def get_type_string( Args: no_optional: Do not include Optional or Unset even if the value is optional (needed for isinstance checks) json: True if the type refers to the property after JSON serialization - multipart: True if the type should be used in a multipart request - quoted: True if the type should be wrapped in quotes (if not a base type) """ if json: - type_string = self.get_base_json_type_string(quoted=quoted) - elif multipart: - type_string = "tuple[None, bytes, str]" + type_string = self.get_base_json_type_string() else: - type_string = self.get_base_type_string(quoted=quoted) + type_string = self.get_base_type_string() if no_optional or self.required: return type_string - return f"Union[Unset, {type_string}]" + return f"{type_string} | Unset" def get_instance_type_string(self) -> str: """Get a string representation of runtime type that should be used for `isinstance` checks""" - return self.get_type_string(no_optional=True, quoted=False) + return self.get_type_string(no_optional=True) # noinspection PyUnusedLocal def get_imports(self, *, prefix: str) -> set[str]: @@ -139,7 +132,6 @@ def get_imports(self, *, prefix: str) -> set[str]: """ imports = set() if not self.required: - imports.add("from typing import Union") imports.add(f"from {prefix}types import UNSET, Unset") return imports @@ -163,8 +155,8 @@ def to_string(self) -> str: default = None if default is not None: - return f"{self.python_name}: {self.get_type_string(quoted=True)} = {default}" - return f"{self.python_name}: {self.get_type_string(quoted=True)}" + return f"{self.python_name}: {self.get_type_string()} = {default}" + return f"{self.python_name}: {self.get_type_string()}" def to_docstring(self) -> str: """Returns property docstring""" @@ -174,14 +166,3 @@ def to_docstring(self) -> str: if self.example: doc += f" Example: {self.example}." return doc - - @property - def is_base_type(self) -> bool: - """Base types, represented by any other of `Property` than `ModelProperty` should not be quoted.""" - from . import ListProperty, ModelProperty, UnionProperty - - return self.__class__.__name__ not in { - ModelProperty.__name__, - ListProperty.__name__, - UnionProperty.__name__, - } diff --git a/openapi_python_client/parser/properties/schemas.py b/openapi_python_client/parser/properties/schemas.py index 177a86924..c783eb4fe 100644 --- a/openapi_python_client/parser/properties/schemas.py +++ b/openapi_python_client/parser/properties/schemas.py @@ -10,7 +10,7 @@ "update_schemas_with_data", ] -from typing import TYPE_CHECKING, NewType, Union, cast +from typing import TYPE_CHECKING, NewType, cast from urllib.parse import urlparse from attrs import define, evolve, field @@ -32,7 +32,7 @@ ReferencePath = NewType("ReferencePath", str) -def parse_reference_path(ref_path_raw: str) -> Union[ReferencePath, ParseError]: +def parse_reference_path(ref_path_raw: str) -> ReferencePath | ParseError: """ Takes a raw string provided in a `$ref` and turns it into a validated `_ReferencePath` or a `ParseError` if validation fails. @@ -46,6 +46,13 @@ def parse_reference_path(ref_path_raw: str) -> Union[ReferencePath, ParseError]: return cast(ReferencePath, parsed.fragment) +def get_reference_simple_name(ref_path: str) -> str: + """ + Takes a path like `/components/schemas/NameOfThing` and returns a string like `NameOfThing`. + """ + return ref_path.split("/")[-1] + + @define class Class: """Represents Python class which will be generated from an OpenAPI schema""" @@ -56,7 +63,7 @@ class Class: @staticmethod def from_string(*, string: str, config: Config) -> "Class": """Get a Class from an arbitrary string""" - class_name = string.split("/")[-1] # Get rid of ref path stuff + class_name = get_reference_simple_name(string) # Get rid of ref path stuff class_name = ClassName(class_name, config.field_prefix) override = config.class_overrides.get(class_name) @@ -77,12 +84,12 @@ class Schemas: """Structure for containing all defined, shareable, and reusable schemas (attr classes and Enums)""" classes_by_reference: dict[ReferencePath, Property] = field(factory=dict) - dependencies: dict[ReferencePath, set[Union[ReferencePath, ClassName]]] = field(factory=dict) + dependencies: dict[ReferencePath, set[ReferencePath | ClassName]] = field(factory=dict) classes_by_name: dict[ClassName, Property] = field(factory=dict) models_to_process: list[ModelProperty] = field(factory=list) errors: list[ParseError] = field(factory=list) - def add_dependencies(self, ref_path: ReferencePath, roots: set[Union[ReferencePath, ClassName]]) -> None: + def add_dependencies(self, ref_path: ReferencePath, roots: set[ReferencePath | ClassName]) -> None: """Record new dependencies on the given ReferencePath Args: @@ -95,7 +102,7 @@ def add_dependencies(self, ref_path: ReferencePath, roots: set[Union[ReferencePa def update_schemas_with_data( *, ref_path: ReferencePath, data: oai.Schema, schemas: Schemas, config: Config -) -> Union[Schemas, PropertyError]: +) -> Schemas | PropertyError: """ Update a `Schemas` using some new reference. @@ -111,9 +118,9 @@ def update_schemas_with_data( See Also: - https://swagger.io/docs/specification/using-ref/ """ - from . import property_from_data + from . import property_from_data # noqa: PLC0415 - prop: Union[PropertyError, Property] + prop: PropertyError | Property prop, schemas = property_from_data( data=data, name=ref_path, @@ -151,10 +158,10 @@ class Parameters: def parameter_from_data( *, name: str, - data: Union[oai.Reference, oai.Parameter], + data: oai.Reference | oai.Parameter, parameters: Parameters, config: Config, -) -> tuple[Union[Parameter, ParameterError], Parameters]: +) -> tuple[Parameter | ParameterError, Parameters]: """Generates parameters from an OpenAPI Parameter spec.""" if isinstance(data, oai.Reference): @@ -179,7 +186,7 @@ def parameter_from_data( def update_parameters_with_data( *, ref_path: ReferencePath, data: oai.Parameter, parameters: Parameters, config: Config -) -> Union[Parameters, ParameterError]: +) -> Parameters | ParameterError: """ Update a `Parameters` using some new reference. @@ -212,9 +219,9 @@ def update_parameters_with_data( def parameter_from_reference( *, - param: Union[oai.Reference, Parameter], + param: oai.Reference | Parameter, parameters: Parameters, -) -> Union[Parameter, ParameterError]: +) -> Parameter | ParameterError: """ Returns a Parameter from a Reference or the Parameter itself if one was provided. diff --git a/openapi_python_client/parser/properties/union.py b/openapi_python_client/parser/properties/union.py index 8b7b02a48..5bdc1607d 100644 --- a/openapi_python_client/parser/properties/union.py +++ b/openapi_python_client/parser/properties/union.py @@ -28,7 +28,14 @@ class UnionProperty(PropertyProtocol): @classmethod def build( - cls, *, data: oai.Schema, name: str, required: bool, schemas: Schemas, parent_name: str, config: Config + cls, + *, + data: oai.Schema, + name: str, + required: bool, + schemas: Schemas, + parent_name: str, + config: Config, ) -> tuple[UnionProperty | PropertyError, Schemas]: """ Create a `UnionProperty` the right way. @@ -45,7 +52,7 @@ def build( `(result, schemas)` where `schemas` is the updated version of the input `schemas` and `result` is the constructed `UnionProperty` or a `PropertyError` describing what went wrong. """ - from . import property_from_data + from . import property_from_data # noqa: PLC0415 sub_properties: list[PropertyProtocol] = [] @@ -55,8 +62,19 @@ def build( type_list_data.append(data.model_copy(update={"type": _type, "default": None})) for i, sub_prop_data in enumerate(chain(data.anyOf, data.oneOf, type_list_data)): + # If a schema has a unique title property, we can use that to carry forward a descriptive name instead of "type_0" + subscript: str + if ( + isinstance(sub_prop_data, oai.Schema) + and sub_prop_data.title is not None + and sub_prop_data.title != data.title + ): + subscript = sub_prop_data.title + else: + subscript = f"type_{i}" + sub_prop, schemas = property_from_data( - name=f"{name}_type_{i}", + name=f"{name}_{subscript}", required=True, data=sub_prop_data, schemas=schemas, @@ -64,7 +82,10 @@ def build( config=config, ) if isinstance(sub_prop, PropertyError): - return PropertyError(detail=f"Invalid property in union {name}", data=sub_prop_data), schemas + return ( + PropertyError(detail=f"Invalid property in union {name}", data=sub_prop_data), + schemas, + ) sub_properties.append(sub_prop) def flatten_union_properties(sub_properties: list[PropertyProtocol]) -> list[PropertyProtocol]: @@ -106,9 +127,12 @@ def convert_value(self, value: Any) -> Value | None | PropertyError: return value_or_error return value_or_error - def _get_inner_type_strings(self, json: bool, multipart: bool) -> set[str]: + def _get_inner_type_strings(self, json: bool) -> set[str]: return { - p.get_type_string(no_optional=True, json=json, multipart=multipart, quoted=not p.is_base_type) + p.get_type_string( + no_optional=True, + json=json, + ) for p in self.inner_properties } @@ -116,15 +140,15 @@ def _get_inner_type_strings(self, json: bool, multipart: bool) -> set[str]: def _get_type_string_from_inner_type_strings(inner_types: set[str]) -> str: if len(inner_types) == 1: return inner_types.pop() - return f"Union[{', '.join(sorted(inner_types))}]" + return " | ".join(sorted(inner_types, key=lambda x: x.lower())) - def get_base_type_string(self, *, quoted: bool = False) -> str: - return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False, multipart=False)) + def get_base_type_string(self) -> str: + return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False)) - def get_base_json_type_string(self, *, quoted: bool = False) -> str: - return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True, multipart=False)) + def get_base_json_type_string(self) -> str: + return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True)) - def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool, multipart: bool) -> set[str]: + def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool) -> set[str]: """ Get the set of all the types that should appear within the `Union` representing this property. @@ -133,12 +157,11 @@ def get_type_strings_in_union(self, *, no_optional: bool = False, json: bool, mu Args: no_optional: Do not include `None` or `Unset` in this set. json: If True, this returns the JSON types, not the Python types, of this property. - multipart: If True, this returns the multipart types, not the Python types, of this property. Returns: A set of strings containing the types that should appear within `Union`. """ - type_strings = self._get_inner_type_strings(json=json, multipart=multipart) + type_strings = self._get_inner_type_strings(json=json) if no_optional: return type_strings if not self.required: @@ -149,16 +172,13 @@ def get_type_string( self, no_optional: bool = False, json: bool = False, - *, - multipart: bool = False, - quoted: bool = False, ) -> str: """ Get a string representation of type that should be used when declaring this property. This implementation differs slightly from `Property.get_type_string` in order to collapse nested union types. """ - type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json, multipart=multipart) + type_strings_in_union = self.get_type_strings_in_union(no_optional=no_optional, json=json) return self._get_type_string_from_inner_type_strings(type_strings_in_union) def get_imports(self, *, prefix: str) -> set[str]: @@ -172,7 +192,7 @@ def get_imports(self, *, prefix: str) -> set[str]: imports = super().get_imports(prefix=prefix) for inner_prop in self.inner_properties: imports.update(inner_prop.get_imports(prefix=prefix)) - imports.add("from typing import cast, Union") + imports.add("from typing import cast") return imports def get_lazy_imports(self, *, prefix: str) -> set[str]: @@ -183,7 +203,7 @@ def get_lazy_imports(self, *, prefix: str) -> set[str]: def validate_location(self, location: oai.ParameterLocation) -> ParseError | None: """Returns an error if this type of property is not allowed in the given location""" - from ..properties import Property + from ..properties import Property # noqa: PLC0415 for inner_prop in self.inner_properties: if evolve(cast(Property, inner_prop), required=self.required).validate_location(location) is not None: diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index d313f81ad..f05fbce75 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -1,11 +1,12 @@ -__all__ = ["Response", "response_from_data"] +__all__ = ["HTTPStatusPattern", "Response", "Responses", "response_from_data"] -from http import HTTPStatus -from typing import Optional, TypedDict, Union +from collections.abc import Iterator +from typing import TypedDict from attrs import define from openapi_python_client import utils +from openapi_python_client.parser.properties.schemas import get_reference_simple_name, parse_reference_path from .. import Config from .. import schema as oai @@ -14,6 +15,20 @@ from .properties import AnyProperty, Property, Schemas, property_from_data +@define +class Responses: + patterns: list["Response"] + default: "Response | None" + + def __iter__(self) -> Iterator["Response"]: + yield from self.patterns + if self.default: + yield self.default + + def __len__(self) -> int: + return len(self.patterns) + (1 if self.default else 0) + + class _ResponseSource(TypedDict): """What data should be pulled from the httpx Response object""" @@ -27,17 +42,93 @@ class _ResponseSource(TypedDict): NONE_SOURCE = _ResponseSource(attribute="None", return_type="None") -@define +class HTTPStatusPattern: + """Status code patterns come in three flavors, in order of precedence: + 1. Specific status codes, such as 200. This is represented by `min` and `max` being the same. + 2. Ranges of status codes, such as 2XX. This is represented by `min` and `max` being different. + 3. The special `default` status code, which is used when no other status codes match. `range` is `None` in this case. + + https://github.com/openapi-generators/openapi-python-client/blob/61b6c54994e2a6285bb422ee3b864c45b5d88c15/openapi_python_client/schema/3.1.0.md#responses-object + """ + + pattern: str + range: tuple[int, int] | None + + def __init__(self, *, pattern: str, code_range: tuple[int, int] | None): + """Initialize with a range of status codes or None for the default case.""" + self.pattern = pattern + self.range = code_range + + @staticmethod + def parse(pattern: str) -> "HTTPStatusPattern | ParseError": + """Parse a status code pattern such as 2XX or 404""" + if pattern == "default": + return HTTPStatusPattern(pattern=pattern, code_range=None) + + if pattern.endswith("XX") and pattern[0].isdigit(): + first_digit = int(pattern[0]) + return HTTPStatusPattern(pattern=pattern, code_range=(first_digit * 100, first_digit * 100 + 99)) + + try: + code = int(pattern) + return HTTPStatusPattern(pattern=pattern, code_range=(code, code)) + except ValueError: + return ParseError( + detail=( + f"Invalid response status code pattern: {pattern}, response will be omitted from generated client" + ) + ) + + def is_range(self) -> bool: + """Check if this is a range of status codes, such as 2XX""" + return self.range is not None and self.range[0] != self.range[1] + + def __lt__(self, other: "HTTPStatusPattern") -> bool: + """Compare two HTTPStatusPattern objects based on the order they should be applied in""" + if self.range is None: + return False # Default gets applied last + if other.range is None: + return True # Other is default, so this one gets applied first + + # Specific codes appear before ranges + if self.is_range() and not other.is_range(): + return False + if not self.is_range() and other.is_range(): + return True + + # Order specific codes numerically + return self.range[0] < other.range[0] + + def __eq__(self, other: object) -> bool: # pragma: no cover + if not isinstance(other, HTTPStatusPattern): + return False + return self.range == other.range + + def __hash__(self) -> int: # pragma: no cover + return hash(self.range) + + def __repr__(self) -> str: # pragma: no cover + return f"" + + +@define(order=False) class Response: """Describes a single response for an endpoint""" - status_code: HTTPStatus + status_code: HTTPStatusPattern prop: Property source: _ResponseSource - data: Union[oai.Response, oai.Reference] # Original data which created this response, useful for custom templates + data: oai.Response | oai.Reference # Original data which created this response, useful for custom templates + + def is_default(self) -> bool: + return self.status_code.range is None + def __lt__(self, other: "Response") -> bool: + """Compare two responses based on the order in which they should be applied in""" + return self.status_code < other.status_code -def _source_by_content_type(content_type: str, config: Config) -> Optional[_ResponseSource]: + +def _source_by_content_type(content_type: str, config: Config) -> _ResponseSource | None: parsed_content_type = utils.get_content_type(content_type, config) if parsed_content_type is None: return None @@ -58,10 +149,10 @@ def _source_by_content_type(content_type: str, config: Config) -> Optional[_Resp def empty_response( *, - status_code: HTTPStatus, + status_code: HTTPStatusPattern, response_name: str, config: Config, - data: Union[oai.Response, oai.Reference], + data: oai.Response | oai.Reference, ) -> Response: """Return an untyped response, for when no response type is defined""" return Response( @@ -79,27 +170,30 @@ def empty_response( ) -def response_from_data( +def response_from_data( # noqa: PLR0911 *, - status_code: HTTPStatus, - data: Union[oai.Response, oai.Reference], + status_code: HTTPStatusPattern, + data: oai.Response | oai.Reference, schemas: Schemas, + responses: dict[str, oai.Response | oai.Reference], parent_name: str, config: Config, -) -> tuple[Union[Response, ParseError], Schemas]: +) -> tuple[Response | ParseError, Schemas]: """Generate a Response from the OpenAPI dictionary representation of it""" - response_name = f"response_{status_code}" + response_name = f"response_{status_code.pattern}" if isinstance(data, oai.Reference): - return ( - empty_response( - status_code=status_code, - response_name=response_name, - config=config, - data=data, - ), - schemas, - ) + ref_path = parse_reference_path(data.ref) + if isinstance(ref_path, ParseError): + return ref_path, schemas + if not ref_path.startswith("/components/responses/"): + return ParseError(data=data, detail=f"$ref to {data.ref} not allowed in responses"), schemas + resp_data = responses.get(get_reference_simple_name(ref_path), None) + if not resp_data: + return ParseError(data=data, detail=f"Could not find reference: {data.ref}"), schemas + if not isinstance(resp_data, oai.Response): + return ParseError(data=data, detail="Top-level $ref inside components/responses is not supported"), schemas + data = resp_data content = data.content if not content: diff --git a/openapi_python_client/schema/openapi_schema_pydantic/components.py b/openapi_python_client/schema/openapi_schema_pydantic/components.py index babe26265..3023714c9 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/components.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/components.py @@ -1,5 +1,3 @@ -from typing import Optional, Union - from pydantic import BaseModel, ConfigDict from .callback import Callback @@ -7,7 +5,7 @@ from .header import Header from .link import Link from .parameter import Parameter -from .reference import Reference +from .reference import ReferenceOr from .request_body import RequestBody from .response import Response from .schema import Schema @@ -25,15 +23,15 @@ class Components(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject """ - schemas: Optional[dict[str, Union[Schema, Reference]]] = None - responses: Optional[dict[str, Union[Response, Reference]]] = None - parameters: Optional[dict[str, Union[Parameter, Reference]]] = None - examples: Optional[dict[str, Union[Example, Reference]]] = None - requestBodies: Optional[dict[str, Union[RequestBody, Reference]]] = None - headers: Optional[dict[str, Union[Header, Reference]]] = None - securitySchemes: Optional[dict[str, Union[SecurityScheme, Reference]]] = None - links: Optional[dict[str, Union[Link, Reference]]] = None - callbacks: Optional[dict[str, Union[Callback, Reference]]] = None + schemas: dict[str, ReferenceOr[Schema]] | None = None + responses: dict[str, ReferenceOr[Response]] | None = None + parameters: dict[str, ReferenceOr[Parameter]] | None = None + examples: dict[str, ReferenceOr[Example]] | None = None + requestBodies: dict[str, ReferenceOr[RequestBody]] | None = None + headers: dict[str, ReferenceOr[Header]] | None = None + securitySchemes: dict[str, ReferenceOr[SecurityScheme]] | None = None + links: dict[str, ReferenceOr[Link]] | None = None + callbacks: dict[str, ReferenceOr[Callback]] | None = None model_config = ConfigDict( # `Callback` contains an unresolvable forward reference, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/contact.py b/openapi_python_client/schema/openapi_schema_pydantic/contact.py index c04fdbbe0..0ff40fa71 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/contact.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/contact.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -11,9 +9,9 @@ class Contact(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#contactObject """ - name: Optional[str] = None - url: Optional[str] = None - email: Optional[str] = None + name: str | None = None + url: str | None = None + email: str | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py b/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py index 9f36773ba..3fb05ade9 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -19,7 +17,7 @@ class Discriminator(BaseModel): """ propertyName: str - mapping: Optional[dict[str, str]] = None + mapping: dict[str, str] | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py index ebf6295dc..d2725e9f7 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py @@ -1,8 +1,8 @@ -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING from pydantic import BaseModel, ConfigDict -from .reference import Reference +from .reference import ReferenceOr if TYPE_CHECKING: # pragma: no cover from .header import Header @@ -16,9 +16,9 @@ class Encoding(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encodingObject """ - contentType: Optional[str] = None - headers: Optional[dict[str, Union["Header", Reference]]] = None - style: Optional[str] = None + contentType: str | None = None + headers: dict[str, ReferenceOr["Header"]] | None = None + style: str | None = None explode: bool = False allowReserved: bool = False model_config = ConfigDict( diff --git a/openapi_python_client/schema/openapi_schema_pydantic/example.py b/openapi_python_client/schema/openapi_schema_pydantic/example.py index 90db2530e..6469457f7 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/example.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/example.py @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any from pydantic import BaseModel, ConfigDict @@ -11,10 +11,10 @@ class Example(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject """ - summary: Optional[str] = None - description: Optional[str] = None - value: Optional[Any] = None - externalValue: Optional[str] = None + summary: str | None = None + description: str | None = None + value: Any | None = None + externalValue: str | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py b/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py index 2c0c39b7c..78df42f67 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -10,7 +8,7 @@ class ExternalDocumentation(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject """ - description: Optional[str] = None + description: str | None = None url: str model_config = ConfigDict( extra="allow", diff --git a/openapi_python_client/schema/openapi_schema_pydantic/info.py b/openapi_python_client/schema/openapi_schema_pydantic/info.py index bec1354da..8b3e59963 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/info.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/info.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict from .contact import Contact @@ -18,10 +16,10 @@ class Info(BaseModel): """ title: str - description: Optional[str] = None - termsOfService: Optional[str] = None - contact: Optional[Contact] = None - license: Optional[License] = None + description: str | None = None + termsOfService: str | None = None + contact: Contact | None = None + license: License | None = None version: str model_config = ConfigDict( extra="allow", diff --git a/openapi_python_client/schema/openapi_schema_pydantic/license.py b/openapi_python_client/schema/openapi_schema_pydantic/license.py index 185eec1db..ee712d92e 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/license.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/license.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -12,7 +10,7 @@ class License(BaseModel): """ name: str - url: Optional[str] = None + url: str | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/link.py b/openapi_python_client/schema/openapi_schema_pydantic/link.py index 69cdf29c0..77740ceb4 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/link.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/link.py @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any from pydantic import BaseModel, ConfigDict @@ -23,12 +23,12 @@ class Link(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#linkObject """ - operationRef: Optional[str] = None - operationId: Optional[str] = None - parameters: Optional[dict[str, Any]] = None - requestBody: Optional[Any] = None - description: Optional[str] = None - server: Optional[Server] = None + operationRef: str | None = None + operationId: str | None = None + parameters: dict[str, Any] | None = None + requestBody: Any | None = None + description: str | None = None + server: Server | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/media_type.py b/openapi_python_client/schema/openapi_schema_pydantic/media_type.py index 95f9ede14..1f4e6090f 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/media_type.py @@ -1,10 +1,10 @@ -from typing import Any, Optional, Union +from typing import Any from pydantic import BaseModel, ConfigDict, Field from .encoding import Encoding from .example import Example -from .reference import Reference +from .reference import ReferenceOr from .schema import Schema @@ -16,10 +16,10 @@ class MediaType(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject """ - media_type_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema") - example: Optional[Any] = None - examples: Optional[dict[str, Union[Example, Reference]]] = None - encoding: Optional[dict[str, Encoding]] = None + media_type_schema: ReferenceOr[Schema] | None = Field(default=None, alias="schema") + example: Any | None = None + examples: dict[str, ReferenceOr[Example]] | None = None + encoding: dict[str, Encoding] | None = None model_config = ConfigDict( # `Encoding` is not build yet, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py index 16e366090..d9066e383 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -12,9 +10,9 @@ class OAuthFlow(BaseModel): - https://swagger.io/docs/specification/authentication/oauth2/ """ - authorizationUrl: Optional[str] = None - tokenUrl: Optional[str] = None - refreshUrl: Optional[str] = None + authorizationUrl: str | None = None + tokenUrl: str | None = None + refreshUrl: str | None = None scopes: dict[str, str] model_config = ConfigDict( extra="allow", diff --git a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py index dba193713..602a34cb5 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict from .oauth_flow import OAuthFlow @@ -14,8 +12,8 @@ class OAuthFlows(BaseModel): - https://swagger.io/docs/specification/authentication/oauth2/ """ - implicit: Optional[OAuthFlow] = None - password: Optional[OAuthFlow] = None - clientCredentials: Optional[OAuthFlow] = None - authorizationCode: Optional[OAuthFlow] = None + implicit: OAuthFlow | None = None + password: OAuthFlow | None = None + clientCredentials: OAuthFlow | None = None + authorizationCode: OAuthFlow | None = None model_config = ConfigDict(extra="allow") diff --git a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py index e66ea942c..a98158232 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict, field_validator from .components import Components @@ -24,10 +22,10 @@ class OpenAPI(BaseModel): info: Info servers: list[Server] = [Server(url="/")] paths: Paths - components: Optional[Components] = None - security: Optional[list[SecurityRequirement]] = None - tags: Optional[list[Tag]] = None - externalDocs: Optional[ExternalDocumentation] = None + components: Components | None = None + security: list[SecurityRequirement] | None = None + tags: list[Tag] | None = None + externalDocs: ExternalDocumentation | None = None openapi: str model_config = ConfigDict( # `Components` is not build yet, will rebuild in `__init__.py`: diff --git a/openapi_python_client/schema/openapi_schema_pydantic/operation.py b/openapi_python_client/schema/openapi_schema_pydantic/operation.py index ebf5e1faa..061be3135 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/operation.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/operation.py @@ -1,11 +1,9 @@ -from typing import Optional, Union - from pydantic import BaseModel, ConfigDict, Field from .callback import Callback from .external_documentation import ExternalDocumentation from .parameter import Parameter -from .reference import Reference +from .reference import ReferenceOr from .request_body import RequestBody from .responses import Responses from .security_requirement import SecurityRequirement @@ -20,19 +18,19 @@ class Operation(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject """ - tags: Optional[list[str]] = None - summary: Optional[str] = None - description: Optional[str] = None - externalDocs: Optional[ExternalDocumentation] = None - operationId: Optional[str] = None - parameters: Optional[list[Union[Parameter, Reference]]] = None - request_body: Optional[Union[RequestBody, Reference]] = Field(None, alias="requestBody") + tags: list[str] | None = None + summary: str | None = None + description: str | None = None + externalDocs: ExternalDocumentation | None = None + operationId: str | None = None + parameters: list[ReferenceOr[Parameter]] | None = None + request_body: ReferenceOr[RequestBody] | None = Field(None, alias="requestBody") responses: Responses - callbacks: Optional[dict[str, Callback]] = None + callbacks: dict[str, Callback] | None = None deprecated: bool = False - security: Optional[list[SecurityRequirement]] = None - servers: Optional[list[Server]] = None + security: list[SecurityRequirement] | None = None + servers: list[Server] | None = None model_config = ConfigDict( # `Callback` contains an unresolvable forward reference, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/parameter.py b/openapi_python_client/schema/openapi_schema_pydantic/parameter.py index 6f6fe9342..a963291fc 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/parameter.py @@ -1,11 +1,11 @@ -from typing import Any, Optional, Union +from typing import Any from pydantic import BaseModel, ConfigDict, Field from ..parameter_location import ParameterLocation from .example import Example from .media_type import MediaType -from .reference import Reference +from .reference import ReferenceOr from .schema import Schema @@ -23,17 +23,17 @@ class Parameter(BaseModel): name: str param_in: ParameterLocation = Field(alias="in") - description: Optional[str] = None + description: str | None = None required: bool = False deprecated: bool = False allowEmptyValue: bool = False - style: Optional[str] = None + style: str | None = None explode: bool = False allowReserved: bool = False - param_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema") - example: Optional[Any] = None - examples: Optional[dict[str, Union[Example, Reference]]] = None - content: Optional[dict[str, MediaType]] = None + param_schema: ReferenceOr[Schema] | None = Field(default=None, alias="schema") + example: Any | None = None + examples: dict[str, ReferenceOr[Example]] | None = None + content: dict[str, MediaType] | None = None model_config = ConfigDict( # `MediaType` is not build yet, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py index 8c1eab6ea..16fee9aeb 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py @@ -1,9 +1,9 @@ -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING from pydantic import BaseModel, ConfigDict, Field from .parameter import Parameter -from .reference import Reference +from .reference import ReferenceOr from .server import Server if TYPE_CHECKING: @@ -22,19 +22,19 @@ class PathItem(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject """ - ref: Optional[str] = Field(default=None, alias="$ref") - summary: Optional[str] = None - description: Optional[str] = None - get: Optional["Operation"] = None - put: Optional["Operation"] = None - post: Optional["Operation"] = None - delete: Optional["Operation"] = None - options: Optional["Operation"] = None - head: Optional["Operation"] = None - patch: Optional["Operation"] = None - trace: Optional["Operation"] = None - servers: Optional[list[Server]] = None - parameters: Optional[list[Union[Parameter, Reference]]] = None + ref: str | None = Field(default=None, alias="$ref") + summary: str | None = None + description: str | None = None + get: "Operation | None" = None + put: "Operation | None" = None + post: "Operation | None" = None + delete: "Operation | None" = None + options: "Operation | None" = None + head: "Operation | None" = None + patch: "Operation | None" = None + trace: "Operation | None" = None + servers: list[Server] | None = None + parameters: list[ReferenceOr[Parameter]] | None = None model_config = ConfigDict( # `Operation` is an unresolvable forward reference, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/reference.py b/openapi_python_client/schema/openapi_schema_pydantic/reference.py index 50d26064f..c1b41e473 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/reference.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/reference.py @@ -1,4 +1,6 @@ -from pydantic import BaseModel, ConfigDict, Field +from typing import Annotated, Any, Literal, TypeAlias, TypeVar + +from pydantic import BaseModel, ConfigDict, Discriminator, Field, Tag class Reference(BaseModel): @@ -24,3 +26,17 @@ class Reference(BaseModel): "examples": [{"$ref": "#/components/schemas/Pet"}, {"$ref": "Pet.json"}, {"$ref": "definitions.json#/Pet"}] }, ) + + +T = TypeVar("T") + + +def _reference_discriminator(obj: Any) -> Literal["ref", "other"]: + if isinstance(obj, dict): + return "ref" if "$ref" in obj else "other" + return "ref" if isinstance(obj, Reference) else "other" + + +ReferenceOr: TypeAlias = Annotated[ + Annotated[Reference, Tag("ref")] | Annotated[T, Tag("other")], Discriminator(_reference_discriminator) +] diff --git a/openapi_python_client/schema/openapi_schema_pydantic/request_body.py b/openapi_python_client/schema/openapi_schema_pydantic/request_body.py index 8cd9bb527..60c454b6d 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/request_body.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict from .media_type import MediaType @@ -13,7 +11,7 @@ class RequestBody(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject """ - description: Optional[str] = None + description: str | None = None content: dict[str, MediaType] required: bool = False model_config = ConfigDict( diff --git a/openapi_python_client/schema/openapi_schema_pydantic/response.py b/openapi_python_client/schema/openapi_schema_pydantic/response.py index b7ec0d357..e6d8ebb2c 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/response.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/response.py @@ -1,11 +1,9 @@ -from typing import Optional, Union - from pydantic import BaseModel, ConfigDict from .header import Header from .link import Link from .media_type import MediaType -from .reference import Reference +from .reference import ReferenceOr class Response(BaseModel): @@ -19,9 +17,9 @@ class Response(BaseModel): """ description: str - headers: Optional[dict[str, Union[Header, Reference]]] = None - content: Optional[dict[str, MediaType]] = None - links: Optional[dict[str, Union[Link, Reference]]] = None + headers: dict[str, ReferenceOr[Header]] | None = None + content: dict[str, MediaType] | None = None + links: dict[str, ReferenceOr[Link]] | None = None model_config = ConfigDict( # `MediaType` is not build yet, will rebuild in `__init__.py`: defer_build=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/responses.py b/openapi_python_client/schema/openapi_schema_pydantic/responses.py index 17ddc13fe..823339a54 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/responses.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/responses.py @@ -1,9 +1,7 @@ -from typing import Union - -from .reference import Reference +from .reference import ReferenceOr from .response import Response -Responses = dict[str, Union[Response, Reference]] +Responses = dict[str, ReferenceOr[Response]] """ A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. diff --git a/openapi_python_client/schema/openapi_schema_pydantic/schema.py b/openapi_python_client/schema/openapi_schema_pydantic/schema.py index 99c64eb51..990f14a3d 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/schema.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/schema.py @@ -1,11 +1,11 @@ -from typing import Any, Optional, Union +from typing import Any from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, model_validator from ..data_type import DataType from .discriminator import Discriminator from .external_documentation import ExternalDocumentation -from .reference import Reference +from .reference import ReferenceOr from .xml import XML @@ -20,43 +20,43 @@ class Schema(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject """ - title: Optional[str] = None - multipleOf: Optional[float] = Field(default=None, gt=0.0) - maximum: Optional[float] = None - exclusiveMaximum: Optional[Union[bool, float]] = None - minimum: Optional[float] = None - exclusiveMinimum: Optional[Union[bool, float]] = None - maxLength: Optional[int] = Field(default=None, ge=0) - minLength: Optional[int] = Field(default=None, ge=0) - pattern: Optional[str] = None - maxItems: Optional[int] = Field(default=None, ge=0) - minItems: Optional[int] = Field(default=None, ge=0) - uniqueItems: Optional[bool] = None - maxProperties: Optional[int] = Field(default=None, ge=0) - minProperties: Optional[int] = Field(default=None, ge=0) - required: Optional[list[str]] = Field(default=None) - enum: Union[None, list[Any]] = Field(default=None, min_length=1) - const: Union[None, StrictStr, StrictInt, StrictFloat, StrictBool] = None - type: Union[DataType, list[DataType], None] = Field(default=None) - allOf: list[Union[Reference, "Schema"]] = Field(default_factory=list) - oneOf: list[Union[Reference, "Schema"]] = Field(default_factory=list) - anyOf: list[Union[Reference, "Schema"]] = Field(default_factory=list) - schema_not: Optional[Union[Reference, "Schema"]] = Field(default=None, alias="not") - items: Optional[Union[Reference, "Schema"]] = None - prefixItems: list[Union[Reference, "Schema"]] = Field(default_factory=list) - properties: Optional[dict[str, Union[Reference, "Schema"]]] = None - additionalProperties: Optional[Union[bool, Reference, "Schema"]] = None - description: Optional[str] = None - schema_format: Optional[str] = Field(default=None, alias="format") - default: Optional[Any] = None + title: str | None = None + multipleOf: float | None = Field(default=None, gt=0.0) + maximum: float | None = None + exclusiveMaximum: bool | float | None = None + minimum: float | None = None + exclusiveMinimum: bool | float | None = None + maxLength: int | None = Field(default=None, ge=0) + minLength: int | None = Field(default=None, ge=0) + pattern: str | None = None + maxItems: int | None = Field(default=None, ge=0) + minItems: int | None = Field(default=None, ge=0) + uniqueItems: bool | None = None + maxProperties: int | None = Field(default=None, ge=0) + minProperties: int | None = Field(default=None, ge=0) + required: list[str] | None = Field(default=None) + enum: None | list[Any] = Field(default=None, min_length=1) + const: None | StrictStr | StrictInt | StrictFloat | StrictBool = None + type: DataType | list[DataType] | None = Field(default=None) + allOf: list[ReferenceOr["Schema"]] = Field(default_factory=list) + oneOf: list[ReferenceOr["Schema"]] = Field(default_factory=list) + anyOf: list[ReferenceOr["Schema"]] = Field(default_factory=list) + schema_not: ReferenceOr["Schema"] | None = Field(default=None, alias="not") + items: ReferenceOr["Schema"] | None = None + prefixItems: list[ReferenceOr["Schema"]] = Field(default_factory=list) + properties: dict[str, ReferenceOr["Schema"]] | None = None + additionalProperties: bool | ReferenceOr["Schema"] | None = None + description: str | None = None + schema_format: str | None = Field(default=None, alias="format") + default: Any | None = None nullable: bool = Field(default=False) - discriminator: Optional[Discriminator] = None - readOnly: Optional[bool] = None - writeOnly: Optional[bool] = None - xml: Optional[XML] = None - externalDocs: Optional[ExternalDocumentation] = None - example: Optional[Any] = None - deprecated: Optional[bool] = None + discriminator: Discriminator | None = None + readOnly: bool | None = None + writeOnly: bool | None = None + xml: XML | None = None + externalDocs: ExternalDocumentation | None = None + example: Any | None = None + deprecated: bool | None = None model_config = ConfigDict( extra="allow", populate_by_name=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py b/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py index df385440c..76b97bd90 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict, Field from .oauth_flows import OAuthFlows @@ -20,13 +18,13 @@ class SecurityScheme(BaseModel): """ type: str - description: Optional[str] = None - name: Optional[str] = None - security_scheme_in: Optional[str] = Field(default=None, alias="in") - scheme: Optional[str] = None - bearerFormat: Optional[str] = None - flows: Optional[OAuthFlows] = None - openIdConnectUrl: Optional[str] = None + description: str | None = None + name: str | None = None + security_scheme_in: str | None = Field(default=None, alias="in") + scheme: str | None = None + bearerFormat: str | None = None + flows: OAuthFlows | None = None + openIdConnectUrl: str | None = None model_config = ConfigDict( extra="allow", populate_by_name=True, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/server.py b/openapi_python_client/schema/openapi_schema_pydantic/server.py index 6bc21766c..abfb77e1b 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/server.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/server.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict from .server_variable import ServerVariable @@ -14,8 +12,8 @@ class Server(BaseModel): """ url: str - description: Optional[str] = None - variables: Optional[dict[str, ServerVariable]] = None + description: str | None = None + variables: dict[str, ServerVariable] | None = None model_config = ConfigDict( extra="allow", json_schema_extra={ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py b/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py index 8a869c40e..09a705a2b 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -11,7 +9,7 @@ class ServerVariable(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverVariableObject """ - enum: Optional[list[str]] = None + enum: list[str] | None = None default: str - description: Optional[str] = None + description: str | None = None model_config = ConfigDict(extra="allow") diff --git a/openapi_python_client/schema/openapi_schema_pydantic/tag.py b/openapi_python_client/schema/openapi_schema_pydantic/tag.py index acb5fdc28..799810f36 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/tag.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/tag.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict from .external_documentation import ExternalDocumentation @@ -16,8 +14,8 @@ class Tag(BaseModel): """ name: str - description: Optional[str] = None - externalDocs: Optional[ExternalDocumentation] = None + description: str | None = None + externalDocs: ExternalDocumentation | None = None model_config = ConfigDict( extra="allow", json_schema_extra={"examples": [{"name": "pet", "description": "Pets operations"}]} ) diff --git a/openapi_python_client/schema/openapi_schema_pydantic/xml.py b/openapi_python_client/schema/openapi_schema_pydantic/xml.py index 986aa44f4..87082b3c8 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/xml.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/xml.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import BaseModel, ConfigDict @@ -16,9 +14,9 @@ class XML(BaseModel): - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xmlObject """ - name: Optional[str] = None - namespace: Optional[str] = None - prefix: Optional[str] = None + name: str | None = None + namespace: str | None = None + prefix: str | None = None attribute: bool = False wrapped: bool = False model_config = ConfigDict( diff --git a/openapi_python_client/templates/README.md.jinja b/openapi_python_client/templates/README.md.jinja index ea31c83d7..98dcdf3a7 100644 --- a/openapi_python_client/templates/README.md.jinja +++ b/openapi_python_client/templates/README.md.jinja @@ -109,7 +109,7 @@ client = Client( client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) ``` -{% if poetry %} +{% if meta == "poetry" %} ## Building / publishing this package This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics: 1. Update the metadata in pyproject.toml (e.g. authors, version) @@ -123,4 +123,17 @@ If you want to install this client into another project without publishing it (e 1. If that project is not using Poetry: 1. Build a wheel with `poetry build -f wheel` 1. Install that wheel from the other project `pip install ` +{% elif meta == 'uv' %} +## Building / publishing this package +This project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and packaging. Here are the basics: +1. Update the metadata in `pyproject.toml` (e.g. authors, version). +2. If you're using a private repository: https://docs.astral.sh/uv/guides/integration/alternative-indexes/ +3. Build a distribution with `uv build`, builds `sdist` and `wheel` by default. +1. Publish the client with `uv publish`, see documentation for publishing to private indexes. + +If you want to install this client into another project without publishing it (e.g. for development) then: +1. If that project **is using uv**, you can simply do `uv add ` from that project +1. If that project is not using uv: + 1. Build a wheel with `uv build --wheel`. + 1. Install that wheel from the other project `pip install `. {% endif %} \ No newline at end of file diff --git a/openapi_python_client/templates/client.py.jinja b/openapi_python_client/templates/client.py.jinja index aee6096e9..90c90a210 100644 --- a/openapi_python_client/templates/client.py.jinja +++ b/openapi_python_client/templates/client.py.jinja @@ -1,10 +1,35 @@ import ssl -from typing import Any, Union, Optional +from typing import Any from attrs import define, field, evolve import httpx +{% set attrs_info = { + "raise_on_unexpected_status": namespace( + type="bool", + default="field(default=False, kw_only=True)", + docstring="Whether or not to raise an errors.UnexpectedStatus if the API returns a status code" + " that was not documented in the source OpenAPI document. Can also be provided as a keyword" + " argument to the constructor." + ), + "token": namespace(type="str", default="", docstring="The token to use for authentication"), + "prefix": namespace(type="str", default='"Bearer"', docstring="The prefix to use for the Authorization header"), + "auth_header_name": namespace(type="str", default='"Authorization"', docstring="The name of the Authorization header"), +} %} + +{% macro attr_in_class_docstring(name) %} +{{ name }}: {{ attrs_info[name].docstring }} +{%- endmacro %} + +{% macro declare_attr(name) %} +{% set attr = attrs_info[name] %} +{{ name }}: {{ attr.type }}{% if attr.default %} = {{ attr.default }}{% endif %} +{% if attr.docstring and config.docstrings_on_attributes +%} +"""{{ attr.docstring }}""" +{%- endif %} +{% endmacro %} + @define class Client: """A class for keeping track of data related to the API @@ -29,23 +54,23 @@ class Client: ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. {% endmacro %} {{ httpx_args_docstring() }} +{% if not config.docstrings_on_attributes %} Attributes: - raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a - status code that was not documented in the source OpenAPI document. Can also be provided as a keyword - argument to the constructor. + {{ attr_in_class_docstring("raise_on_unexpected_status") | wordwrap(101) | indent(12) }} +{% endif %} """ {% macro attributes() %} - raise_on_unexpected_status: bool = field(default=False, kw_only=True) + {{ declare_attr("raise_on_unexpected_status") | indent(4) }} _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) {% endmacro %}{{ attributes() }} {% macro builders(self) %} def with_headers(self, headers: dict[str, str]) -> "{{ self }}": @@ -65,7 +90,7 @@ class Client: return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "{{ self }}": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -108,7 +133,7 @@ class Client: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "{{ name }}": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -147,20 +172,20 @@ class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints {{ httpx_args_docstring() }} +{% if not config.docstrings_on_attributes %} Attributes: - raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a - status code that was not documented in the source OpenAPI document. Can also be provided as a keyword - argument to the constructor. - token: The token to use for authentication - prefix: The prefix to use for the Authorization header - auth_header_name: The name of the Authorization header + {{ attr_in_class_docstring("raise_on_unexpected_status") | wordwrap(101) | indent(12) }} + {{ attr_in_class_docstring("token") | indent(8) }} + {{ attr_in_class_docstring("prefix") | indent(8) }} + {{ attr_in_class_docstring("auth_header_name") | indent(8) }} +{% endif %} """ {{ attributes() }} - token: str - prefix: str = "Bearer" - auth_header_name: str = "Authorization" + {{ declare_attr("token") | indent(4) }} + {{ declare_attr("prefix") | indent(4) }} + {{ declare_attr("auth_header_name") | indent(4) }} {{ builders("AuthenticatedClient") }} {{ httpx_stuff("AuthenticatedClient", "self._headers[self.auth_header_name] = f\"{self.prefix} {self.token}\" if self.prefix else self.token") }} diff --git a/openapi_python_client/templates/endpoint_init.py.jinja b/openapi_python_client/templates/endpoint_init.py.jinja index e69de29bb..c9921b5fd 100644 --- a/openapi_python_client/templates/endpoint_init.py.jinja +++ b/openapi_python_client/templates/endpoint_init.py.jinja @@ -0,0 +1 @@ +""" Contains endpoint functions for accessing the API """ diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 2da580af4..127979970 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -58,33 +58,33 @@ params = {k: v for k, v in params.items() if v is not UNSET and v is not None} {% endif %} {% endmacro %} -{% macro body_to_kwarg(body, destination) %} +{% macro body_to_kwarg(body) %} {% if body.body_type == "data" %} -{{ destination }} = body.to_dict() +_kwargs["data"] = body.to_dict() {% elif body.body_type == "files"%} -{{ multipart_body(body, destination) }} +{{ multipart_body(body) }} {% elif body.body_type == "json" %} -{{ json_body(body, destination) }} +{{ json_body(body) }} {% elif body.body_type == "content" %} -{{ destination }} = body.payload +_kwargs["content"] = body.payload {% endif %} {% endmacro %} -{% macro json_body(body, destination) %} +{% macro json_body(body) %} {% set property = body.prop %} {% import "property_templates/" + property.template as prop_template %} {% if prop_template.transform %} -{{ prop_template.transform(property, property.python_name, destination) }} +{{ prop_template.transform(property, property.python_name, "_kwargs[\"json\"]") }} {% else %} -{{ destination }} = {{ property.python_name }} +_kwargs["json"] = {{ property.python_name }} {% endif %} {% endmacro %} -{% macro multipart_body(body, destination) %} +{% macro multipart_body(body) %} {% set property = body.prop %} {% import "property_templates/" + property.template as prop_template %} {% if prop_template.transform_multipart_body %} -{{ prop_template.transform_multipart_body(property, property.python_name, destination) }} +{{ prop_template.transform_multipart_body(property) }} {% endif %} {% endmacro %} @@ -102,18 +102,18 @@ params = {k: v for k, v in params.items() if v is not UNSET and v is not None} {% if endpoint.requires_security %} client: AuthenticatedClient, {% else %} -client: Union[AuthenticatedClient, Client], +client: AuthenticatedClient | Client, {% endif %} {% endif %} {# Any allowed bodies #} {% if endpoint.bodies | length == 1 %} body: {{ endpoint.bodies[0].prop.get_type_string() }}, {% elif endpoint.bodies | length > 1 %} -body: Union[ - {% for body in endpoint.bodies %} - {{ body.prop.get_type_string() }}, - {% endfor %} -], +body: + {%- for body in endpoint.bodies -%} + {{ body.prop.get_type_string() }} {% if not loop.last %} | {% endif %} + {%- endfor -%} +, {% endif %} {# query parameters #} {% for parameter in endpoint.query_parameters %} @@ -184,3 +184,18 @@ Returns: {% macro docstring(endpoint, return_string, is_detailed) %} {{ safe_docstring(docstring_content(endpoint, return_string, is_detailed)) }} {% endmacro %} + +{% macro parse_response(parsed_responses, response) %} +{% if parsed_responses %}{% import "property_templates/" + response.prop.template as prop_template %} +{% if prop_template.construct %} +{{ prop_template.construct(response.prop, response.source.attribute) }} +{% elif response.source.return_type == response.prop.get_type_string() %} +{{ response.prop.python_name }} = {{ response.source.attribute }} +{% else %} +{{ response.prop.python_name }} = cast({{ response.prop.get_type_string() }}, {{ response.source.attribute }}) +{% endif %} +return {{ response.prop.python_name }} +{% else %} +return None +{% endif %} +{% endmacro %} diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index 35090614c..27213ecf4 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -31,7 +32,7 @@ def _get_kwargs( {% if endpoint.path_parameters %} "url": "{{ endpoint.path }}".format( {%- for parameter in endpoint.path_parameters -%} - {{parameter.python_name}}={{parameter.python_name}}, + {{parameter.python_name}}=quote(str({{parameter.python_name}}), safe=""), {%- endfor -%} ), {% else %} @@ -48,15 +49,12 @@ def _get_kwargs( {% if endpoint.bodies | length > 1 %} {% for body in endpoint.bodies %} if isinstance(body, {{body.prop.get_type_string() }}): - {% set destination = "_" + body.body_type + "_body" %} - {{ body_to_kwarg(body, destination) | indent(8) }} - _kwargs["{{ body.body_type.value }}"] = {{ destination }} + {{ body_to_kwarg(body) | indent(8) }} headers["Content-Type"] = "{{ body.content_type }}" {% endfor %} {% elif endpoint.bodies | length == 1 %} {% set body = endpoint.bodies[0] %} - {{ body_to_kwarg(body, "_body") | indent(4) }} - _kwargs["{{ body.body_type.value }}"] = _body + {{ body_to_kwarg(body) | indent(4) }} {% if body.content_type != "multipart/form-data" %}{# Need httpx to set the boundary automatically #} headers["Content-Type"] = "{{ body.content_type }}" {% endif %} @@ -67,30 +65,34 @@ def _get_kwargs( {% endif %} return _kwargs +{% if endpoint.responses.default %} + {% set return_type = return_string %} +{% else %} + {% set return_type = return_string + " | None" %} +{% endif %} -def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[{{ return_string }}]: - {% for response in endpoint.responses %} - if response.status_code == {{ response.status_code.value }}: - {% if parsed_responses %}{% import "property_templates/" + response.prop.template as prop_template %} - {% if prop_template.construct %} - {{ prop_template.construct(response.prop, response.source.attribute) | indent(8) }} - {% elif response.source.return_type == response.prop.get_type_string() %} - {{ response.prop.python_name }} = {{ response.source.attribute }} - {% else %} - {{ response.prop.python_name }} = cast({{ response.prop.get_type_string() }}, {{ response.source.attribute }}) - {% endif %} - return {{ response.prop.python_name }} - {% else %} - return None - {% endif %} + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> {{return_type}}: + {% for response in endpoint.responses.patterns %} + {% set code_range = response.status_code.range %} + {% if code_range[0] == code_range[1] %} + if response.status_code == {{ code_range[0] }}: + {% else %} + if {{ code_range[0] }} <= response.status_code <= {{ code_range[1] }}: + {% endif %} + {{ parse_response(parsed_responses, response) | indent(8) }} {% endfor %} + {% if endpoint.responses.default %} + {{ parse_response(parsed_responses, endpoint.responses.default) | indent(4) }} + {% else %} if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None + {% endif %} -def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[{{ return_string }}]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string }}]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -117,7 +119,7 @@ def sync_detailed( {% if parsed_responses %} def sync( {{ arguments(endpoint) | indent(4) }} -) -> Optional[{{ return_string }}]: +) -> {{ return_string }} | None: {{ docstring(endpoint, return_string, is_detailed=false) | indent(4) }} return sync_detailed( @@ -143,7 +145,7 @@ async def asyncio_detailed( {% if parsed_responses %} async def asyncio( {{ arguments(endpoint) | indent(4) }} -) -> Optional[{{ return_string }}]: +) -> {{ return_string }} | None: {{ docstring(endpoint, return_string, is_detailed=false) | indent(4) }} return (await asyncio_detailed( diff --git a/openapi_python_client/templates/helpers.jinja b/openapi_python_client/templates/helpers.jinja index 180613c02..fd5c3ec86 100644 --- a/openapi_python_client/templates/helpers.jinja +++ b/openapi_python_client/templates/helpers.jinja @@ -1,8 +1,10 @@ -{% macro safe_docstring(content) %} +{% macro safe_docstring(content, omit_if_empty=False) %} {# This macro returns the provided content as a docstring, set to a raw string if it contains a backslash #} +{% if (not omit_if_empty) or (content | trim) %} {% if '\\' in content -%} r""" {{ content }} """ {%- else -%} """ {{ content }} """ {%- endif -%} +{% endif %} {% endmacro %} \ No newline at end of file diff --git a/openapi_python_client/templates/model.py.jinja b/openapi_python_client/templates/model.py.jinja index 739f68962..785b49e68 100644 --- a/openapi_python_client/templates/model.py.jinja +++ b/openapi_python_client/templates/model.py.jinja @@ -1,9 +1,13 @@ -from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator from attrs import define as _attrs_define from attrs import field as _attrs_field {% if model.is_multipart_body %} import json +from .. import types {% endif %} from ..types import UNSET, Unset @@ -21,7 +25,7 @@ if TYPE_CHECKING: {% if model.additional_properties %} -{% set additional_property_type = 'Any' if model.additional_properties == True else model.additional_properties.get_type_string(quoted=not model.additional_properties.is_base_type) %} +{% set additional_property_type = 'Any' if model.additional_properties == True else model.additional_properties.get_type_string() %} {% endif %} {% set class_name = model.class_info.name %} @@ -47,57 +51,79 @@ T = TypeVar("T", bound="{{ class_name }}") {{ model.example | string | wordwrap(112) | indent(12) }} {% endif %} - {% if model.required_properties or model.optional_properties %} + {% if (not config.docstrings_on_attributes) and (model.required_properties or model.optional_properties) %} Attributes: {% for property in model.required_properties + model.optional_properties %} {{ property.to_docstring() | wordwrap(112) | indent(12) }} {% endfor %}{% endif %} {% endmacro %} +{% macro declare_property(property) %} +{%- if config.docstrings_on_attributes and property.description -%} +{{ property.to_string() }} +{{ safe_docstring(property.description, omit_if_empty=True) | wordwrap(112) }} +{%- else -%} +{{ property.to_string() }} +{%- endif -%} +{% endmacro %} + @_attrs_define class {{ class_name }}: - {{ safe_docstring(class_docstring_content(model)) | indent(4) }} + {{ safe_docstring(class_docstring_content(model), omit_if_empty=config.docstrings_on_attributes) | indent(4) }} {% for property in model.required_properties + model.optional_properties %} {% if property.default is none and property.required %} - {{ property.to_string() }} + {{ declare_property(property) | indent(4) }} {% endif %} {% endfor %} {% for property in model.required_properties + model.optional_properties %} {% if property.default is not none or not property.required %} - {{ property.to_string() }} + {{ declare_property(property) | indent(4) }} {% endif %} {% endfor %} {% if model.additional_properties %} additional_properties: dict[str, {{ additional_property_type }}] = _attrs_field(init=False, factory=dict) {% endif %} -{% macro _to_dict(multipart=False) %} -{% for property in model.required_properties + model.optional_properties %} +{% macro _transform_property(property, content) %} +{% import "property_templates/" + property.template as prop_template %} +{%- if prop_template.transform -%} +{{ prop_template.transform(property=property, source=content, destination=property.python_name) }} +{%- else -%} +{{ property.python_name }} = {{ content }} +{%- endif -%} +{% endmacro %} + +{% macro multipart(property, source, destination) %} {% import "property_templates/" + property.template as prop_template %} -{% if multipart %} -{{ prop_template.transform_multipart(property, "self." + property.python_name, property.python_name) }} -{% elif prop_template.transform %} -{{ prop_template.transform(property=property, source="self." + property.python_name, destination=property.python_name) }} +{% if not property.required %} +if not isinstance({{source}}, Unset): + {{ prop_template.multipart(property, source, destination) | indent(4) }} {% else %} -{{ property.python_name }} = self.{{ property.python_name }} +{{ prop_template.multipart(property, source, destination) }} {% endif %} +{% endmacro %} -{% endfor %} - +{% macro _prepare_field_dict() %} field_dict: dict[str, Any] = {} {% if model.additional_properties %} {% import "property_templates/" + model.additional_properties.template as prop_template %} -{% if multipart %} -for prop_name, prop in self.additional_properties.items(): - {{ prop_template.transform_multipart(model.additional_properties, "prop", "field_dict[prop_name]") | indent(4) }} -{% elif prop_template.transform %} +{% if prop_template.transform %} for prop_name, prop in self.additional_properties.items(): {{ prop_template.transform(model.additional_properties, "prop", "field_dict[prop_name]", declare_type=false) | indent(4) }} {% else %} field_dict.update(self.additional_properties) -{% endif %} -{% endif %} +{%- endif -%} +{%- endif -%} +{% endmacro %} + +{% macro _to_dict() %} +{% for property in model.required_properties + model.optional_properties -%} +{{ _transform_property(property, "self." + property.python_name) }} + +{% endfor %} + +{{ _prepare_field_dict() }} {% if model.required_properties | length > 0 or model.optional_properties | length > 0 %} field_dict.update({ {% for property in model.required_properties + model.optional_properties %} @@ -124,17 +150,31 @@ return field_dict {{ _to_dict() | indent(8) }} {% if model.is_multipart_body %} - def to_multipart(self) -> dict[str, Any]: - {{ _to_dict(multipart=True) | indent(8) }} + def to_multipart(self) -> types.RequestFiles: + files: types.RequestFiles = [] + + {% for property in model.required_properties + model.optional_properties %} + {% set destination = "\"" + property.name + "\"" %} + {{ multipart(property, "self." + property.python_name, destination) | indent(8) }} + + {% endfor %} + + {% if model.additional_properties %} + for prop_name, prop in self.additional_properties.items(): + {{ multipart(model.additional_properties, "prop", "prop_name") | indent(4) }} + {% endif %} + + return files + {% endif %} @classmethod - def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T: + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: {% for lazy_import in model.lazy_imports %} {{ lazy_import }} {% endfor %} {% if (model.required_properties or model.optional_properties or model.additional_properties) %} - d = src_dict.copy() + d = dict(src_dict) {% for property in model.required_properties + model.optional_properties %} {% if property.required %} {% set property_source = 'd.pop("' + property.name + '")' %} diff --git a/openapi_python_client/templates/property_templates/any_property.py.jinja b/openapi_python_client/templates/property_templates/any_property.py.jinja index 25a16516a..ad3f195a4 100644 --- a/openapi_python_client/templates/property_templates/any_property.py.jinja +++ b/openapi_python_client/templates/property_templates/any_property.py.jinja @@ -1,7 +1,3 @@ -{% macro transform_multipart(property, source, destination) %} -{% if not property.required %} -{{ destination }} = {{source}} if isinstance({{source}}, Unset) else (None, str({{source}}).encode(), "text/plain") -{% else %} -{{ destination }} = (None, str({{ source }}).encode(), "text/plain") -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{source}}).encode(), "text/plain"))) {% endmacro %} \ No newline at end of file diff --git a/openapi_python_client/templates/property_templates/boolean_property.py.jinja b/openapi_python_client/templates/property_templates/boolean_property.py.jinja index 52fda08e1..e2c3392a1 100644 --- a/openapi_python_client/templates/property_templates/boolean_property.py.jinja +++ b/openapi_python_client/templates/property_templates/boolean_property.py.jinja @@ -2,10 +2,6 @@ "true" if {{ source }} else "false" {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% if not property.required %} -{{ destination }} = {{source}} if isinstance({{source}}, Unset) else (None, str({{source}}).encode(), "text/plain") -{% else %} -{{ destination }} = (None, str({{ source }}).encode(), "text/plain") -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{source}}).encode(), "text/plain"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/const_property.py.jinja b/openapi_python_client/templates/property_templates/const_property.py.jinja index fa635b5b9..d348de0ff 100644 --- a/openapi_python_client/templates/property_templates/const_property.py.jinja +++ b/openapi_python_client/templates/property_templates/const_property.py.jinja @@ -3,3 +3,7 @@ if {{ property.python_name }} != {{ property.value.python_code }}{% if not property.required %}and not isinstance({{ property.python_name }}, Unset){% endif %}: raise ValueError(f"{{ property.name }} must match const {{ property.value.python_code }}, got '{{'{' + property.python_name + '}' }}'") {%- endmacro %} + +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, {{ source }}, "text/plain"))) +{% endmacro %} diff --git a/openapi_python_client/templates/property_templates/date_property.py.jinja b/openapi_python_client/templates/property_templates/date_property.py.jinja index b5da665f7..3ca8faee9 100644 --- a/openapi_python_client/templates/property_templates/date_property.py.jinja +++ b/openapi_python_client/templates/property_templates/date_property.py.jinja @@ -26,14 +26,6 @@ if not isinstance({{ source }}, Unset): {%- endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set transformed = source + ".isoformat().encode()" %} -{% if property.required %} -{{ destination }} = {{ transformed }} -{%- else %} -{% set type_annotation = property.get_type_string(json=True) | replace("str", "bytes") %} -{{ destination }}: {{ type_annotation }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} -{%- endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, {{ source }}.isoformat().encode(), "text/plain"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/datetime_property.py.jinja b/openapi_python_client/templates/property_templates/datetime_property.py.jinja index 32e3f2ee6..bf7e601d1 100644 --- a/openapi_python_client/templates/property_templates/datetime_property.py.jinja +++ b/openapi_python_client/templates/property_templates/datetime_property.py.jinja @@ -26,14 +26,6 @@ if not isinstance({{ source }}, Unset): {%- endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set transformed = source + ".isoformat().encode()" %} -{% if property.required %} -{{ destination }} = {{ transformed }} -{%- else %} -{% set type_annotation = property.get_type_string(json=True) | replace("str", "bytes") %} -{{ destination }}: {{ type_annotation }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} -{%- endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, {{ source }}.isoformat().encode(), "text/plain"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/enum_property.py.jinja b/openapi_python_client/templates/property_templates/enum_property.py.jinja index c46538eac..af8ca6eff 100644 --- a/openapi_python_client/templates/property_templates/enum_property.py.jinja +++ b/openapi_python_client/templates/property_templates/enum_property.py.jinja @@ -10,7 +10,7 @@ {% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.value_type.__name__ }}){% endmacro %} -{% macro transform(property, source, destination, declare_type=True, multipart=False) %} +{% macro transform(property, source, destination, declare_type=True) %} {% set transformed = source + ".value" %} {% set type_string = property.get_type_string(json=True) %} {% if property.required %} @@ -22,16 +22,8 @@ if not isinstance({{ source }}, Unset): {% endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set transformed = "(None, str(" + source + ".value" + ").encode(), \"text/plain\")" %} -{% set type_string = "Union[Unset, tuple[None, bytes, str]]" %} -{% if property.required %} -{{ destination }} = {{ transformed }} -{%- else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{ source }}.value).encode(), "text/plain"))) {% endmacro %} {% macro transform_header(source) %} diff --git a/openapi_python_client/templates/property_templates/file_property.py.jinja b/openapi_python_client/templates/property_templates/file_property.py.jinja index 8d27ae617..b08a13b46 100644 --- a/openapi_python_client/templates/property_templates/file_property.py.jinja +++ b/openapi_python_client/templates/property_templates/file_property.py.jinja @@ -22,12 +22,6 @@ if not isinstance({{ source }}, Unset): {% endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% if property.required %} -{{ destination }} = {{ source }}.to_tuple() -{% else %} -{{ destination }}: {{ property.get_type_string(json=True) }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ source }}.to_tuple() -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, {{ source }}.to_tuple())) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/float_property.py.jinja b/openapi_python_client/templates/property_templates/float_property.py.jinja index 12ffb0fb4..dc982cb68 100644 --- a/openapi_python_client/templates/property_templates/float_property.py.jinja +++ b/openapi_python_client/templates/property_templates/float_property.py.jinja @@ -2,10 +2,6 @@ str({{ source }}) {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% if not property.required %} -{{ destination }} = {{source}} if isinstance({{source}}, Unset) else (None, str({{source}}).encode(), "text/plain") -{% else %} -{{ destination }} = (None, str({{ source }}).encode(), "text/plain") -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{source}}).encode(), "text/plain"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/int_property.py.jinja b/openapi_python_client/templates/property_templates/int_property.py.jinja index 12ffb0fb4..dc982cb68 100644 --- a/openapi_python_client/templates/property_templates/int_property.py.jinja +++ b/openapi_python_client/templates/property_templates/int_property.py.jinja @@ -2,10 +2,6 @@ str({{ source }}) {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% if not property.required %} -{{ destination }} = {{source}} if isinstance({{source}}, Unset) else (None, str({{source}}).encode(), "text/plain") -{% else %} -{{ destination }} = (None, str({{ source }}).encode(), "text/plain") -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{source}}).encode(), "text/plain"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/list_property.py.jinja b/openapi_python_client/templates/property_templates/list_property.py.jinja index 94a9c6d65..60b93abd0 100644 --- a/openapi_python_client/templates/property_templates/list_property.py.jinja +++ b/openapi_python_client/templates/property_templates/list_property.py.jinja @@ -3,26 +3,28 @@ {% import "property_templates/" + inner_property.template as inner_template %} {% if inner_template.construct %} {% set inner_source = inner_property.python_name + "_data" %} +{% if property.required %} {{ property.python_name }} = [] _{{ property.python_name }} = {{ source }} -{% if property.required %} for {{ inner_source }} in (_{{ property.python_name }}): -{% else %} -for {{ inner_source }} in (_{{ property.python_name }} or []): -{% endif %} {{ inner_template.construct(inner_property, inner_source) | indent(4) }} {{ property.python_name }}.append({{ inner_property.python_name }}) {% else %} +_{{ property.python_name }} = {{ source }} +{{ property.python_name }}: {{ property.get_type_string() }} = UNSET +if _{{ property.python_name }} is not UNSET: + {{ property.python_name }} = [] + for {{ inner_source }} in _{{ property.python_name }}: + {{ inner_template.construct(inner_property, inner_source) | indent(8) }} + {{ property.python_name }}.append({{ inner_property.python_name }}) +{% endif %} +{% else %} {{ property.python_name }} = cast({{ property.get_type_string(no_optional=True) }}, {{ source }}) {% endif %} {% endmacro %} -{% macro _transform(property, source, destination, multipart, transform_method) %} +{% macro _transform(property, source, destination, transform_method) %} {% set inner_property = property.inner_property %} -{% if multipart %} -{% set multipart_destination = destination %} -{% set destination = "_temp_" + destination %} -{% endif %} {% import "property_templates/" + inner_property.template as inner_template %} {% if inner_template.transform %} {% set inner_source = inner_property.python_name + "_data" %} @@ -33,9 +35,6 @@ for {{ inner_source }} in {{ source }}: {% else %} {{ destination }} = {{ source }} {% endif %} -{% if multipart %} -{{ multipart_destination }} = (None, json.dumps({{ destination }}).encode(), 'application/json') -{% endif %} {% endmacro %} {% macro check_type_for_construct(property, source) %}isinstance({{ source }}, list){% endmacro %} @@ -44,34 +43,18 @@ for {{ inner_source }} in {{ source }}: {% set inner_property = property.inner_property %} {% set type_string = property.get_type_string(json=True) %} {% if property.required %} -{{ _transform(property, source, destination, False, "to_dict") }} +{{ _transform(property, source, destination, "to_dict") }} {% else %} {{ destination }}{% if declare_type %}: {{ type_string }}{% endif %} = UNSET if not isinstance({{ source }}, Unset): - {{ _transform(property, source, destination, False, "to_dict") | indent(4)}} + {{ _transform(property, source, destination, "to_dict") | indent(4)}} {% endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} +{% macro multipart(property, source, destination) %} {% set inner_property = property.inner_property %} -{% set type_string = "Union[Unset, tuple[None, bytes, str]]" %} -{% if property.required %} -{{ _transform(property, source, destination, True, "to_dict") }} -{% else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ _transform(property, source, destination, True, "to_dict") | indent(4)}} -{% endif %} -{% endmacro %} - -{% macro transform_multipart_body(property, source, destination) %} -{% set inner_property = property.inner_property %} -{% set type_string = property.get_type_string(json=True) %} -{% if property.required %} -{{ _transform(property, source, destination, False, "to_multipart") }} -{% else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ _transform(property, source, destination, False, "to_multipart") | indent(4)}} -{% endif %} +{% import "property_templates/" + inner_property.template as inner_template %} +{% set inner_source = inner_property.python_name + "_element" %} +for {{ inner_source }} in {{ source }}: + {{ inner_template.multipart(inner_property, inner_source, destination) | indent(4) }} {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja b/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja index 1506284d7..2cc4558c6 100644 --- a/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja +++ b/openapi_python_client/templates/property_templates/literal_enum_property.py.jinja @@ -10,7 +10,7 @@ check_{{ property.get_class_name_snake_case() }}({{ source }}) {% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.get_instance_type_string() }}){% endmacro %} -{% macro transform(property, source, destination, declare_type=True, multipart=False) %} +{% macro transform(property, source, destination, declare_type=True) %} {% set type_string = property.get_type_string(json=True) %} {% if property.required %} {{ destination }}{% if declare_type %}: {{ type_string }}{% endif %} = {{ source }} @@ -21,16 +21,8 @@ if not isinstance({{ source }}, Unset): {% endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set transformed = "(None, str(" + source + ").encode(), \"text/plain\")" %} -{% set type_string = "Union[Unset, tuple[None, bytes, str]]" %} -{% if property.required %} -{{ destination }} = {{ transformed }} -{%- else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} -{% endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{ source }}).encode(), "text/plain"))) {% endmacro %} {% macro transform_header(source) %} diff --git a/openapi_python_client/templates/property_templates/model_property.py.jinja b/openapi_python_client/templates/property_templates/model_property.py.jinja index 308b7478b..d1a4b5d34 100644 --- a/openapi_python_client/templates/property_templates/model_property.py.jinja +++ b/openapi_python_client/templates/property_templates/model_property.py.jinja @@ -22,26 +22,16 @@ if not isinstance({{ source }}, Unset): {%- endif %} {% endmacro %} -{% macro transform_multipart_body(property, source, destination) %} -{% set transformed = source + ".to_multipart()" %} -{% set type_string = property.get_type_string(multipart=True) %} +{% macro transform_multipart_body(property) %} +{% set transformed = property.python_name + ".to_multipart()" %} {% if property.required %} -{{ destination }} = {{ transformed }} +_kwargs["files"] = {{ transformed }} {%- else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} +if not isinstance({{ property.python_name }}, Unset): + _kwargs["files"] = {{ transformed }} {%- endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set transformed = "(None, json.dumps(" + source + ".to_dict()" + ").encode(), 'application/json')" %} -{% set type_string = property.get_type_string(multipart=True) %} -{% if property.required %} -{{ destination }} = {{ transformed }} -{%- else %} -{{ destination }}: {{ type_string }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = {{ transformed }} -{%- endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, json.dumps( {{source}}.to_dict()).encode(), "application/json"))) {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/union_property.py.jinja b/openapi_python_client/templates/property_templates/union_property.py.jinja index dbf7ee9dc..e21e08808 100644 --- a/openapi_python_client/templates/property_templates/union_property.py.jinja +++ b/openapi_python_client/templates/property_templates/union_property.py.jinja @@ -1,10 +1,10 @@ {% macro construct(property, source) %} def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_string() }}: - {% if "None" in property.get_type_strings_in_union(json=True, multipart=False) %} + {% if "None" in property.get_type_strings_in_union(json=True) %} if data is None: return data {% endif %} - {% if "Unset" in property.get_type_strings_in_union(json=True, multipart=False) %} + {% if "Unset" in property.get_type_strings_in_union(json=True) %} if isinstance(data, Unset): return data {% endif %} @@ -21,7 +21,7 @@ def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_stri raise TypeError() {{ inner_template.construct(inner_property, "data") | indent(8) }} return {{ inner_property.python_name }} - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass {% else %}{# Don't do try/except for the last one nor any properties with no type checking #} {% if inner_template.check_type_for_construct %} @@ -41,7 +41,7 @@ def _parse_{{ property.python_name }}(data: object) -> {{ property.get_type_stri {% macro transform(property, source, destination, declare_type=True) %} {% set ns = namespace(contains_properties_without_transform = false, contains_modified_properties = not property.required, has_if = false) %} -{% if declare_type %}{{ destination }}: {{ property.get_type_string(json=True, multipart=False) }}{% endif %} +{% if declare_type %}{{ destination }}: {{ property.get_type_string(json=True) }}{% endif %} {% if not property.required %} if isinstance({{ source }}, Unset): @@ -75,25 +75,28 @@ else: {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% set ns = namespace(has_if = false) %} -{{ destination }}: {{ property.get_type_string(json=False, multipart=True) }} - -{% if not property.required %} -if isinstance({{ source }}, Unset): - {{ destination }} = UNSET - {% set ns.has_if = true %} +{% macro instance_check(inner_property, source) %} +{% if inner_property.get_instance_type_string() == "None" %} +if {{ source }} is None: +{% else %} +if isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}): {% endif %} +{% endmacro %} + +{% macro multipart(property, source, destination) %} +{% set ns = namespace(has_if = false) %} {% for inner_property in property.inner_properties %} {% if not ns.has_if %} -if isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}): +{{ instance_check(inner_property, source) }} {% set ns.has_if = true %} {% elif not loop.last %} -elif isinstance({{ source }}, {{ inner_property.get_instance_type_string() }}): + +el{{ instance_check(inner_property, source) }} {% else %} + else: {% endif %} {% import "property_templates/" + inner_property.template as inner_template %} - {{ inner_template.transform_multipart(inner_property, source, destination) | indent(4) | trim }} -{% endfor %} + {{ inner_template.multipart(inner_property, source, destination) | indent(4) | trim }} +{%- endfor -%} {% endmacro %} diff --git a/openapi_python_client/templates/property_templates/uuid_property.py.jinja b/openapi_python_client/templates/property_templates/uuid_property.py.jinja index 1f91c1e3a..3a6ce46bb 100644 --- a/openapi_python_client/templates/property_templates/uuid_property.py.jinja +++ b/openapi_python_client/templates/property_templates/uuid_property.py.jinja @@ -26,13 +26,6 @@ if not isinstance({{ source }}, Unset): {%- endif %} {% endmacro %} -{% macro transform_multipart(property, source, destination) %} -{% if property.required %} -{{ destination }} = str({{ source }}) -{%- else %} -{% set type_annotation = property.get_type_string(json=True) | replace("str", "bytes") %} -{{ destination }}: {{ type_annotation }} = UNSET -if not isinstance({{ source }}, Unset): - {{ destination }} = str({{ source }}) -{%- endif %} +{% macro multipart(property, source, name) %} +files.append(({{ name }}, (None, str({{ source }}), "text/plain")) {% endmacro %} diff --git a/openapi_python_client/templates/pyproject.toml.jinja b/openapi_python_client/templates/pyproject.toml.jinja index e9344b436..9f21f8043 100644 --- a/openapi_python_client/templates/pyproject.toml.jinja +++ b/openapi_python_client/templates/pyproject.toml.jinja @@ -1,49 +1,9 @@ -{% set poetry = meta == "poetry" %} -{% set pdm = meta == "pdm" %} -{% if poetry or pdm %} -{% if poetry %}[tool.poetry] -{% elif pdm %}[project] +{% if meta == "poetry" %} +{% include "pyproject_poetry.toml.jinja" %} +{% elif meta == "pdm" %} +{% include "pyproject_pdm.toml.jinja" %} +{% elif meta == "uv" %} +{% include "pyproject_uv.toml.jinja" %} {% endif %} -name = "{{ project_name }}" -version = "{{ package_version }}" -description = "{{ package_description }}" -authors = [] -readme = "README.md" -{% if pdm %}requires-python = ">=3.9,<4.0"{% endif %} -{% if poetry %} -packages = [ - {include = "{{ package_name }}"}, -] -include = ["CHANGELOG.md", "{{ package_name }}/py.typed"] -{% endif %} - -{% if pdm %} -dependencies = [ - "httpx>=0.20.0,<0.29.0", - "attrs>=22.2.0", - "python-dateutil>=2.8.0", -] - -[tool.pdm] -distribution = true -{% endif %} -{% if poetry %} - -[tool.poetry.dependencies] -python = "^3.9" -httpx = ">=0.20.0,<0.29.0" -attrs = ">=22.2.0" -python-dateutil = "^2.8.0" -{% endif %} - -[build-system] -{% if poetry %} -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" -{% elif pdm %} -requires = ["pdm-backend"] -build-backend = "pdm.backend" -{% endif %} -{% endif %}{# poetry or pdm #} {% include "pyproject_ruff.toml.jinja" %} diff --git a/openapi_python_client/templates/pyproject_pdm.toml.jinja b/openapi_python_client/templates/pyproject_pdm.toml.jinja new file mode 100644 index 000000000..afdb7ce3a --- /dev/null +++ b/openapi_python_client/templates/pyproject_pdm.toml.jinja @@ -0,0 +1,19 @@ +[project] +name = "{{ project_name }}" +version = "{{ package_version }}" +description = "{{ package_description }}" +authors = [] +readme = "README.md" +requires-python = ">=3.10" +dependencies = [ + "httpx>=0.23.0,<0.29.0", + "attrs>=22.2.0", + "python-dateutil>=2.8.0", +] + +[tool.pdm] +distribution = true + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" diff --git a/openapi_python_client/templates/pyproject_poetry.toml.jinja b/openapi_python_client/templates/pyproject_poetry.toml.jinja new file mode 100644 index 000000000..8585b6d89 --- /dev/null +++ b/openapi_python_client/templates/pyproject_poetry.toml.jinja @@ -0,0 +1,20 @@ +[tool.poetry] +name = "{{ project_name }}" +version = "{{ package_version }}" +description = "{{ package_description }}" +authors = [] +readme = "README.md" +packages = [ + { include = "{{ package_name }}" }, +] +include = ["{{ package_name }}/py.typed"] + +[tool.poetry.dependencies] +python = "^3.10" +httpx = ">=0.23.0,<0.29.0" +attrs = ">=22.2.0" +python-dateutil = "^2.8.0" + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/openapi_python_client/templates/pyproject_uv.toml.jinja b/openapi_python_client/templates/pyproject_uv.toml.jinja new file mode 100644 index 000000000..ef6cda77b --- /dev/null +++ b/openapi_python_client/templates/pyproject_uv.toml.jinja @@ -0,0 +1,20 @@ +[project] +name = "{{ project_name }}" +version = "{{ package_version }}" +description = "{{ package_description }}" +authors = [] +requires-python = ">=3.10" +readme = "README.md" +dependencies = [ + "httpx>=0.23.0,<0.29.0", + "attrs>=22.2.0", + "python-dateutil>=2.8.0,<3", +] + +[tool.uv.build-backend] +module-name = "{{ package_name }}" +module-root = "" + +[build-system] +requires = ["uv_build>=0.9.0,<0.10.0"] +build-backend = "uv_build" diff --git a/openapi_python_client/templates/setup.py.jinja b/openapi_python_client/templates/setup.py.jinja index c7c1a5a94..8c9b060c4 100644 --- a/openapi_python_client/templates/setup.py.jinja +++ b/openapi_python_client/templates/setup.py.jinja @@ -12,7 +12,7 @@ setup( long_description=long_description, long_description_content_type="text/markdown", packages=find_packages(), - python_requires=">=3.9, <4", - install_requires=["httpx >= 0.20.0, < 0.29.0", "attrs >= 22.2.0", "python-dateutil >= 2.8.0, < 3"], + python_requires=">=3.10, <4", + install_requires=["httpx >= 0.23.0, < 0.29.0", "attrs >= 22.2.0", "python-dateutil >= 2.8.0, < 3"], package_data={"{{ package_name }}": ["py.typed"]}, ) diff --git a/openapi_python_client/templates/types.py.jinja b/openapi_python_client/templates/types.py.jinja index 6e0d6206c..f74db0ad7 100644 --- a/openapi_python_client/templates/types.py.jinja +++ b/openapi_python_client/templates/types.py.jinja @@ -1,8 +1,8 @@ """ Contains some shared types for properties """ -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Optional, TypeVar, Literal +from typing import BinaryIO, Generic, TypeVar, Literal, IO from attrs import define @@ -14,19 +14,25 @@ class Unset: UNSET: Unset = Unset() -{# Used as `FileProperty._json_type_string` #} -FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]] - +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define class File: """ Contains information for file uploads """ payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """ Return a tuple representation that httpx will accept for multipart/form-data """ return self.file_name, self.payload, self.mime_type @@ -41,7 +47,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/pdm.lock b/pdm.lock index 2697fff68..0b906ec29 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,10 +5,10 @@ groups = ["default", "dev"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:7f8035cfb12eec0bca9053eb34cc6b70a1cfbf464921c1abb3ae3c3e63cfeab4" +content_hash = "sha256:212db8a08bde76b34c4afbc1c08f61a2d16facb7ea0525861120ad1185da2d51" [[metadata.targets]] -requires_python = "~=3.9" +requires_python = "~=3.10" [[package]] name = "annotated-types" @@ -26,9 +26,9 @@ files = [ [[package]] name = "anyio" -version = "4.7.0" +version = "4.11.0" requires_python = ">=3.9" -summary = "High level compatibility layer for multiple asynchronous event loop implementations" +summary = "High-level concurrency and networking framework on top of asyncio or Trio" groups = ["default"] dependencies = [ "exceptiongroup>=1.0.2; python_version < \"3.11\"", @@ -37,45 +37,44 @@ dependencies = [ "typing-extensions>=4.5; python_version < \"3.13\"", ] files = [ - {file = "anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352"}, - {file = "anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48"}, + {file = "anyio-4.11.0-py3-none-any.whl", hash = "sha256:0287e96f4d26d4149305414d4e3bc32f0dcd0862365a4bddea19d7a1ec38c4fc"}, + {file = "anyio-4.11.0.tar.gz", hash = "sha256:82a8d0b81e318cc5ce71a5f1f8b5c4e63619620b63141ef8c995fa0db95a57c4"}, ] [[package]] name = "attrs" -version = "24.3.0" -requires_python = ">=3.8" +version = "25.4.0" +requires_python = ">=3.9" summary = "Classes Without Boilerplate" groups = ["default"] files = [ - {file = "attrs-24.3.0-py3-none-any.whl", hash = "sha256:ac96cd038792094f438ad1f6ff80837353805ac950cd2aa0e0625ef19850c308"}, - {file = "attrs-24.3.0.tar.gz", hash = "sha256:8f5c07333d543103541ba7be0e2ce16eeee8130cb0b3f9238ab904ce1e85baff"}, + {file = "attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373"}, + {file = "attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11"}, ] [[package]] name = "certifi" -version = "2024.12.14" -requires_python = ">=3.6" +version = "2025.10.5" +requires_python = ">=3.7" summary = "Python package for providing Mozilla's CA Bundle." groups = ["default"] files = [ - {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, - {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, + {file = "certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de"}, + {file = "certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43"}, ] [[package]] name = "click" -version = "8.1.8" -requires_python = ">=3.7" +version = "8.3.0" +requires_python = ">=3.10" summary = "Composable command line interface toolkit" groups = ["default"] dependencies = [ "colorama; platform_system == \"Windows\"", - "importlib-metadata; python_version < \"3.8\"", ] files = [ - {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, - {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, + {file = "click-8.3.0-py3-none-any.whl", hash = "sha256:9b9f285302c6e3064f4330c05f05b81945b2a39544279343e6e7c5f27a9baddc"}, + {file = "click-8.3.0.tar.gz", hash = "sha256:e7b8232224eba16f4ebe410c25ced9f7875cb5f3263ffc93cc3e8da705e229c4"}, ] [[package]] @@ -92,190 +91,250 @@ files = [ [[package]] name = "coverage" -version = "7.6.10" -requires_python = ">=3.9" +version = "7.11.0" +requires_python = ">=3.10" summary = "Code coverage measurement for Python" groups = ["dev"] files = [ - {file = "coverage-7.6.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5c912978f7fbf47ef99cec50c4401340436d200d41d714c7a4766f377c5b7b78"}, - {file = "coverage-7.6.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a01ec4af7dfeb96ff0078ad9a48810bb0cc8abcb0115180c6013a6b26237626c"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3b204c11e2b2d883946fe1d97f89403aa1811df28ce0447439178cc7463448a"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32ee6d8491fcfc82652a37109f69dee9a830e9379166cb73c16d8dc5c2915165"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:675cefc4c06e3b4c876b85bfb7c59c5e2218167bbd4da5075cbe3b5790a28988"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f4f620668dbc6f5e909a0946a877310fb3d57aea8198bde792aae369ee1c23b5"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:4eea95ef275de7abaef630c9b2c002ffbc01918b726a39f5a4353916ec72d2f3"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e2f0280519e42b0a17550072861e0bc8a80a0870de260f9796157d3fca2733c5"}, - {file = "coverage-7.6.10-cp310-cp310-win32.whl", hash = "sha256:bc67deb76bc3717f22e765ab3e07ee9c7a5e26b9019ca19a3b063d9f4b874244"}, - {file = "coverage-7.6.10-cp310-cp310-win_amd64.whl", hash = "sha256:0f460286cb94036455e703c66988851d970fdfd8acc2a1122ab7f4f904e4029e"}, - {file = "coverage-7.6.10-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ea3c8f04b3e4af80e17bab607c386a830ffc2fb88a5484e1df756478cf70d1d3"}, - {file = "coverage-7.6.10-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:507a20fc863cae1d5720797761b42d2d87a04b3e5aeb682ef3b7332e90598f43"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d37a84878285b903c0fe21ac8794c6dab58150e9359f1aaebbeddd6412d53132"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a534738b47b0de1995f85f582d983d94031dffb48ab86c95bdf88dc62212142f"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d7a2bf79378d8fb8afaa994f91bfd8215134f8631d27eba3e0e2c13546ce994"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6713ba4b4ebc330f3def51df1d5d38fad60b66720948112f114968feb52d3f99"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:ab32947f481f7e8c763fa2c92fd9f44eeb143e7610c4ca9ecd6a36adab4081bd"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7bbd8c8f1b115b892e34ba66a097b915d3871db7ce0e6b9901f462ff3a975377"}, - {file = "coverage-7.6.10-cp311-cp311-win32.whl", hash = "sha256:299e91b274c5c9cdb64cbdf1b3e4a8fe538a7a86acdd08fae52301b28ba297f8"}, - {file = "coverage-7.6.10-cp311-cp311-win_amd64.whl", hash = "sha256:489a01f94aa581dbd961f306e37d75d4ba16104bbfa2b0edb21d29b73be83609"}, - {file = "coverage-7.6.10-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:27c6e64726b307782fa5cbe531e7647aee385a29b2107cd87ba7c0105a5d3853"}, - {file = "coverage-7.6.10-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c56e097019e72c373bae32d946ecf9858fda841e48d82df7e81c63ac25554078"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c7827a5bc7bdb197b9e066cdf650b2887597ad124dd99777332776f7b7c7d0d0"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:204a8238afe787323a8b47d8be4df89772d5c1e4651b9ffa808552bdf20e1d50"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e67926f51821b8e9deb6426ff3164870976fe414d033ad90ea75e7ed0c2e5022"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e78b270eadb5702938c3dbe9367f878249b5ef9a2fcc5360ac7bff694310d17b"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:714f942b9c15c3a7a5fe6876ce30af831c2ad4ce902410b7466b662358c852c0"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:abb02e2f5a3187b2ac4cd46b8ced85a0858230b577ccb2c62c81482ca7d18852"}, - {file = "coverage-7.6.10-cp312-cp312-win32.whl", hash = "sha256:55b201b97286cf61f5e76063f9e2a1d8d2972fc2fcfd2c1272530172fd28c359"}, - {file = "coverage-7.6.10-cp312-cp312-win_amd64.whl", hash = "sha256:e4ae5ac5e0d1e4edfc9b4b57b4cbecd5bc266a6915c500f358817a8496739247"}, - {file = "coverage-7.6.10-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:05fca8ba6a87aabdd2d30d0b6c838b50510b56cdcfc604d40760dae7153b73d9"}, - {file = "coverage-7.6.10-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9e80eba8801c386f72e0712a0453431259c45c3249f0009aff537a517b52942b"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a372c89c939d57abe09e08c0578c1d212e7a678135d53aa16eec4430adc5e690"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ec22b5e7fe7a0fa8509181c4aac1db48f3dd4d3a566131b313d1efc102892c18"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26bcf5c4df41cad1b19c84af71c22cbc9ea9a547fc973f1f2cc9a290002c8b3c"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e4630c26b6084c9b3cb53b15bd488f30ceb50b73c35c5ad7871b869cb7365fd"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2396e8116db77789f819d2bc8a7e200232b7a282c66e0ae2d2cd84581a89757e"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:79109c70cc0882e4d2d002fe69a24aa504dec0cc17169b3c7f41a1d341a73694"}, - {file = "coverage-7.6.10-cp313-cp313-win32.whl", hash = "sha256:9e1747bab246d6ff2c4f28b4d186b205adced9f7bd9dc362051cc37c4a0c7bd6"}, - {file = "coverage-7.6.10-cp313-cp313-win_amd64.whl", hash = "sha256:254f1a3b1eef5f7ed23ef265eaa89c65c8c5b6b257327c149db1ca9d4a35f25e"}, - {file = "coverage-7.6.10-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2ccf240eb719789cedbb9fd1338055de2761088202a9a0b73032857e53f612fe"}, - {file = "coverage-7.6.10-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:0c807ca74d5a5e64427c8805de15b9ca140bba13572d6d74e262f46f50b13273"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2bcfa46d7709b5a7ffe089075799b902020b62e7ee56ebaed2f4bdac04c508d8"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e0de1e902669dccbf80b0415fb6b43d27edca2fbd48c74da378923b05316098"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f7b444c42bbc533aaae6b5a2166fd1a797cdb5eb58ee51a92bee1eb94a1e1cb"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b330368cb99ef72fcd2dc3ed260adf67b31499584dc8a20225e85bfe6f6cfed0"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:9a7cfb50515f87f7ed30bc882f68812fd98bc2852957df69f3003d22a2aa0abf"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f93531882a5f68c28090f901b1d135de61b56331bba82028489bc51bdd818d2"}, - {file = "coverage-7.6.10-cp313-cp313t-win32.whl", hash = "sha256:89d76815a26197c858f53c7f6a656686ec392b25991f9e409bcef020cd532312"}, - {file = "coverage-7.6.10-cp313-cp313t-win_amd64.whl", hash = "sha256:54a5f0f43950a36312155dae55c505a76cd7f2b12d26abeebbe7a0b36dbc868d"}, - {file = "coverage-7.6.10-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:656c82b8a0ead8bba147de9a89bda95064874c91a3ed43a00e687f23cc19d53a"}, - {file = "coverage-7.6.10-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ccc2b70a7ed475c68ceb548bf69cec1e27305c1c2606a5eb7c3afff56a1b3b27"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5e37dc41d57ceba70956fa2fc5b63c26dba863c946ace9705f8eca99daecdc4"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0aa9692b4fdd83a4647eeb7db46410ea1322b5ed94cd1715ef09d1d5922ba87f"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa744da1820678b475e4ba3dfd994c321c5b13381d1041fe9c608620e6676e25"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c0b1818063dc9e9d838c09e3a473c1422f517889436dd980f5d721899e66f315"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:59af35558ba08b758aec4d56182b222976330ef8d2feacbb93964f576a7e7a90"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7ed2f37cfce1ce101e6dffdfd1c99e729dd2ffc291d02d3e2d0af8b53d13840d"}, - {file = "coverage-7.6.10-cp39-cp39-win32.whl", hash = "sha256:4bcc276261505d82f0ad426870c3b12cb177752834a633e737ec5ee79bbdff18"}, - {file = "coverage-7.6.10-cp39-cp39-win_amd64.whl", hash = "sha256:457574f4599d2b00f7f637a0700a6422243b3565509457b2dbd3f50703e11f59"}, - {file = "coverage-7.6.10-pp39.pp310-none-any.whl", hash = "sha256:fd34e7b3405f0cc7ab03d54a334c17a9e802897580d964bd8c2001f4b9fd488f"}, - {file = "coverage-7.6.10.tar.gz", hash = "sha256:7fb105327c8f8f0682e29843e2ff96af9dcbe5bab8eeb4b398c6a33a16d80a23"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eb53f1e8adeeb2e78962bade0c08bfdc461853c7969706ed901821e009b35e31"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d9a03ec6cb9f40a5c360f138b88266fd8f58408d71e89f536b4f91d85721d075"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0d7f0616c557cbc3d1c2090334eddcbb70e1ae3a40b07222d62b3aa47f608fab"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e44a86a47bbdf83b0a3ea4d7df5410d6b1a0de984fbd805fa5101f3624b9abe0"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:596763d2f9a0ee7eec6e643e29660def2eef297e1de0d334c78c08706f1cb785"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef55537ff511b5e0a43edb4c50a7bf7ba1c3eea20b4f49b1490f1e8e0e42c591"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9cbabd8f4d0d3dc571d77ae5bdbfa6afe5061e679a9d74b6797c48d143307088"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e24045453384e0ae2a587d562df2a04d852672eb63051d16096d3f08aa4c7c2f"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:7161edd3426c8d19bdccde7d49e6f27f748f3c31cc350c5de7c633fea445d866"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d4ed4de17e692ba6415b0587bc7f12bc80915031fc9db46a23ce70fc88c9841"}, + {file = "coverage-7.11.0-cp310-cp310-win32.whl", hash = "sha256:765c0bc8fe46f48e341ef737c91c715bd2a53a12792592296a095f0c237e09cf"}, + {file = "coverage-7.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:24d6f3128f1b2d20d84b24f4074475457faedc3d4613a7e66b5e769939c7d969"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d58ecaa865c5b9fa56e35efc51d1014d4c0d22838815b9fce57a27dd9576847"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b679e171f1c104a5668550ada700e3c4937110dbdd153b7ef9055c4f1a1ee3cc"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ca61691ba8c5b6797deb221a0d09d7470364733ea9c69425a640f1f01b7c5bf0"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aef1747ede4bd8ca9cfc04cc3011516500c6891f1b33a94add3253f6f876b7b7"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1839d08406e4cba2953dcc0ffb312252f14d7c4c96919f70167611f4dee2623"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e0eb0a2dcc62478eb5b4cbb80b97bdee852d7e280b90e81f11b407d0b81c4287"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bc1fbea96343b53f65d5351d8fd3b34fd415a2670d7c300b06d3e14a5af4f552"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:214b622259dd0cf435f10241f1333d32caa64dbc27f8790ab693428a141723de"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:258d9967520cca899695d4eb7ea38be03f06951d6ca2f21fb48b1235f791e601"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cf9e6ff4ca908ca15c157c409d608da77a56a09877b97c889b98fb2c32b6465e"}, + {file = "coverage-7.11.0-cp311-cp311-win32.whl", hash = "sha256:fcc15fc462707b0680cff6242c48625da7f9a16a28a41bb8fd7a4280920e676c"}, + {file = "coverage-7.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:865965bf955d92790f1facd64fe7ff73551bd2c1e7e6b26443934e9701ba30b9"}, + {file = "coverage-7.11.0-cp311-cp311-win_arm64.whl", hash = "sha256:5693e57a065760dcbeb292d60cc4d0231a6d4b6b6f6a3191561e1d5e8820b745"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:9c49e77811cf9d024b95faf86c3f059b11c0c9be0b0d61bc598f453703bd6fd1"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a61e37a403a778e2cda2a6a39abcc895f1d984071942a41074b5c7ee31642007"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c79cae102bb3b1801e2ef1511fb50e91ec83a1ce466b2c7c25010d884336de46"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:16ce17ceb5d211f320b62df002fa7016b7442ea0fd260c11cec8ce7730954893"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:80027673e9d0bd6aef86134b0771845e2da85755cf686e7c7c59566cf5a89115"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d3ffa07a08657306cd2215b0da53761c4d73cb54d9143b9303a6481ec0cd415"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a3b6a5f8b2524fd6c1066bc85bfd97e78709bb5e37b5b94911a6506b65f47186"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fcc0a4aa589de34bc56e1a80a740ee0f8c47611bdfb28cd1849de60660f3799d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:dba82204769d78c3fd31b35c3d5f46e06511936c5019c39f98320e05b08f794d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:81b335f03ba67309a95210caf3eb43bd6fe75a4e22ba653ef97b4696c56c7ec2"}, + {file = "coverage-7.11.0-cp312-cp312-win32.whl", hash = "sha256:037b2d064c2f8cc8716fe4d39cb705779af3fbf1ba318dc96a1af858888c7bb5"}, + {file = "coverage-7.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:d66c0104aec3b75e5fd897e7940188ea1892ca1d0235316bf89286d6a22568c0"}, + {file = "coverage-7.11.0-cp312-cp312-win_arm64.whl", hash = "sha256:d91ebeac603812a09cf6a886ba6e464f3bbb367411904ae3790dfe28311b15ad"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:cc3f49e65ea6e0d5d9bd60368684fe52a704d46f9e7fc413918f18d046ec40e1"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f39ae2f63f37472c17b4990f794035c9890418b1b8cca75c01193f3c8d3e01be"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7db53b5cdd2917b6eaadd0b1251cf4e7d96f4a8d24e174bdbdf2f65b5ea7994d"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10ad04ac3a122048688387828b4537bc9cf60c0bf4869c1e9989c46e45690b82"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4036cc9c7983a2b1f2556d574d2eb2154ac6ed55114761685657e38782b23f52"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7ab934dd13b1c5e94b692b1e01bd87e4488cb746e3a50f798cb9464fd128374b"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59a6e5a265f7cfc05f76e3bb53eca2e0dfe90f05e07e849930fecd6abb8f40b4"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:df01d6c4c81e15a7c88337b795bb7595a8596e92310266b5072c7e301168efbd"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:8c934bd088eed6174210942761e38ee81d28c46de0132ebb1801dbe36a390dcc"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5a03eaf7ec24078ad64a07f02e30060aaf22b91dedf31a6b24d0d98d2bba7f48"}, + {file = "coverage-7.11.0-cp313-cp313-win32.whl", hash = "sha256:695340f698a5f56f795b2836abe6fb576e7c53d48cd155ad2f80fd24bc63a040"}, + {file = "coverage-7.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:2727d47fce3ee2bac648528e41455d1b0c46395a087a229deac75e9f88ba5a05"}, + {file = "coverage-7.11.0-cp313-cp313-win_arm64.whl", hash = "sha256:0efa742f431529699712b92ecdf22de8ff198df41e43aeaaadf69973eb93f17a"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:587c38849b853b157706407e9ebdca8fd12f45869edb56defbef2daa5fb0812b"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b971bdefdd75096163dd4261c74be813c4508477e39ff7b92191dea19f24cd37"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:269bfe913b7d5be12ab13a95f3a76da23cf147be7fa043933320ba5625f0a8de"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dadbcce51a10c07b7c72b0ce4a25e4b6dcb0c0372846afb8e5b6307a121eb99f"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ed43fa22c6436f7957df036331f8fe4efa7af132054e1844918866cd228af6c"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9516add7256b6713ec08359b7b05aeff8850c98d357784c7205b2e60aa2513fa"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:eb92e47c92fcbcdc692f428da67db33337fa213756f7adb6a011f7b5a7a20740"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:d06f4fc7acf3cabd6d74941d53329e06bab00a8fe10e4df2714f0b134bfc64ef"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:6fbcee1a8f056af07ecd344482f711f563a9eb1c2cad192e87df00338ec3cdb0"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dbbf012be5f32533a490709ad597ad8a8ff80c582a95adc8d62af664e532f9ca"}, + {file = "coverage-7.11.0-cp313-cp313t-win32.whl", hash = "sha256:cee6291bb4fed184f1c2b663606a115c743df98a537c969c3c64b49989da96c2"}, + {file = "coverage-7.11.0-cp313-cp313t-win_amd64.whl", hash = "sha256:a386c1061bf98e7ea4758e4313c0ab5ecf57af341ef0f43a0bf26c2477b5c268"}, + {file = "coverage-7.11.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f9ea02ef40bb83823b2b04964459d281688fe173e20643870bb5d2edf68bc836"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c770885b28fb399aaf2a65bbd1c12bf6f307ffd112d6a76c5231a94276f0c497"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a3d0e2087dba64c86a6b254f43e12d264b636a39e88c5cc0a01a7c71bcfdab7e"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:73feb83bb41c32811973b8565f3705caf01d928d972b72042b44e97c71fd70d1"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c6f31f281012235ad08f9a560976cc2fc9c95c17604ff3ab20120fe480169bca"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9570ad567f880ef675673992222746a124b9595506826b210fbe0ce3f0499cd"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8badf70446042553a773547a61fecaa734b55dc738cacf20c56ab04b77425e43"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a09c1211959903a479e389685b7feb8a17f59ec5a4ef9afde7650bd5eabc2777"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:5ef83b107f50db3f9ae40f69e34b3bd9337456c5a7fe3461c7abf8b75dd666a2"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:f91f927a3215b8907e214af77200250bb6aae36eca3f760f89780d13e495388d"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:cdbcd376716d6b7fbfeedd687a6c4be019c5a5671b35f804ba76a4c0a778cba4"}, + {file = "coverage-7.11.0-cp314-cp314-win32.whl", hash = "sha256:bab7ec4bb501743edc63609320aaec8cd9188b396354f482f4de4d40a9d10721"}, + {file = "coverage-7.11.0-cp314-cp314-win_amd64.whl", hash = "sha256:3d4ba9a449e9364a936a27322b20d32d8b166553bfe63059bd21527e681e2fad"}, + {file = "coverage-7.11.0-cp314-cp314-win_arm64.whl", hash = "sha256:ce37f215223af94ef0f75ac68ea096f9f8e8c8ec7d6e8c346ee45c0d363f0479"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:f413ce6e07e0d0dc9c433228727b619871532674b45165abafe201f200cc215f"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:05791e528a18f7072bf5998ba772fe29db4da1234c45c2087866b5ba4dea710e"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cacb29f420cfeb9283b803263c3b9a068924474ff19ca126ba9103e1278dfa44"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:314c24e700d7027ae3ab0d95fbf8d53544fca1f20345fd30cd219b737c6e58d3"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:630d0bd7a293ad2fc8b4b94e5758c8b2536fdf36c05f1681270203e463cbfa9b"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e89641f5175d65e2dbb44db15fe4ea48fade5d5bbb9868fdc2b4fce22f4a469d"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c9f08ea03114a637dab06cedb2e914da9dc67fa52c6015c018ff43fdde25b9c2"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce9f3bde4e9b031eaf1eb61df95c1401427029ea1bfddb8621c1161dcb0fa02e"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:e4dc07e95495923d6fd4d6c27bf70769425b71c89053083843fd78f378558996"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:424538266794db2861db4922b05d729ade0940ee69dcf0591ce8f69784db0e11"}, + {file = "coverage-7.11.0-cp314-cp314t-win32.whl", hash = "sha256:4c1eeb3fb8eb9e0190bebafd0462936f75717687117339f708f395fe455acc73"}, + {file = "coverage-7.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b56efee146c98dbf2cf5cffc61b9829d1e94442df4d7398b26892a53992d3547"}, + {file = "coverage-7.11.0-cp314-cp314t-win_arm64.whl", hash = "sha256:b5c2705afa83f49bd91962a4094b6b082f94aef7626365ab3f8f4bd159c5acf3"}, + {file = "coverage-7.11.0-py3-none-any.whl", hash = "sha256:4b7589765348d78fb4e5fb6ea35d07564e387da2fc5efff62e0222971f155f68"}, + {file = "coverage-7.11.0.tar.gz", hash = "sha256:167bd504ac1ca2af7ff3b81d245dfea0292c5032ebef9d66cc08a7d28c1b8050"}, ] [[package]] name = "coverage" -version = "7.6.10" +version = "7.11.0" extras = ["toml"] -requires_python = ">=3.9" +requires_python = ">=3.10" summary = "Code coverage measurement for Python" groups = ["dev"] dependencies = [ - "coverage==7.6.10", + "coverage==7.11.0", "tomli; python_full_version <= \"3.11.0a6\"", ] files = [ - {file = "coverage-7.6.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5c912978f7fbf47ef99cec50c4401340436d200d41d714c7a4766f377c5b7b78"}, - {file = "coverage-7.6.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a01ec4af7dfeb96ff0078ad9a48810bb0cc8abcb0115180c6013a6b26237626c"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3b204c11e2b2d883946fe1d97f89403aa1811df28ce0447439178cc7463448a"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32ee6d8491fcfc82652a37109f69dee9a830e9379166cb73c16d8dc5c2915165"}, - {file = "coverage-7.6.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:675cefc4c06e3b4c876b85bfb7c59c5e2218167bbd4da5075cbe3b5790a28988"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f4f620668dbc6f5e909a0946a877310fb3d57aea8198bde792aae369ee1c23b5"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:4eea95ef275de7abaef630c9b2c002ffbc01918b726a39f5a4353916ec72d2f3"}, - {file = "coverage-7.6.10-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:e2f0280519e42b0a17550072861e0bc8a80a0870de260f9796157d3fca2733c5"}, - {file = "coverage-7.6.10-cp310-cp310-win32.whl", hash = "sha256:bc67deb76bc3717f22e765ab3e07ee9c7a5e26b9019ca19a3b063d9f4b874244"}, - {file = "coverage-7.6.10-cp310-cp310-win_amd64.whl", hash = "sha256:0f460286cb94036455e703c66988851d970fdfd8acc2a1122ab7f4f904e4029e"}, - {file = "coverage-7.6.10-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ea3c8f04b3e4af80e17bab607c386a830ffc2fb88a5484e1df756478cf70d1d3"}, - {file = "coverage-7.6.10-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:507a20fc863cae1d5720797761b42d2d87a04b3e5aeb682ef3b7332e90598f43"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d37a84878285b903c0fe21ac8794c6dab58150e9359f1aaebbeddd6412d53132"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a534738b47b0de1995f85f582d983d94031dffb48ab86c95bdf88dc62212142f"}, - {file = "coverage-7.6.10-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d7a2bf79378d8fb8afaa994f91bfd8215134f8631d27eba3e0e2c13546ce994"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6713ba4b4ebc330f3def51df1d5d38fad60b66720948112f114968feb52d3f99"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:ab32947f481f7e8c763fa2c92fd9f44eeb143e7610c4ca9ecd6a36adab4081bd"}, - {file = "coverage-7.6.10-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7bbd8c8f1b115b892e34ba66a097b915d3871db7ce0e6b9901f462ff3a975377"}, - {file = "coverage-7.6.10-cp311-cp311-win32.whl", hash = "sha256:299e91b274c5c9cdb64cbdf1b3e4a8fe538a7a86acdd08fae52301b28ba297f8"}, - {file = "coverage-7.6.10-cp311-cp311-win_amd64.whl", hash = "sha256:489a01f94aa581dbd961f306e37d75d4ba16104bbfa2b0edb21d29b73be83609"}, - {file = "coverage-7.6.10-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:27c6e64726b307782fa5cbe531e7647aee385a29b2107cd87ba7c0105a5d3853"}, - {file = "coverage-7.6.10-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c56e097019e72c373bae32d946ecf9858fda841e48d82df7e81c63ac25554078"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c7827a5bc7bdb197b9e066cdf650b2887597ad124dd99777332776f7b7c7d0d0"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:204a8238afe787323a8b47d8be4df89772d5c1e4651b9ffa808552bdf20e1d50"}, - {file = "coverage-7.6.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e67926f51821b8e9deb6426ff3164870976fe414d033ad90ea75e7ed0c2e5022"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e78b270eadb5702938c3dbe9367f878249b5ef9a2fcc5360ac7bff694310d17b"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:714f942b9c15c3a7a5fe6876ce30af831c2ad4ce902410b7466b662358c852c0"}, - {file = "coverage-7.6.10-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:abb02e2f5a3187b2ac4cd46b8ced85a0858230b577ccb2c62c81482ca7d18852"}, - {file = "coverage-7.6.10-cp312-cp312-win32.whl", hash = "sha256:55b201b97286cf61f5e76063f9e2a1d8d2972fc2fcfd2c1272530172fd28c359"}, - {file = "coverage-7.6.10-cp312-cp312-win_amd64.whl", hash = "sha256:e4ae5ac5e0d1e4edfc9b4b57b4cbecd5bc266a6915c500f358817a8496739247"}, - {file = "coverage-7.6.10-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:05fca8ba6a87aabdd2d30d0b6c838b50510b56cdcfc604d40760dae7153b73d9"}, - {file = "coverage-7.6.10-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9e80eba8801c386f72e0712a0453431259c45c3249f0009aff537a517b52942b"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a372c89c939d57abe09e08c0578c1d212e7a678135d53aa16eec4430adc5e690"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ec22b5e7fe7a0fa8509181c4aac1db48f3dd4d3a566131b313d1efc102892c18"}, - {file = "coverage-7.6.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26bcf5c4df41cad1b19c84af71c22cbc9ea9a547fc973f1f2cc9a290002c8b3c"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e4630c26b6084c9b3cb53b15bd488f30ceb50b73c35c5ad7871b869cb7365fd"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2396e8116db77789f819d2bc8a7e200232b7a282c66e0ae2d2cd84581a89757e"}, - {file = "coverage-7.6.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:79109c70cc0882e4d2d002fe69a24aa504dec0cc17169b3c7f41a1d341a73694"}, - {file = "coverage-7.6.10-cp313-cp313-win32.whl", hash = "sha256:9e1747bab246d6ff2c4f28b4d186b205adced9f7bd9dc362051cc37c4a0c7bd6"}, - {file = "coverage-7.6.10-cp313-cp313-win_amd64.whl", hash = "sha256:254f1a3b1eef5f7ed23ef265eaa89c65c8c5b6b257327c149db1ca9d4a35f25e"}, - {file = "coverage-7.6.10-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2ccf240eb719789cedbb9fd1338055de2761088202a9a0b73032857e53f612fe"}, - {file = "coverage-7.6.10-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:0c807ca74d5a5e64427c8805de15b9ca140bba13572d6d74e262f46f50b13273"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2bcfa46d7709b5a7ffe089075799b902020b62e7ee56ebaed2f4bdac04c508d8"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e0de1e902669dccbf80b0415fb6b43d27edca2fbd48c74da378923b05316098"}, - {file = "coverage-7.6.10-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f7b444c42bbc533aaae6b5a2166fd1a797cdb5eb58ee51a92bee1eb94a1e1cb"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b330368cb99ef72fcd2dc3ed260adf67b31499584dc8a20225e85bfe6f6cfed0"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:9a7cfb50515f87f7ed30bc882f68812fd98bc2852957df69f3003d22a2aa0abf"}, - {file = "coverage-7.6.10-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f93531882a5f68c28090f901b1d135de61b56331bba82028489bc51bdd818d2"}, - {file = "coverage-7.6.10-cp313-cp313t-win32.whl", hash = "sha256:89d76815a26197c858f53c7f6a656686ec392b25991f9e409bcef020cd532312"}, - {file = "coverage-7.6.10-cp313-cp313t-win_amd64.whl", hash = "sha256:54a5f0f43950a36312155dae55c505a76cd7f2b12d26abeebbe7a0b36dbc868d"}, - {file = "coverage-7.6.10-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:656c82b8a0ead8bba147de9a89bda95064874c91a3ed43a00e687f23cc19d53a"}, - {file = "coverage-7.6.10-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ccc2b70a7ed475c68ceb548bf69cec1e27305c1c2606a5eb7c3afff56a1b3b27"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5e37dc41d57ceba70956fa2fc5b63c26dba863c946ace9705f8eca99daecdc4"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0aa9692b4fdd83a4647eeb7db46410ea1322b5ed94cd1715ef09d1d5922ba87f"}, - {file = "coverage-7.6.10-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa744da1820678b475e4ba3dfd994c321c5b13381d1041fe9c608620e6676e25"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c0b1818063dc9e9d838c09e3a473c1422f517889436dd980f5d721899e66f315"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:59af35558ba08b758aec4d56182b222976330ef8d2feacbb93964f576a7e7a90"}, - {file = "coverage-7.6.10-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7ed2f37cfce1ce101e6dffdfd1c99e729dd2ffc291d02d3e2d0af8b53d13840d"}, - {file = "coverage-7.6.10-cp39-cp39-win32.whl", hash = "sha256:4bcc276261505d82f0ad426870c3b12cb177752834a633e737ec5ee79bbdff18"}, - {file = "coverage-7.6.10-cp39-cp39-win_amd64.whl", hash = "sha256:457574f4599d2b00f7f637a0700a6422243b3565509457b2dbd3f50703e11f59"}, - {file = "coverage-7.6.10-pp39.pp310-none-any.whl", hash = "sha256:fd34e7b3405f0cc7ab03d54a334c17a9e802897580d964bd8c2001f4b9fd488f"}, - {file = "coverage-7.6.10.tar.gz", hash = "sha256:7fb105327c8f8f0682e29843e2ff96af9dcbe5bab8eeb4b398c6a33a16d80a23"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eb53f1e8adeeb2e78962bade0c08bfdc461853c7969706ed901821e009b35e31"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d9a03ec6cb9f40a5c360f138b88266fd8f58408d71e89f536b4f91d85721d075"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0d7f0616c557cbc3d1c2090334eddcbb70e1ae3a40b07222d62b3aa47f608fab"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e44a86a47bbdf83b0a3ea4d7df5410d6b1a0de984fbd805fa5101f3624b9abe0"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:596763d2f9a0ee7eec6e643e29660def2eef297e1de0d334c78c08706f1cb785"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef55537ff511b5e0a43edb4c50a7bf7ba1c3eea20b4f49b1490f1e8e0e42c591"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9cbabd8f4d0d3dc571d77ae5bdbfa6afe5061e679a9d74b6797c48d143307088"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e24045453384e0ae2a587d562df2a04d852672eb63051d16096d3f08aa4c7c2f"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:7161edd3426c8d19bdccde7d49e6f27f748f3c31cc350c5de7c633fea445d866"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d4ed4de17e692ba6415b0587bc7f12bc80915031fc9db46a23ce70fc88c9841"}, + {file = "coverage-7.11.0-cp310-cp310-win32.whl", hash = "sha256:765c0bc8fe46f48e341ef737c91c715bd2a53a12792592296a095f0c237e09cf"}, + {file = "coverage-7.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:24d6f3128f1b2d20d84b24f4074475457faedc3d4613a7e66b5e769939c7d969"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d58ecaa865c5b9fa56e35efc51d1014d4c0d22838815b9fce57a27dd9576847"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b679e171f1c104a5668550ada700e3c4937110dbdd153b7ef9055c4f1a1ee3cc"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ca61691ba8c5b6797deb221a0d09d7470364733ea9c69425a640f1f01b7c5bf0"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aef1747ede4bd8ca9cfc04cc3011516500c6891f1b33a94add3253f6f876b7b7"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1839d08406e4cba2953dcc0ffb312252f14d7c4c96919f70167611f4dee2623"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e0eb0a2dcc62478eb5b4cbb80b97bdee852d7e280b90e81f11b407d0b81c4287"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bc1fbea96343b53f65d5351d8fd3b34fd415a2670d7c300b06d3e14a5af4f552"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:214b622259dd0cf435f10241f1333d32caa64dbc27f8790ab693428a141723de"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:258d9967520cca899695d4eb7ea38be03f06951d6ca2f21fb48b1235f791e601"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cf9e6ff4ca908ca15c157c409d608da77a56a09877b97c889b98fb2c32b6465e"}, + {file = "coverage-7.11.0-cp311-cp311-win32.whl", hash = "sha256:fcc15fc462707b0680cff6242c48625da7f9a16a28a41bb8fd7a4280920e676c"}, + {file = "coverage-7.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:865965bf955d92790f1facd64fe7ff73551bd2c1e7e6b26443934e9701ba30b9"}, + {file = "coverage-7.11.0-cp311-cp311-win_arm64.whl", hash = "sha256:5693e57a065760dcbeb292d60cc4d0231a6d4b6b6f6a3191561e1d5e8820b745"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:9c49e77811cf9d024b95faf86c3f059b11c0c9be0b0d61bc598f453703bd6fd1"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a61e37a403a778e2cda2a6a39abcc895f1d984071942a41074b5c7ee31642007"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c79cae102bb3b1801e2ef1511fb50e91ec83a1ce466b2c7c25010d884336de46"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:16ce17ceb5d211f320b62df002fa7016b7442ea0fd260c11cec8ce7730954893"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:80027673e9d0bd6aef86134b0771845e2da85755cf686e7c7c59566cf5a89115"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d3ffa07a08657306cd2215b0da53761c4d73cb54d9143b9303a6481ec0cd415"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a3b6a5f8b2524fd6c1066bc85bfd97e78709bb5e37b5b94911a6506b65f47186"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fcc0a4aa589de34bc56e1a80a740ee0f8c47611bdfb28cd1849de60660f3799d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:dba82204769d78c3fd31b35c3d5f46e06511936c5019c39f98320e05b08f794d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:81b335f03ba67309a95210caf3eb43bd6fe75a4e22ba653ef97b4696c56c7ec2"}, + {file = "coverage-7.11.0-cp312-cp312-win32.whl", hash = "sha256:037b2d064c2f8cc8716fe4d39cb705779af3fbf1ba318dc96a1af858888c7bb5"}, + {file = "coverage-7.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:d66c0104aec3b75e5fd897e7940188ea1892ca1d0235316bf89286d6a22568c0"}, + {file = "coverage-7.11.0-cp312-cp312-win_arm64.whl", hash = "sha256:d91ebeac603812a09cf6a886ba6e464f3bbb367411904ae3790dfe28311b15ad"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:cc3f49e65ea6e0d5d9bd60368684fe52a704d46f9e7fc413918f18d046ec40e1"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f39ae2f63f37472c17b4990f794035c9890418b1b8cca75c01193f3c8d3e01be"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7db53b5cdd2917b6eaadd0b1251cf4e7d96f4a8d24e174bdbdf2f65b5ea7994d"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10ad04ac3a122048688387828b4537bc9cf60c0bf4869c1e9989c46e45690b82"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4036cc9c7983a2b1f2556d574d2eb2154ac6ed55114761685657e38782b23f52"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7ab934dd13b1c5e94b692b1e01bd87e4488cb746e3a50f798cb9464fd128374b"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59a6e5a265f7cfc05f76e3bb53eca2e0dfe90f05e07e849930fecd6abb8f40b4"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:df01d6c4c81e15a7c88337b795bb7595a8596e92310266b5072c7e301168efbd"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:8c934bd088eed6174210942761e38ee81d28c46de0132ebb1801dbe36a390dcc"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5a03eaf7ec24078ad64a07f02e30060aaf22b91dedf31a6b24d0d98d2bba7f48"}, + {file = "coverage-7.11.0-cp313-cp313-win32.whl", hash = "sha256:695340f698a5f56f795b2836abe6fb576e7c53d48cd155ad2f80fd24bc63a040"}, + {file = "coverage-7.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:2727d47fce3ee2bac648528e41455d1b0c46395a087a229deac75e9f88ba5a05"}, + {file = "coverage-7.11.0-cp313-cp313-win_arm64.whl", hash = "sha256:0efa742f431529699712b92ecdf22de8ff198df41e43aeaaadf69973eb93f17a"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:587c38849b853b157706407e9ebdca8fd12f45869edb56defbef2daa5fb0812b"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b971bdefdd75096163dd4261c74be813c4508477e39ff7b92191dea19f24cd37"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:269bfe913b7d5be12ab13a95f3a76da23cf147be7fa043933320ba5625f0a8de"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dadbcce51a10c07b7c72b0ce4a25e4b6dcb0c0372846afb8e5b6307a121eb99f"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ed43fa22c6436f7957df036331f8fe4efa7af132054e1844918866cd228af6c"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9516add7256b6713ec08359b7b05aeff8850c98d357784c7205b2e60aa2513fa"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:eb92e47c92fcbcdc692f428da67db33337fa213756f7adb6a011f7b5a7a20740"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:d06f4fc7acf3cabd6d74941d53329e06bab00a8fe10e4df2714f0b134bfc64ef"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:6fbcee1a8f056af07ecd344482f711f563a9eb1c2cad192e87df00338ec3cdb0"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dbbf012be5f32533a490709ad597ad8a8ff80c582a95adc8d62af664e532f9ca"}, + {file = "coverage-7.11.0-cp313-cp313t-win32.whl", hash = "sha256:cee6291bb4fed184f1c2b663606a115c743df98a537c969c3c64b49989da96c2"}, + {file = "coverage-7.11.0-cp313-cp313t-win_amd64.whl", hash = "sha256:a386c1061bf98e7ea4758e4313c0ab5ecf57af341ef0f43a0bf26c2477b5c268"}, + {file = "coverage-7.11.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f9ea02ef40bb83823b2b04964459d281688fe173e20643870bb5d2edf68bc836"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c770885b28fb399aaf2a65bbd1c12bf6f307ffd112d6a76c5231a94276f0c497"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a3d0e2087dba64c86a6b254f43e12d264b636a39e88c5cc0a01a7c71bcfdab7e"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:73feb83bb41c32811973b8565f3705caf01d928d972b72042b44e97c71fd70d1"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c6f31f281012235ad08f9a560976cc2fc9c95c17604ff3ab20120fe480169bca"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9570ad567f880ef675673992222746a124b9595506826b210fbe0ce3f0499cd"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8badf70446042553a773547a61fecaa734b55dc738cacf20c56ab04b77425e43"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a09c1211959903a479e389685b7feb8a17f59ec5a4ef9afde7650bd5eabc2777"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:5ef83b107f50db3f9ae40f69e34b3bd9337456c5a7fe3461c7abf8b75dd666a2"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:f91f927a3215b8907e214af77200250bb6aae36eca3f760f89780d13e495388d"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:cdbcd376716d6b7fbfeedd687a6c4be019c5a5671b35f804ba76a4c0a778cba4"}, + {file = "coverage-7.11.0-cp314-cp314-win32.whl", hash = "sha256:bab7ec4bb501743edc63609320aaec8cd9188b396354f482f4de4d40a9d10721"}, + {file = "coverage-7.11.0-cp314-cp314-win_amd64.whl", hash = "sha256:3d4ba9a449e9364a936a27322b20d32d8b166553bfe63059bd21527e681e2fad"}, + {file = "coverage-7.11.0-cp314-cp314-win_arm64.whl", hash = "sha256:ce37f215223af94ef0f75ac68ea096f9f8e8c8ec7d6e8c346ee45c0d363f0479"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:f413ce6e07e0d0dc9c433228727b619871532674b45165abafe201f200cc215f"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:05791e528a18f7072bf5998ba772fe29db4da1234c45c2087866b5ba4dea710e"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cacb29f420cfeb9283b803263c3b9a068924474ff19ca126ba9103e1278dfa44"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:314c24e700d7027ae3ab0d95fbf8d53544fca1f20345fd30cd219b737c6e58d3"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:630d0bd7a293ad2fc8b4b94e5758c8b2536fdf36c05f1681270203e463cbfa9b"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e89641f5175d65e2dbb44db15fe4ea48fade5d5bbb9868fdc2b4fce22f4a469d"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c9f08ea03114a637dab06cedb2e914da9dc67fa52c6015c018ff43fdde25b9c2"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce9f3bde4e9b031eaf1eb61df95c1401427029ea1bfddb8621c1161dcb0fa02e"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:e4dc07e95495923d6fd4d6c27bf70769425b71c89053083843fd78f378558996"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:424538266794db2861db4922b05d729ade0940ee69dcf0591ce8f69784db0e11"}, + {file = "coverage-7.11.0-cp314-cp314t-win32.whl", hash = "sha256:4c1eeb3fb8eb9e0190bebafd0462936f75717687117339f708f395fe455acc73"}, + {file = "coverage-7.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b56efee146c98dbf2cf5cffc61b9829d1e94442df4d7398b26892a53992d3547"}, + {file = "coverage-7.11.0-cp314-cp314t-win_arm64.whl", hash = "sha256:b5c2705afa83f49bd91962a4094b6b082f94aef7626365ab3f8f4bd159c5acf3"}, + {file = "coverage-7.11.0-py3-none-any.whl", hash = "sha256:4b7589765348d78fb4e5fb6ea35d07564e387da2fc5efff62e0222971f155f68"}, + {file = "coverage-7.11.0.tar.gz", hash = "sha256:167bd504ac1ca2af7ff3b81d245dfea0292c5032ebef9d66cc08a7d28c1b8050"}, ] [[package]] name = "exceptiongroup" -version = "1.2.2" +version = "1.3.0" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" groups = ["default", "dev"] marker = "python_version < \"3.11\"" +dependencies = [ + "typing-extensions>=4.6.0; python_version < \"3.13\"", +] files = [ - {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, - {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, + {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, + {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] [[package]] name = "h11" -version = "0.14.0" -requires_python = ">=3.7" +version = "0.16.0" +requires_python = ">=3.8" summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" groups = ["default"] -dependencies = [ - "typing-extensions; python_version < \"3.8\"", -] files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] name = "httpcore" -version = "1.0.7" +version = "1.0.9" requires_python = ">=3.8" summary = "A minimal low-level HTTP client." groups = ["default"] dependencies = [ "certifi", - "h11<0.15,>=0.13", + "h11>=0.16", ] files = [ - {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"}, - {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"}, + {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, + {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, ] [[package]] @@ -297,29 +356,29 @@ files = [ [[package]] name = "idna" -version = "3.10" -requires_python = ">=3.6" +version = "3.11" +requires_python = ">=3.8" summary = "Internationalized Domain Names in Applications (IDNA)" groups = ["default"] files = [ - {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, - {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, + {file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"}, + {file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"}, ] [[package]] name = "iniconfig" -version = "2.0.0" -requires_python = ">=3.7" +version = "2.3.0" +requires_python = ">=3.10" summary = "brain-dead simple config-ini parsing" groups = ["dev"] files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"}, + {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, ] [[package]] name = "jinja2" -version = "3.1.5" +version = "3.1.6" requires_python = ">=3.7" summary = "A very fast and expressive template engine." groups = ["default"] @@ -327,92 +386,109 @@ dependencies = [ "MarkupSafe>=2.0", ] files = [ - {file = "jinja2-3.1.5-py3-none-any.whl", hash = "sha256:aba0f4dc9ed8013c424088f68a5c226f7d6097ed89b246d7749c2ec4175c6adb"}, - {file = "jinja2-3.1.5.tar.gz", hash = "sha256:8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb"}, + {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"}, + {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"}, ] [[package]] name = "markdown-it-py" -version = "3.0.0" -requires_python = ">=3.8" +version = "4.0.0" +requires_python = ">=3.10" summary = "Python port of markdown-it. Markdown parsing, done right!" groups = ["default"] dependencies = [ "mdurl~=0.1", ] files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, + {file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"}, + {file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"}, ] [[package]] name = "markupsafe" -version = "3.0.2" +version = "3.0.3" requires_python = ">=3.9" summary = "Safely add untrusted strings to HTML/XML markup." groups = ["default"] files = [ - {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-win32.whl", hash = "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a"}, - {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"}, + {file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"}, + {file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1ba88449deb3de88bd40044603fafffb7bc2b055d626a330323a9ed736661695"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f42d0984e947b8adf7dd6dde396e720934d12c506ce84eea8476409563607591"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c0c0b3ade1c0b13b936d7970b1d37a57acde9199dc2aecc4c336773e1d86049c"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:0303439a41979d9e74d18ff5e2dd8c43ed6c6001fd40e5bf2e43f7bd9bbc523f"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:d2ee202e79d8ed691ceebae8e0486bd9a2cd4794cec4824e1c99b6f5009502f6"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:177b5253b2834fe3678cb4a5f0059808258584c559193998be2601324fdeafb1"}, + {file = "markupsafe-3.0.3-cp310-cp310-win32.whl", hash = "sha256:2a15a08b17dd94c53a1da0438822d70ebcd13f8c3a95abe3a9ef9f11a94830aa"}, + {file = "markupsafe-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:c4ffb7ebf07cfe8931028e3e4c85f0357459a3f9f9490886198848f4fa002ec8"}, + {file = "markupsafe-3.0.3-cp310-cp310-win_arm64.whl", hash = "sha256:e2103a929dfa2fcaf9bb4e7c091983a49c9ac3b19c9061b6d5427dd7d14d81a1"}, + {file = "markupsafe-3.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1cc7ea17a6824959616c525620e387f6dd30fec8cb44f649e31712db02123dad"}, + {file = "markupsafe-3.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bd4cd07944443f5a265608cc6aab442e4f74dff8088b0dfc8238647b8f6ae9a"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b5420a1d9450023228968e7e6a9ce57f65d148ab56d2313fcd589eee96a7a50"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0bf2a864d67e76e5c9a34dc26ec616a66b9888e25e7b9460e1c76d3293bd9dbf"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc51efed119bc9cfdf792cdeaa4d67e8f6fcccab66ed4bfdd6bde3e59bfcbb2f"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:068f375c472b3e7acbe2d5318dea141359e6900156b5b2ba06a30b169086b91a"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:7be7b61bb172e1ed687f1754f8e7484f1c8019780f6f6b0786e76bb01c2ae115"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f9e130248f4462aaa8e2552d547f36ddadbeaa573879158d721bbd33dfe4743a"}, + {file = "markupsafe-3.0.3-cp311-cp311-win32.whl", hash = "sha256:0db14f5dafddbb6d9208827849fad01f1a2609380add406671a26386cdf15a19"}, + {file = "markupsafe-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:de8a88e63464af587c950061a5e6a67d3632e36df62b986892331d4620a35c01"}, + {file = "markupsafe-3.0.3-cp311-cp311-win_arm64.whl", hash = "sha256:3b562dd9e9ea93f13d53989d23a7e775fdfd1066c33494ff43f5418bc8c58a5c"}, + {file = "markupsafe-3.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d53197da72cc091b024dd97249dfc7794d6a56530370992a5e1a08983ad9230e"}, + {file = "markupsafe-3.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1872df69a4de6aead3491198eaf13810b565bdbeec3ae2dc8780f14458ec73ce"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3a7e8ae81ae39e62a41ec302f972ba6ae23a5c5396c8e60113e9066ef893da0d"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6dd0be5b5b189d31db7cda48b91d7e0a9795f31430b7f271219ab30f1d3ac9d"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:94c6f0bb423f739146aec64595853541634bde58b2135f27f61c1ffd1cd4d16a"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:be8813b57049a7dc738189df53d69395eba14fb99345e0a5994914a3864c8a4b"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:83891d0e9fb81a825d9a6d61e3f07550ca70a076484292a70fde82c4b807286f"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:77f0643abe7495da77fb436f50f8dab76dbc6e5fd25d39589a0f1fe6548bfa2b"}, + {file = "markupsafe-3.0.3-cp312-cp312-win32.whl", hash = "sha256:d88b440e37a16e651bda4c7c2b930eb586fd15ca7406cb39e211fcff3bf3017d"}, + {file = "markupsafe-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:26a5784ded40c9e318cfc2bdb30fe164bdb8665ded9cd64d500a34fb42067b1c"}, + {file = "markupsafe-3.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:35add3b638a5d900e807944a078b51922212fb3dedb01633a8defc4b01a3c85f"}, + {file = "markupsafe-3.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e1cf1972137e83c5d4c136c43ced9ac51d0e124706ee1c8aa8532c1287fa8795"}, + {file = "markupsafe-3.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:116bb52f642a37c115f517494ea5feb03889e04df47eeff5b130b1808ce7c219"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:133a43e73a802c5562be9bbcd03d090aa5a1fe899db609c29e8c8d815c5f6de6"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfcd093f13f0f0b7fdd0f198b90053bf7b2f02a3927a30e63f3ccc9df56b676"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:509fa21c6deb7a7a273d629cf5ec029bc209d1a51178615ddf718f5918992ab9"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4afe79fb3de0b7097d81da19090f4df4f8d3a2b3adaa8764138aac2e44f3af1"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:795e7751525cae078558e679d646ae45574b47ed6e7771863fcc079a6171a0fc"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8485f406a96febb5140bfeca44a73e3ce5116b2501ac54fe953e488fb1d03b12"}, + {file = "markupsafe-3.0.3-cp313-cp313-win32.whl", hash = "sha256:bdd37121970bfd8be76c5fb069c7751683bdf373db1ed6c010162b2a130248ed"}, + {file = "markupsafe-3.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:9a1abfdc021a164803f4d485104931fb8f8c1efd55bc6b748d2f5774e78b62c5"}, + {file = "markupsafe-3.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:7e68f88e5b8799aa49c85cd116c932a1ac15caaa3f5db09087854d218359e485"}, + {file = "markupsafe-3.0.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:218551f6df4868a8d527e3062d0fb968682fe92054e89978594c28e642c43a73"}, + {file = "markupsafe-3.0.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3524b778fe5cfb3452a09d31e7b5adefeea8c5be1d43c4f810ba09f2ceb29d37"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e885a3d1efa2eadc93c894a21770e4bc67899e3543680313b09f139e149ab19"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8709b08f4a89aa7586de0aadc8da56180242ee0ada3999749b183aa23df95025"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b8512a91625c9b3da6f127803b166b629725e68af71f8184ae7e7d54686a56d6"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:9b79b7a16f7fedff2495d684f2b59b0457c3b493778c9eed31111be64d58279f"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:12c63dfb4a98206f045aa9563db46507995f7ef6d83b2f68eda65c307c6829eb"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8f71bc33915be5186016f675cd83a1e08523649b0e33efdb898db577ef5bb009"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win32.whl", hash = "sha256:69c0b73548bc525c8cb9a251cddf1931d1db4d2258e9599c28c07ef3580ef354"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win_amd64.whl", hash = "sha256:1b4b79e8ebf6b55351f0d91fe80f893b4743f104bff22e90697db1590e47a218"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win_arm64.whl", hash = "sha256:ad2cf8aa28b8c020ab2fc8287b0f823d0a7d8630784c31e9ee5edea20f406287"}, + {file = "markupsafe-3.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe"}, + {file = "markupsafe-3.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe"}, + {file = "markupsafe-3.0.3-cp314-cp314-win32.whl", hash = "sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9"}, + {file = "markupsafe-3.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581"}, + {file = "markupsafe-3.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4"}, + {file = "markupsafe-3.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab"}, + {file = "markupsafe-3.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win32.whl", hash = "sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa"}, + {file = "markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698"}, ] [[package]] @@ -428,250 +504,279 @@ files = [ [[package]] name = "mypy" -version = "1.14.0" -requires_python = ">=3.8" +version = "1.18.2" +requires_python = ">=3.9" summary = "Optional static typing for Python" groups = ["dev"] dependencies = [ "mypy-extensions>=1.0.0", + "pathspec>=0.9.0", "tomli>=1.1.0; python_version < \"3.11\"", "typing-extensions>=4.6.0", ] files = [ - {file = "mypy-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e971c1c667007f9f2b397ffa80fa8e1e0adccff336e5e77e74cb5f22868bee87"}, - {file = "mypy-1.14.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e86aaeaa3221a278c66d3d673b297232947d873773d61ca3ee0e28b2ff027179"}, - {file = "mypy-1.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1628c5c3ce823d296e41e2984ff88c5861499041cb416a8809615d0c1f41740e"}, - {file = "mypy-1.14.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7fadb29b77fc14a0dd81304ed73c828c3e5cde0016c7e668a86a3e0dfc9f3af3"}, - {file = "mypy-1.14.0-cp310-cp310-win_amd64.whl", hash = "sha256:3fa76988dc760da377c1e5069200a50d9eaaccf34f4ea18428a3337034ab5a44"}, - {file = "mypy-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6e73c8a154eed31db3445fe28f63ad2d97b674b911c00191416cf7f6459fd49a"}, - {file = "mypy-1.14.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:273e70fcb2e38c5405a188425aa60b984ffdcef65d6c746ea5813024b68c73dc"}, - {file = "mypy-1.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1daca283d732943731a6a9f20fdbcaa927f160bc51602b1d4ef880a6fb252015"}, - {file = "mypy-1.14.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:7e68047bedb04c1c25bba9901ea46ff60d5eaac2d71b1f2161f33107e2b368eb"}, - {file = "mypy-1.14.0-cp311-cp311-win_amd64.whl", hash = "sha256:7a52f26b9c9b1664a60d87675f3bae00b5c7f2806e0c2800545a32c325920bcc"}, - {file = "mypy-1.14.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d5326ab70a6db8e856d59ad4cb72741124950cbbf32e7b70e30166ba7bbf61dd"}, - {file = "mypy-1.14.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bf4ec4980bec1e0e24e5075f449d014011527ae0055884c7e3abc6a99cd2c7f1"}, - {file = "mypy-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:390dfb898239c25289495500f12fa73aa7f24a4c6d90ccdc165762462b998d63"}, - {file = "mypy-1.14.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7e026d55ddcd76e29e87865c08cbe2d0104e2b3153a523c529de584759379d3d"}, - {file = "mypy-1.14.0-cp312-cp312-win_amd64.whl", hash = "sha256:585ed36031d0b3ee362e5107ef449a8b5dfd4e9c90ccbe36414ee405ee6b32ba"}, - {file = "mypy-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9f6f4c0b27401d14c483c622bc5105eff3911634d576bbdf6695b9a7c1ba741"}, - {file = "mypy-1.14.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:56b2280cedcb312c7a79f5001ae5325582d0d339bce684e4a529069d0e7ca1e7"}, - {file = "mypy-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:342de51c48bab326bfc77ce056ba08c076d82ce4f5a86621f972ed39970f94d8"}, - {file = "mypy-1.14.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:00df23b42e533e02a6f0055e54de9a6ed491cd8b7ea738647364fd3a39ea7efc"}, - {file = "mypy-1.14.0-cp313-cp313-win_amd64.whl", hash = "sha256:e8c8387e5d9dff80e7daf961df357c80e694e942d9755f3ad77d69b0957b8e3f"}, - {file = "mypy-1.14.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:14117b9da3305b39860d0aa34b8f1ff74d209a368829a584eb77524389a9c13e"}, - {file = "mypy-1.14.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af98c5a958f9c37404bd4eef2f920b94874507e146ed6ee559f185b8809c44cc"}, - {file = "mypy-1.14.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f0b343a1d3989547024377c2ba0dca9c74a2428ad6ed24283c213af8dbb0710b"}, - {file = "mypy-1.14.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:cdb5563c1726c85fb201be383168f8c866032db95e1095600806625b3a648cb7"}, - {file = "mypy-1.14.0-cp39-cp39-win_amd64.whl", hash = "sha256:74e925649c1ee0a79aa7448baf2668d81cc287dc5782cff6a04ee93f40fb8d3f"}, - {file = "mypy-1.14.0-py3-none-any.whl", hash = "sha256:2238d7f93fc4027ed1efc944507683df3ba406445a2b6c96e79666a045aadfab"}, - {file = "mypy-1.14.0.tar.gz", hash = "sha256:822dbd184d4a9804df5a7d5335a68cf7662930e70b8c1bc976645d1509f9a9d6"}, + {file = "mypy-1.18.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c1eab0cf6294dafe397c261a75f96dc2c31bffe3b944faa24db5def4e2b0f77c"}, + {file = "mypy-1.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7a780ca61fc239e4865968ebc5240bb3bf610ef59ac398de9a7421b54e4a207e"}, + {file = "mypy-1.18.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:448acd386266989ef11662ce3c8011fd2a7b632e0ec7d61a98edd8e27472225b"}, + {file = "mypy-1.18.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f9e171c465ad3901dc652643ee4bffa8e9fef4d7d0eece23b428908c77a76a66"}, + {file = "mypy-1.18.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:592ec214750bc00741af1f80cbf96b5013d81486b7bb24cb052382c19e40b428"}, + {file = "mypy-1.18.2-cp310-cp310-win_amd64.whl", hash = "sha256:7fb95f97199ea11769ebe3638c29b550b5221e997c63b14ef93d2e971606ebed"}, + {file = "mypy-1.18.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:807d9315ab9d464125aa9fcf6d84fde6e1dc67da0b6f80e7405506b8ac72bc7f"}, + {file = "mypy-1.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:776bb00de1778caf4db739c6e83919c1d85a448f71979b6a0edd774ea8399341"}, + {file = "mypy-1.18.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1379451880512ffce14505493bd9fe469e0697543717298242574882cf8cdb8d"}, + {file = "mypy-1.18.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1331eb7fd110d60c24999893320967594ff84c38ac6d19e0a76c5fd809a84c86"}, + {file = "mypy-1.18.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3ca30b50a51e7ba93b00422e486cbb124f1c56a535e20eff7b2d6ab72b3b2e37"}, + {file = "mypy-1.18.2-cp311-cp311-win_amd64.whl", hash = "sha256:664dc726e67fa54e14536f6e1224bcfce1d9e5ac02426d2326e2bb4e081d1ce8"}, + {file = "mypy-1.18.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:33eca32dd124b29400c31d7cf784e795b050ace0e1f91b8dc035672725617e34"}, + {file = "mypy-1.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a3c47adf30d65e89b2dcd2fa32f3aeb5e94ca970d2c15fcb25e297871c8e4764"}, + {file = "mypy-1.18.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d6c838e831a062f5f29d11c9057c6009f60cb294fea33a98422688181fe2893"}, + {file = "mypy-1.18.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01199871b6110a2ce984bde85acd481232d17413868c9807e95c1b0739a58914"}, + {file = "mypy-1.18.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a2afc0fa0b0e91b4599ddfe0f91e2c26c2b5a5ab263737e998d6817874c5f7c8"}, + {file = "mypy-1.18.2-cp312-cp312-win_amd64.whl", hash = "sha256:d8068d0afe682c7c4897c0f7ce84ea77f6de953262b12d07038f4d296d547074"}, + {file = "mypy-1.18.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:07b8b0f580ca6d289e69209ec9d3911b4a26e5abfde32228a288eb79df129fcc"}, + {file = "mypy-1.18.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ed4482847168439651d3feee5833ccedbf6657e964572706a2adb1f7fa4dfe2e"}, + {file = "mypy-1.18.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c3ad2afadd1e9fea5cf99a45a822346971ede8685cc581ed9cd4d42eaf940986"}, + {file = "mypy-1.18.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a431a6f1ef14cf8c144c6b14793a23ec4eae3db28277c358136e79d7d062f62d"}, + {file = "mypy-1.18.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7ab28cc197f1dd77a67e1c6f35cd1f8e8b73ed2217e4fc005f9e6a504e46e7ba"}, + {file = "mypy-1.18.2-cp313-cp313-win_amd64.whl", hash = "sha256:0e2785a84b34a72ba55fb5daf079a1003a34c05b22238da94fcae2bbe46f3544"}, + {file = "mypy-1.18.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:62f0e1e988ad41c2a110edde6c398383a889d95b36b3e60bcf155f5164c4fdce"}, + {file = "mypy-1.18.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8795a039bab805ff0c1dfdb8cd3344642c2b99b8e439d057aba30850b8d3423d"}, + {file = "mypy-1.18.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6ca1e64b24a700ab5ce10133f7ccd956a04715463d30498e64ea8715236f9c9c"}, + {file = "mypy-1.18.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d924eef3795cc89fecf6bedc6ed32b33ac13e8321344f6ddbf8ee89f706c05cb"}, + {file = "mypy-1.18.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20c02215a080e3a2be3aa50506c67242df1c151eaba0dcbc1e4e557922a26075"}, + {file = "mypy-1.18.2-cp314-cp314-win_amd64.whl", hash = "sha256:749b5f83198f1ca64345603118a6f01a4e99ad4bf9d103ddc5a3200cc4614adf"}, + {file = "mypy-1.18.2-py3-none-any.whl", hash = "sha256:22a1748707dd62b58d2ae53562ffc4d7f8bcc727e8ac7cbc69c053ddc874d47e"}, + {file = "mypy-1.18.2.tar.gz", hash = "sha256:06a398102a5f203d7477b2923dda3634c36727fa5c237d8f859ef90c42a9924b"}, ] [[package]] name = "mypy-extensions" -version = "1.0.0" -requires_python = ">=3.5" +version = "1.1.0" +requires_python = ">=3.8" summary = "Type system extensions for programs checked with the mypy type checker." groups = ["dev"] files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, ] [[package]] name = "packaging" -version = "24.2" +version = "25.0" requires_python = ">=3.8" summary = "Core utilities for Python packages" groups = ["dev"] files = [ - {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, - {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, ] [[package]] -name = "pluggy" -version = "1.5.0" +name = "pathspec" +version = "0.12.1" requires_python = ">=3.8" +summary = "Utility library for gitignore style pattern matching of file paths." +groups = ["dev"] +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +requires_python = ">=3.9" summary = "plugin and hook calling mechanisms for python" groups = ["dev"] files = [ - {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, - {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, ] [[package]] name = "pydantic" -version = "2.10.4" -requires_python = ">=3.8" +version = "2.12.3" +requires_python = ">=3.9" summary = "Data validation using Python type hints" groups = ["default"] dependencies = [ "annotated-types>=0.6.0", - "pydantic-core==2.27.2", - "typing-extensions>=4.12.2", + "pydantic-core==2.41.4", + "typing-extensions>=4.14.1", + "typing-inspection>=0.4.2", ] files = [ - {file = "pydantic-2.10.4-py3-none-any.whl", hash = "sha256:597e135ea68be3a37552fb524bc7d0d66dcf93d395acd93a00682f1efcb8ee3d"}, - {file = "pydantic-2.10.4.tar.gz", hash = "sha256:82f12e9723da6de4fe2ba888b5971157b3be7ad914267dea8f05f82b28254f06"}, + {file = "pydantic-2.12.3-py3-none-any.whl", hash = "sha256:6986454a854bc3bc6e5443e1369e06a3a456af9d339eda45510f517d9ea5c6bf"}, + {file = "pydantic-2.12.3.tar.gz", hash = "sha256:1da1c82b0fc140bb0103bc1441ffe062154c8d38491189751ee00fd8ca65ce74"}, ] [[package]] name = "pydantic-core" -version = "2.27.2" -requires_python = ">=3.8" +version = "2.41.4" +requires_python = ">=3.9" summary = "Core functionality for Pydantic validation and serialization" groups = ["default"] dependencies = [ - "typing-extensions!=4.7.0,>=4.6.0", -] -files = [ - {file = "pydantic_core-2.27.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2d367ca20b2f14095a8f4fa1210f5a7b78b8a20009ecced6b12818f455b1e9fa"}, - {file = "pydantic_core-2.27.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:491a2b73db93fab69731eaee494f320faa4e093dbed776be1a829c2eb222c34c"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7969e133a6f183be60e9f6f56bfae753585680f3b7307a8e555a948d443cc05a"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3de9961f2a346257caf0aa508a4da705467f53778e9ef6fe744c038119737ef5"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e2bb4d3e5873c37bb3dd58714d4cd0b0e6238cebc4177ac8fe878f8b3aa8e74c"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:280d219beebb0752699480fe8f1dc61ab6615c2046d76b7ab7ee38858de0a4e7"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47956ae78b6422cbd46f772f1746799cbb862de838fd8d1fbd34a82e05b0983a"}, - {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:14d4a5c49d2f009d62a2a7140d3064f686d17a5d1a268bc641954ba181880236"}, - {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:337b443af21d488716f8d0b6164de833e788aa6bd7e3a39c005febc1284f4962"}, - {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:03d0f86ea3184a12f41a2d23f7ccb79cdb5a18e06993f8a45baa8dfec746f0e9"}, - {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7041c36f5680c6e0f08d922aed302e98b3745d97fe1589db0a3eebf6624523af"}, - {file = "pydantic_core-2.27.2-cp310-cp310-win32.whl", hash = "sha256:50a68f3e3819077be2c98110c1f9dcb3817e93f267ba80a2c05bb4f8799e2ff4"}, - {file = "pydantic_core-2.27.2-cp310-cp310-win_amd64.whl", hash = "sha256:e0fd26b16394ead34a424eecf8a31a1f5137094cabe84a1bcb10fa6ba39d3d31"}, - {file = "pydantic_core-2.27.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:8e10c99ef58cfdf2a66fc15d66b16c4a04f62bca39db589ae8cba08bc55331bc"}, - {file = "pydantic_core-2.27.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:26f32e0adf166a84d0cb63be85c562ca8a6fa8de28e5f0d92250c6b7e9e2aff7"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c19d1ea0673cd13cc2f872f6c9ab42acc4e4f492a7ca9d3795ce2b112dd7e15"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5e68c4446fe0810e959cdff46ab0a41ce2f2c86d227d96dc3847af0ba7def306"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d9640b0059ff4f14d1f37321b94061c6db164fbe49b334b31643e0528d100d99"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40d02e7d45c9f8af700f3452f329ead92da4c5f4317ca9b896de7ce7199ea459"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c1fd185014191700554795c99b347d64f2bb637966c4cfc16998a0ca700d048"}, - {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d81d2068e1c1228a565af076598f9e7451712700b673de8f502f0334f281387d"}, - {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:1a4207639fb02ec2dbb76227d7c751a20b1a6b4bc52850568e52260cae64ca3b"}, - {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:3de3ce3c9ddc8bbd88f6e0e304dea0e66d843ec9de1b0042b0911c1663ffd474"}, - {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:30c5f68ded0c36466acede341551106821043e9afaad516adfb6e8fa80a4e6a6"}, - {file = "pydantic_core-2.27.2-cp311-cp311-win32.whl", hash = "sha256:c70c26d2c99f78b125a3459f8afe1aed4d9687c24fd677c6a4436bc042e50d6c"}, - {file = "pydantic_core-2.27.2-cp311-cp311-win_amd64.whl", hash = "sha256:08e125dbdc505fa69ca7d9c499639ab6407cfa909214d500897d02afb816e7cc"}, - {file = "pydantic_core-2.27.2-cp311-cp311-win_arm64.whl", hash = "sha256:26f0d68d4b235a2bae0c3fc585c585b4ecc51382db0e3ba402a22cbc440915e4"}, - {file = "pydantic_core-2.27.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9e0c8cfefa0ef83b4da9588448b6d8d2a2bf1a53c3f1ae5fca39eb3061e2f0b0"}, - {file = "pydantic_core-2.27.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:83097677b8e3bd7eaa6775720ec8e0405f1575015a463285a92bfdfe254529ef"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:172fce187655fece0c90d90a678424b013f8fbb0ca8b036ac266749c09438cb7"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:519f29f5213271eeeeb3093f662ba2fd512b91c5f188f3bb7b27bc5973816934"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05e3a55d124407fffba0dd6b0c0cd056d10e983ceb4e5dbd10dda135c31071d6"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c3ed807c7b91de05e63930188f19e921d1fe90de6b4f5cd43ee7fcc3525cb8c"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fb4aadc0b9a0c063206846d603b92030eb6f03069151a625667f982887153e2"}, - {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:28ccb213807e037460326424ceb8b5245acb88f32f3d2777427476e1b32c48c4"}, - {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:de3cd1899e2c279b140adde9357c4495ed9d47131b4a4eaff9052f23398076b3"}, - {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:220f892729375e2d736b97d0e51466252ad84c51857d4d15f5e9692f9ef12be4"}, - {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a0fcd29cd6b4e74fe8ddd2c90330fd8edf2e30cb52acda47f06dd615ae72da57"}, - {file = "pydantic_core-2.27.2-cp312-cp312-win32.whl", hash = "sha256:1e2cb691ed9834cd6a8be61228471d0a503731abfb42f82458ff27be7b2186fc"}, - {file = "pydantic_core-2.27.2-cp312-cp312-win_amd64.whl", hash = "sha256:cc3f1a99a4f4f9dd1de4fe0312c114e740b5ddead65bb4102884b384c15d8bc9"}, - {file = "pydantic_core-2.27.2-cp312-cp312-win_arm64.whl", hash = "sha256:3911ac9284cd8a1792d3cb26a2da18f3ca26c6908cc434a18f730dc0db7bfa3b"}, - {file = "pydantic_core-2.27.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7d14bd329640e63852364c306f4d23eb744e0f8193148d4044dd3dacdaacbd8b"}, - {file = "pydantic_core-2.27.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:82f91663004eb8ed30ff478d77c4d1179b3563df6cdb15c0817cd1cdaf34d154"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71b24c7d61131bb83df10cc7e687433609963a944ccf45190cfc21e0887b08c9"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa8e459d4954f608fa26116118bb67f56b93b209c39b008277ace29937453dc9"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce8918cbebc8da707ba805b7fd0b382816858728ae7fe19a942080c24e5b7cd1"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3f5c2a021bbc5d976107bb302e0131351c2ba54343f8a496dc8783d3d3a6a"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd8086fa684c4775c27f03f062cbb9eaa6e17f064307e86b21b9e0abc9c0f02e"}, - {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8d9b3388db186ba0c099a6d20f0604a44eabdeef1777ddd94786cdae158729e4"}, - {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7a66efda2387de898c8f38c0cf7f14fca0b51a8ef0b24bfea5849f1b3c95af27"}, - {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:18a101c168e4e092ab40dbc2503bdc0f62010e95d292b27827871dc85450d7ee"}, - {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ba5dd002f88b78a4215ed2f8ddbdf85e8513382820ba15ad5ad8955ce0ca19a1"}, - {file = "pydantic_core-2.27.2-cp313-cp313-win32.whl", hash = "sha256:1ebaf1d0481914d004a573394f4be3a7616334be70261007e47c2a6fe7e50130"}, - {file = "pydantic_core-2.27.2-cp313-cp313-win_amd64.whl", hash = "sha256:953101387ecf2f5652883208769a79e48db18c6df442568a0b5ccd8c2723abee"}, - {file = "pydantic_core-2.27.2-cp313-cp313-win_arm64.whl", hash = "sha256:ac4dbfd1691affb8f48c2c13241a2e3b60ff23247cbcf981759c768b6633cf8b"}, - {file = "pydantic_core-2.27.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c10eb4f1659290b523af58fa7cffb452a61ad6ae5613404519aee4bfbf1df993"}, - {file = "pydantic_core-2.27.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ef592d4bad47296fb11f96cd7dc898b92e795032b4894dfb4076cfccd43a9308"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c61709a844acc6bf0b7dce7daae75195a10aac96a596ea1b776996414791ede4"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c5f762659e47fdb7b16956c71598292f60a03aa92f8b6351504359dbdba6cf"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4c9775e339e42e79ec99c441d9730fccf07414af63eac2f0e48e08fd38a64d76"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:57762139821c31847cfb2df63c12f725788bd9f04bc2fb392790959b8f70f118"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d1e85068e818c73e048fe28cfc769040bb1f475524f4745a5dc621f75ac7630"}, - {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:097830ed52fd9e427942ff3b9bc17fab52913b2f50f2880dc4a5611446606a54"}, - {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:044a50963a614ecfae59bb1eaf7ea7efc4bc62f49ed594e18fa1e5d953c40e9f"}, - {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:4e0b4220ba5b40d727c7f879eac379b822eee5d8fff418e9d3381ee45b3b0362"}, - {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5e4f4bb20d75e9325cc9696c6802657b58bc1dbbe3022f32cc2b2b632c3fbb96"}, - {file = "pydantic_core-2.27.2-cp39-cp39-win32.whl", hash = "sha256:cca63613e90d001b9f2f9a9ceb276c308bfa2a43fafb75c8031c4f66039e8c6e"}, - {file = "pydantic_core-2.27.2-cp39-cp39-win_amd64.whl", hash = "sha256:77d1bca19b0f7021b3a982e6f903dcd5b2b06076def36a652e3907f596e29f67"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:2bf14caea37e91198329b828eae1618c068dfb8ef17bb33287a7ad4b61ac314e"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:b0cb791f5b45307caae8810c2023a184c74605ec3bcbb67d13846c28ff731ff8"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:688d3fd9fcb71f41c4c015c023d12a79d1c4c0732ec9eb35d96e3388a120dcf3"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d591580c34f4d731592f0e9fe40f9cc1b430d297eecc70b962e93c5c668f15f"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:82f986faf4e644ffc189a7f1aafc86e46ef70372bb153e7001e8afccc6e54133"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:bec317a27290e2537f922639cafd54990551725fc844249e64c523301d0822fc"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:0296abcb83a797db256b773f45773da397da75a08f5fcaef41f2044adec05f50"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:0d75070718e369e452075a6017fbf187f788e17ed67a3abd47fa934d001863d9"}, - {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:7e17b560be3c98a8e3aa66ce828bdebb9e9ac6ad5466fba92eb74c4c95cb1151"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c33939a82924da9ed65dab5a65d427205a73181d8098e79b6b426bdf8ad4e656"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:00bad2484fa6bda1e216e7345a798bd37c68fb2d97558edd584942aa41b7d278"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c817e2b40aba42bac6f457498dacabc568c3b7a986fc9ba7c8d9d260b71485fb"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:251136cdad0cb722e93732cb45ca5299fb56e1344a833640bf93b2803f8d1bfd"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d2088237af596f0a524d3afc39ab3b036e8adb054ee57cbb1dcf8e09da5b29cc"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d4041c0b966a84b4ae7a09832eb691a35aec90910cd2dbe7a208de59be77965b"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:8083d4e875ebe0b864ffef72a4304827015cff328a1be6e22cc850753bfb122b"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f141ee28a0ad2123b6611b6ceff018039df17f32ada8b534e6aa039545a3efb2"}, - {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7d0c8399fcc1848491f00e0314bd59fb34a9c008761bcb422a057670c3f65e35"}, - {file = "pydantic_core-2.27.2.tar.gz", hash = "sha256:eb026e5a4c1fee05726072337ff51d1efb6f59090b7da90d30ea58625b1ffb39"}, + "typing-extensions>=4.14.1", +] +files = [ + {file = "pydantic_core-2.41.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2442d9a4d38f3411f22eb9dd0912b7cbf4b7d5b6c92c4173b75d3e1ccd84e36e"}, + {file = "pydantic_core-2.41.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:30a9876226dda131a741afeab2702e2d127209bde3c65a2b8133f428bc5d006b"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d55bbac04711e2980645af68b97d445cdbcce70e5216de444a6c4b6943ebcccd"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e1d778fb7849a42d0ee5927ab0f7453bf9f85eef8887a546ec87db5ddb178945"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1b65077a4693a98b90ec5ad8f203ad65802a1b9b6d4a7e48066925a7e1606706"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:62637c769dee16eddb7686bf421be48dfc2fae93832c25e25bc7242e698361ba"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2dfe3aa529c8f501babf6e502936b9e8d4698502b2cfab41e17a028d91b1ac7b"}, + {file = "pydantic_core-2.41.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ca2322da745bf2eeb581fc9ea3bbb31147702163ccbcbf12a3bb630e4bf05e1d"}, + {file = "pydantic_core-2.41.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e8cd3577c796be7231dcf80badcf2e0835a46665eaafd8ace124d886bab4d700"}, + {file = "pydantic_core-2.41.4-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:1cae8851e174c83633f0833e90636832857297900133705ee158cf79d40f03e6"}, + {file = "pydantic_core-2.41.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a26d950449aae348afe1ac8be5525a00ae4235309b729ad4d3399623125b43c9"}, + {file = "pydantic_core-2.41.4-cp310-cp310-win32.whl", hash = "sha256:0cf2a1f599efe57fa0051312774280ee0f650e11152325e41dfd3018ef2c1b57"}, + {file = "pydantic_core-2.41.4-cp310-cp310-win_amd64.whl", hash = "sha256:a8c2e340d7e454dc3340d3d2e8f23558ebe78c98aa8f68851b04dcb7bc37abdc"}, + {file = "pydantic_core-2.41.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:28ff11666443a1a8cf2a044d6a545ebffa8382b5f7973f22c36109205e65dc80"}, + {file = "pydantic_core-2.41.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:61760c3925d4633290292bad462e0f737b840508b4f722247d8729684f6539ae"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eae547b7315d055b0de2ec3965643b0ab82ad0106a7ffd29615ee9f266a02827"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ef9ee5471edd58d1fcce1c80ffc8783a650e3e3a193fe90d52e43bb4d87bff1f"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:15dd504af121caaf2c95cb90c0ebf71603c53de98305621b94da0f967e572def"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3a926768ea49a8af4d36abd6a8968b8790f7f76dd7cbd5a4c180db2b4ac9a3a2"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6916b9b7d134bff5440098a4deb80e4cb623e68974a87883299de9124126c2a8"}, + {file = "pydantic_core-2.41.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5cf90535979089df02e6f17ffd076f07237efa55b7343d98760bde8743c4b265"}, + {file = "pydantic_core-2.41.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:7533c76fa647fade2d7ec75ac5cc079ab3f34879626dae5689b27790a6cf5a5c"}, + {file = "pydantic_core-2.41.4-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:37e516bca9264cbf29612539801ca3cd5d1be465f940417b002905e6ed79d38a"}, + {file = "pydantic_core-2.41.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0c19cb355224037c83642429b8ce261ae108e1c5fbf5c028bac63c77b0f8646e"}, + {file = "pydantic_core-2.41.4-cp311-cp311-win32.whl", hash = "sha256:09c2a60e55b357284b5f31f5ab275ba9f7f70b7525e18a132ec1f9160b4f1f03"}, + {file = "pydantic_core-2.41.4-cp311-cp311-win_amd64.whl", hash = "sha256:711156b6afb5cb1cb7c14a2cc2c4a8b4c717b69046f13c6b332d8a0a8f41ca3e"}, + {file = "pydantic_core-2.41.4-cp311-cp311-win_arm64.whl", hash = "sha256:6cb9cf7e761f4f8a8589a45e49ed3c0d92d1d696a45a6feaee8c904b26efc2db"}, + {file = "pydantic_core-2.41.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:ab06d77e053d660a6faaf04894446df7b0a7e7aba70c2797465a0a1af00fc887"}, + {file = "pydantic_core-2.41.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c53ff33e603a9c1179a9364b0a24694f183717b2e0da2b5ad43c316c956901b2"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:304c54176af2c143bd181d82e77c15c41cbacea8872a2225dd37e6544dce9999"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:025ba34a4cf4fb32f917d5d188ab5e702223d3ba603be4d8aca2f82bede432a4"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9f5f30c402ed58f90c70e12eff65547d3ab74685ffe8283c719e6bead8ef53f"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd96e5d15385d301733113bcaa324c8bcf111275b7675a9c6e88bfb19fc05e3b"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98f348cbb44fae6e9653c1055db7e29de67ea6a9ca03a5fa2c2e11a47cff0e47"}, + {file = "pydantic_core-2.41.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec22626a2d14620a83ca583c6f5a4080fa3155282718b6055c2ea48d3ef35970"}, + {file = "pydantic_core-2.41.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3a95d4590b1f1a43bf33ca6d647b990a88f4a3824a8c4572c708f0b45a5290ed"}, + {file = "pydantic_core-2.41.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:f9672ab4d398e1b602feadcffcdd3af44d5f5e6ddc15bc7d15d376d47e8e19f8"}, + {file = "pydantic_core-2.41.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:84d8854db5f55fead3b579f04bda9a36461dab0730c5d570e1526483e7bb8431"}, + {file = "pydantic_core-2.41.4-cp312-cp312-win32.whl", hash = "sha256:9be1c01adb2ecc4e464392c36d17f97e9110fbbc906bcbe1c943b5b87a74aabd"}, + {file = "pydantic_core-2.41.4-cp312-cp312-win_amd64.whl", hash = "sha256:d682cf1d22bab22a5be08539dca3d1593488a99998f9f412137bc323179067ff"}, + {file = "pydantic_core-2.41.4-cp312-cp312-win_arm64.whl", hash = "sha256:833eebfd75a26d17470b58768c1834dfc90141b7afc6eb0429c21fc5a21dcfb8"}, + {file = "pydantic_core-2.41.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:85e050ad9e5f6fe1004eec65c914332e52f429bc0ae12d6fa2092407a462c746"}, + {file = "pydantic_core-2.41.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e7393f1d64792763a48924ba31d1e44c2cfbc05e3b1c2c9abb4ceeadd912cced"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94dab0940b0d1fb28bcab847adf887c66a27a40291eedf0b473be58761c9799a"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:de7c42f897e689ee6f9e93c4bec72b99ae3b32a2ade1c7e4798e690ff5246e02"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:664b3199193262277b8b3cd1e754fb07f2c6023289c815a1e1e8fb415cb247b1"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d95b253b88f7d308b1c0b417c4624f44553ba4762816f94e6986819b9c273fb2"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a1351f5bbdbbabc689727cb91649a00cb9ee7203e0a6e54e9f5ba9e22e384b84"}, + {file = "pydantic_core-2.41.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1affa4798520b148d7182da0615d648e752de4ab1a9566b7471bc803d88a062d"}, + {file = "pydantic_core-2.41.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7b74e18052fea4aa8dea2fb7dbc23d15439695da6cbe6cfc1b694af1115df09d"}, + {file = "pydantic_core-2.41.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:285b643d75c0e30abda9dc1077395624f314a37e3c09ca402d4015ef5979f1a2"}, + {file = "pydantic_core-2.41.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:f52679ff4218d713b3b33f88c89ccbf3a5c2c12ba665fb80ccc4192b4608dbab"}, + {file = "pydantic_core-2.41.4-cp313-cp313-win32.whl", hash = "sha256:ecde6dedd6fff127c273c76821bb754d793be1024bc33314a120f83a3c69460c"}, + {file = "pydantic_core-2.41.4-cp313-cp313-win_amd64.whl", hash = "sha256:d081a1f3800f05409ed868ebb2d74ac39dd0c1ff6c035b5162356d76030736d4"}, + {file = "pydantic_core-2.41.4-cp313-cp313-win_arm64.whl", hash = "sha256:f8e49c9c364a7edcbe2a310f12733aad95b022495ef2a8d653f645e5d20c1564"}, + {file = "pydantic_core-2.41.4-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ed97fd56a561f5eb5706cebe94f1ad7c13b84d98312a05546f2ad036bafe87f4"}, + {file = "pydantic_core-2.41.4-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a870c307bf1ee91fc58a9a61338ff780d01bfae45922624816878dce784095d2"}, + {file = "pydantic_core-2.41.4-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d25e97bc1f5f8f7985bdc2335ef9e73843bb561eb1fa6831fdfc295c1c2061cf"}, + {file = "pydantic_core-2.41.4-cp313-cp313t-win_amd64.whl", hash = "sha256:d405d14bea042f166512add3091c1af40437c2e7f86988f3915fabd27b1e9cd2"}, + {file = "pydantic_core-2.41.4-cp313-cp313t-win_arm64.whl", hash = "sha256:19f3684868309db5263a11bace3c45d93f6f24afa2ffe75a647583df22a2ff89"}, + {file = "pydantic_core-2.41.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:e9205d97ed08a82ebb9a307e92914bb30e18cdf6f6b12ca4bedadb1588a0bfe1"}, + {file = "pydantic_core-2.41.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:82df1f432b37d832709fbcc0e24394bba04a01b6ecf1ee87578145c19cde12ac"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc3b4cc4539e055cfa39a3763c939f9d409eb40e85813257dcd761985a108554"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b1eb1754fce47c63d2ff57fdb88c351a6c0150995890088b33767a10218eaa4e"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e6ab5ab30ef325b443f379ddb575a34969c333004fca5a1daa0133a6ffaad616"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:31a41030b1d9ca497634092b46481b937ff9397a86f9f51bd41c4767b6fc04af"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a44ac1738591472c3d020f61c6df1e4015180d6262ebd39bf2aeb52571b60f12"}, + {file = "pydantic_core-2.41.4-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d72f2b5e6e82ab8f94ea7d0d42f83c487dc159c5240d8f83beae684472864e2d"}, + {file = "pydantic_core-2.41.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:c4d1e854aaf044487d31143f541f7aafe7b482ae72a022c664b2de2e466ed0ad"}, + {file = "pydantic_core-2.41.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b568af94267729d76e6ee5ececda4e283d07bbb28e8148bb17adad93d025d25a"}, + {file = "pydantic_core-2.41.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:6d55fb8b1e8929b341cc313a81a26e0d48aa3b519c1dbaadec3a6a2b4fcad025"}, + {file = "pydantic_core-2.41.4-cp314-cp314-win32.whl", hash = "sha256:5b66584e549e2e32a1398df11da2e0a7eff45d5c2d9db9d5667c5e6ac764d77e"}, + {file = "pydantic_core-2.41.4-cp314-cp314-win_amd64.whl", hash = "sha256:557a0aab88664cc552285316809cab897716a372afaf8efdbef756f8b890e894"}, + {file = "pydantic_core-2.41.4-cp314-cp314-win_arm64.whl", hash = "sha256:3f1ea6f48a045745d0d9f325989d8abd3f1eaf47dd00485912d1a3a63c623a8d"}, + {file = "pydantic_core-2.41.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:6c1fe4c5404c448b13188dd8bd2ebc2bdd7e6727fa61ff481bcc2cca894018da"}, + {file = "pydantic_core-2.41.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:523e7da4d43b113bf8e7b49fa4ec0c35bf4fe66b2230bfc5c13cc498f12c6c3e"}, + {file = "pydantic_core-2.41.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5729225de81fb65b70fdb1907fcf08c75d498f4a6f15af005aabb1fdadc19dfa"}, + {file = "pydantic_core-2.41.4-cp314-cp314t-win_amd64.whl", hash = "sha256:de2cfbb09e88f0f795fd90cf955858fc2c691df65b1f21f0aa00b99f3fbc661d"}, + {file = "pydantic_core-2.41.4-cp314-cp314t-win_arm64.whl", hash = "sha256:d34f950ae05a83e0ede899c595f312ca976023ea1db100cd5aa188f7005e3ab0"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:1e5ab4fc177dd41536b3c32b2ea11380dd3d4619a385860621478ac2d25ceb00"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:3d88d0054d3fa11ce936184896bed3c1c5441d6fa483b498fac6a5d0dd6f64a9"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7b2a054a8725f05b4b6503357e0ac1c4e8234ad3b0c2ac130d6ffc66f0e170e2"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b0d9db5a161c99375a0c68c058e227bee1d89303300802601d76a3d01f74e258"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:6273ea2c8ffdac7b7fda2653c49682db815aebf4a89243a6feccf5e36c18c347"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:4c973add636efc61de22530b2ef83a65f39b6d6f656df97f678720e20de26caa"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b69d1973354758007f46cf2d44a4f3d0933f10b6dc9bf15cf1356e037f6f731a"}, + {file = "pydantic_core-2.41.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:3619320641fd212aaf5997b6ca505e97540b7e16418f4a241f44cdf108ffb50d"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:491535d45cd7ad7e4a2af4a5169b0d07bebf1adfd164b0368da8aa41e19907a5"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:54d86c0cada6aba4ec4c047d0e348cbad7063b87ae0f005d9f8c9ad04d4a92a2"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eca1124aced216b2500dc2609eade086d718e8249cb9696660ab447d50a758bd"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6c9024169becccf0cb470ada03ee578d7348c119a0d42af3dcf9eda96e3a247c"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:26895a4268ae5a2849269f4991cdc97236e4b9c010e51137becf25182daac405"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:ca4df25762cf71308c446e33c9b1fdca2923a3f13de616e2a949f38bf21ff5a8"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:5a28fcedd762349519276c36634e71853b4541079cab4acaaac60c4421827308"}, + {file = "pydantic_core-2.41.4-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:c173ddcd86afd2535e2b695217e82191580663a1d1928239f877f5a1649ef39f"}, + {file = "pydantic_core-2.41.4.tar.gz", hash = "sha256:70e47929a9d4a1905a67e4b687d5946026390568a8e952b92824118063cee4d5"}, ] [[package]] name = "pygments" -version = "2.18.0" +version = "2.19.2" requires_python = ">=3.8" summary = "Pygments is a syntax highlighting package written in Python." -groups = ["default"] +groups = ["default", "dev"] files = [ - {file = "pygments-2.18.0-py3-none-any.whl", hash = "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a"}, - {file = "pygments-2.18.0.tar.gz", hash = "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199"}, + {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"}, + {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"}, ] [[package]] name = "pytest" -version = "8.3.4" -requires_python = ">=3.8" +version = "8.4.2" +requires_python = ">=3.9" summary = "pytest: simple powerful testing with Python" groups = ["dev"] dependencies = [ - "colorama; sys_platform == \"win32\"", - "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", - "iniconfig", - "packaging", + "colorama>=0.4; sys_platform == \"win32\"", + "exceptiongroup>=1; python_version < \"3.11\"", + "iniconfig>=1", + "packaging>=20", "pluggy<2,>=1.5", + "pygments>=2.7.2", "tomli>=1; python_version < \"3.11\"", ] files = [ - {file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"}, - {file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"}, + {file = "pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79"}, + {file = "pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01"}, ] [[package]] name = "pytest-cov" -version = "6.0.0" +version = "7.0.0" requires_python = ">=3.9" summary = "Pytest plugin for measuring coverage." groups = ["dev"] dependencies = [ - "coverage[toml]>=7.5", - "pytest>=4.6", + "coverage[toml]>=7.10.6", + "pluggy>=1.2", + "pytest>=7", ] files = [ - {file = "pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0"}, - {file = "pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35"}, + {file = "pytest_cov-7.0.0-py3-none-any.whl", hash = "sha256:3b8e9558b16cc1479da72058bdecf8073661c7f57f7d3c5f22a1c23507f2d861"}, + {file = "pytest_cov-7.0.0.tar.gz", hash = "sha256:33c97eda2e049a0c5298e91f519302a1334c26ac65c1a483d6206fd458361af1"}, ] [[package]] name = "pytest-mock" -version = "3.14.0" -requires_python = ">=3.8" +version = "3.15.1" +requires_python = ">=3.9" summary = "Thin-wrapper around the mock package for easier use with pytest" groups = ["dev"] dependencies = [ "pytest>=6.2.5", ] files = [ - {file = "pytest-mock-3.14.0.tar.gz", hash = "sha256:2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0"}, - {file = "pytest_mock-3.14.0-py3-none-any.whl", hash = "sha256:0b72c38033392a5f4621342fe11e9219ac11ec9d375f8e2a0c164539e0d70f6f"}, + {file = "pytest_mock-3.15.1-py3-none-any.whl", hash = "sha256:0a25e2eb88fe5168d535041d09a4529a188176ae608a6d249ee65abc0949630d"}, + {file = "pytest_mock-3.15.1.tar.gz", hash = "sha256:1849a238f6f396da19762269de72cb1814ab44416fa73a8686deac10b0d87a0f"}, ] [[package]] @@ -701,129 +806,114 @@ files = [ [[package]] name = "rich" -version = "13.9.4" +version = "14.2.0" requires_python = ">=3.8.0" summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" groups = ["default"] dependencies = [ "markdown-it-py>=2.2.0", "pygments<3.0.0,>=2.13.0", - "typing-extensions<5.0,>=4.0.0; python_version < \"3.11\"", ] files = [ - {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"}, - {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, + {file = "rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd"}, + {file = "rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4"}, ] [[package]] name = "ruamel-yaml" -version = "0.18.6" -requires_python = ">=3.7" +version = "0.18.16" +requires_python = ">=3.8" summary = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" -groups = ["default", "dev"] +groups = ["default"] dependencies = [ - "ruamel-yaml-clib>=0.2.7; platform_python_implementation == \"CPython\" and python_version < \"3.13\"", + "ruamel-yaml-clib>=0.2.7; platform_python_implementation == \"CPython\" and python_version < \"3.14\"", ] files = [ - {file = "ruamel.yaml-0.18.6-py3-none-any.whl", hash = "sha256:57b53ba33def16c4f3d807c0ccbc00f8a6081827e81ba2491691b76882d0c636"}, - {file = "ruamel.yaml-0.18.6.tar.gz", hash = "sha256:8b27e6a217e786c6fbe5634d8f3f11bc63e0f80f6a5890f28863d9c45aac311b"}, + {file = "ruamel.yaml-0.18.16-py3-none-any.whl", hash = "sha256:048f26d64245bae57a4f9ef6feb5b552a386830ef7a826f235ffb804c59efbba"}, + {file = "ruamel.yaml-0.18.16.tar.gz", hash = "sha256:a6e587512f3c998b2225d68aa1f35111c29fad14aed561a26e73fab729ec5e5a"}, ] [[package]] name = "ruamel-yaml-clib" -version = "0.2.12" +version = "0.2.14" requires_python = ">=3.9" summary = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" -groups = ["default", "dev"] -marker = "platform_python_implementation == \"CPython\" and python_version < \"3.13\"" -files = [ - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a606ef75a60ecf3d924613892cc603b154178ee25abb3055db5062da811fd969"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd5415dded15c3822597455bc02bcd66e81ef8b7a48cb71a33628fc9fdde39df"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f66efbc1caa63c088dead1c4170d148eabc9b80d95fb75b6c92ac0aad2437d76"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:22353049ba4181685023b25b5b51a574bce33e7f51c759371a7422dcae5402a6"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:932205970b9f9991b34f55136be327501903f7c66830e9760a8ffb15b07f05cd"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a52d48f4e7bf9005e8f0a89209bf9a73f7190ddf0489eee5eb51377385f59f2a"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-win32.whl", hash = "sha256:3eac5a91891ceb88138c113f9db04f3cebdae277f5d44eaa3651a4f573e6a5da"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-win_amd64.whl", hash = "sha256:ab007f2f5a87bd08ab1499bdf96f3d5c6ad4dcfa364884cb4549aa0154b13a28"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:4a6679521a58256a90b0d89e03992c15144c5f3858f40d7c18886023d7943db6"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:d84318609196d6bd6da0edfa25cedfbabd8dbde5140a0a23af29ad4b8f91fb1e"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb43a269eb827806502c7c8efb7ae7e9e9d0573257a46e8e952f4d4caba4f31e"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:811ea1594b8a0fb466172c384267a4e5e367298af6b228931f273b111f17ef52"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:cf12567a7b565cbf65d438dec6cfbe2917d3c1bdddfce84a9930b7d35ea59642"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7dd5adc8b930b12c8fc5b99e2d535a09889941aa0d0bd06f4749e9a9397c71d2"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1492a6051dab8d912fc2adeef0e8c72216b24d57bd896ea607cb90bb0c4981d3"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-win32.whl", hash = "sha256:bd0a08f0bab19093c54e18a14a10b4322e1eacc5217056f3c063bd2f59853ce4"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-win_amd64.whl", hash = "sha256:a274fb2cb086c7a3dea4322ec27f4cb5cc4b6298adb583ab0e211a4682f241eb"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:20b0f8dc160ba83b6dcc0e256846e1a02d044e13f7ea74a3d1d56ede4e48c632"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:943f32bc9dedb3abff9879edc134901df92cfce2c3d5c9348f172f62eb2d771d"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95c3829bb364fdb8e0332c9931ecf57d9be3519241323c5274bd82f709cebc0c"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:749c16fcc4a2b09f28843cda5a193e0283e47454b63ec4b81eaa2242f50e4ccd"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bf165fef1f223beae7333275156ab2022cffe255dcc51c27f066b4370da81e31"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:32621c177bbf782ca5a18ba4d7af0f1082a3f6e517ac2a18b3974d4edf349680"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b82a7c94a498853aa0b272fd5bc67f29008da798d4f93a2f9f289feb8426a58d"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-win32.whl", hash = "sha256:e8c4ebfcfd57177b572e2040777b8abc537cdef58a2120e830124946aa9b42c5"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-win_amd64.whl", hash = "sha256:0467c5965282c62203273b838ae77c0d29d7638c8a4e3a1c8bdd3602c10904e4"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:4c8c5d82f50bb53986a5e02d1b3092b03622c02c2eb78e29bec33fd9593bae1a"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux2014_aarch64.whl", hash = "sha256:e7e3736715fbf53e9be2a79eb4db68e4ed857017344d697e8b9749444ae57475"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b7e75b4965e1d4690e93021adfcecccbca7d61c7bddd8e22406ef2ff20d74ef"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96777d473c05ee3e5e3c3e999f5d23c6f4ec5b0c38c098b3a5229085f74236c6"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_1_i686.whl", hash = "sha256:3bc2a80e6420ca8b7d3590791e2dfc709c88ab9152c00eeb511c9875ce5778bf"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:e188d2699864c11c36cdfdada94d781fd5d6b0071cd9c427bceb08ad3d7c70e1"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4f6f3eac23941b32afccc23081e1f50612bdbe4e982012ef4f5797986828cd01"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-win32.whl", hash = "sha256:6442cb36270b3afb1b4951f060eccca1ce49f3d087ca1ca4563a6eb479cb3de6"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-win_amd64.whl", hash = "sha256:e5b8daf27af0b90da7bb903a876477a9e6d7270be6146906b276605997c7e9a3"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:fc4b630cd3fa2cf7fce38afa91d7cfe844a9f75d7f0f36393fa98815e911d987"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:bc5f1e1c28e966d61d2519f2a3d451ba989f9ea0f2307de7bc45baa526de9e45"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5a0e060aace4c24dcaf71023bbd7d42674e3b230f7e7b97317baf1e953e5b519"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e2f1c3765db32be59d18ab3953f43ab62a761327aafc1594a2a1fbe038b8b8a7"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:d85252669dc32f98ebcd5d36768f5d4faeaeaa2d655ac0473be490ecdae3c285"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:e143ada795c341b56de9418c58d028989093ee611aa27ffb9b7f609c00d813ed"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2c59aa6170b990d8d2719323e628aaf36f3bfbc1c26279c0eeeb24d05d2d11c7"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-win32.whl", hash = "sha256:beffaed67936fbbeffd10966a4eb53c402fafd3d6833770516bf7314bc6ffa12"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-win_amd64.whl", hash = "sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b"}, - {file = "ruamel.yaml.clib-0.2.12.tar.gz", hash = "sha256:6c8fbb13ec503f99a91901ab46e0b07ae7941cd527393187039aec586fdfd36f"}, -] - -[[package]] -name = "ruamel-yaml-string" -version = "0.1.1" -requires_python = ">=3" -summary = "add dump_to_string/dumps method that returns YAML document as string" -groups = ["dev"] -dependencies = [ - "ruamel-yaml>=0.17.17", -] +groups = ["default"] +marker = "platform_python_implementation == \"CPython\" and python_version < \"3.14\"" files = [ - {file = "ruamel.yaml.string-0.1.1-py3-none-any.whl", hash = "sha256:eb146bcb42b116216638034a434e9cf3ae2a5d3933aa37183a9854b5f3ff42de"}, - {file = "ruamel.yaml.string-0.1.1.tar.gz", hash = "sha256:7a7aedcc055d45c004d38b756f58474ebefb106851f4ce56ce58415709784350"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f8b2acb0ffdd2ce8208accbec2dca4a06937d556fdcaefd6473ba1b5daa7e3c4"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:aef953f3b8bd0b50bd52a2e52fb54a6a2171a1889d8dea4a5959d46c6624c451"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a0ac90efbc7a77b0d796c03c8cc4e62fd710b3f1e4c32947713ef2ef52e09543"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9bf6b699223afe6c7fe9f2ef76e0bfa6dd892c21e94ce8c957478987ade76cd8"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d73a0187718f6eec5b2f729b0f98e4603f7bd9c48aa65d01227d1a5dcdfbe9e8"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:81f6d3b19bc703679a5705c6a16dabdc79823c71d791d73c65949be7f3012c02"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b28caeaf3e670c08cb7e8de221266df8494c169bd6ed8875493fab45be9607a4"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:94f3efb718f8f49b031f2071ec7a27dd20cbfe511b4dfd54ecee54c956da2b31"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-win32.whl", hash = "sha256:27c070cf3888e90d992be75dd47292ff9aa17dafd36492812a6a304a1aedc182"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-win_amd64.whl", hash = "sha256:4f4a150a737fccae13fb51234d41304ff2222e3b7d4c8e9428ed1a6ab48389b8"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5bae1a073ca4244620425cd3d3aa9746bde590992b98ee8c7c8be8c597ca0d4e"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:0a54e5e40a7a691a426c2703b09b0d61a14294d25cfacc00631aa6f9c964df0d"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:10d9595b6a19778f3269399eff6bab642608e5966183abc2adbe558a42d4efc9"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dba72975485f2b87b786075e18a6e5d07dc2b4d8973beb2732b9b2816f1bad70"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29757bdb7c142f9595cc1b62ec49a3d1c83fab9cef92db52b0ccebaad4eafb98"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:557df28dbccf79b152fe2d1b935f6063d9cc431199ea2b0e84892f35c03bb0ee"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:26a8de280ab0d22b6e3ec745b4a5a07151a0f74aad92dd76ab9c8d8d7087720d"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e501c096aa3889133d674605ebd018471bc404a59cbc17da3c5924421c54d97c"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-win32.whl", hash = "sha256:915748cfc25b8cfd81b14d00f4bfdb2ab227a30d6d43459034533f4d1c207a2a"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-win_amd64.whl", hash = "sha256:4ccba93c1e5a40af45b2f08e4591969fa4697eae951c708f3f83dcbf9f6c6bb1"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:6aeadc170090ff1889f0d2c3057557f9cd71f975f17535c26a5d37af98f19c27"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:5e56ac47260c0eed992789fa0b8efe43404a9adb608608631a948cee4fc2b052"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:a911aa73588d9a8b08d662b9484bc0567949529824a55d3885b77e8dd62a127a"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a05ba88adf3d7189a974b2de7a9d56731548d35dc0a822ec3dc669caa7019b29"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fb04c5650de6668b853623eceadcdb1a9f2fee381f5d7b6bc842ee7c239eeec4"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:df3ec9959241d07bc261f4983d25a1205ff37703faf42b474f15d54d88b4f8c9"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fbc08c02e9b147a11dfcaa1ac8a83168b699863493e183f7c0c8b12850b7d259"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c099cafc1834d3c5dac305865d04235f7c21c167c8dd31ebc3d6bbc357e2f023"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-win32.whl", hash = "sha256:b5b0f7e294700b615a3bcf6d28b26e6da94e8eba63b079f4ec92e9ba6c0d6b54"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-win_amd64.whl", hash = "sha256:a37f40a859b503304dd740686359fcf541d6fb3ff7fc10f539af7f7150917c68"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7e4f9da7e7549946e02a6122dcad00b7c1168513acb1f8a726b1aaf504a99d32"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-macosx_15_0_arm64.whl", hash = "sha256:dd7546c851e59c06197a7c651335755e74aa383a835878ca86d2c650c07a2f85"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux2014_aarch64.whl", hash = "sha256:1c1acc3a0209ea9042cc3cfc0790edd2eddd431a2ec3f8283d081e4d5018571e"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2070bf0ad1540d5c77a664de07ebcc45eebd1ddcab71a7a06f26936920692beb"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bd8fe07f49c170e09d76773fb86ad9135e0beee44f36e1576a201b0676d3d1d"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ff86876889ea478b1381089e55cf9e345707b312beda4986f823e1d95e8c0f59"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:1f118b707eece8cf84ecbc3e3ec94d9db879d85ed608f95870d39b2d2efa5dca"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b30110b29484adc597df6bd92a37b90e63a8c152ca8136aad100a02f8ba6d1b6"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-win32.whl", hash = "sha256:f4e97a1cf0b7a30af9e1d9dad10a5671157b9acee790d9e26996391f49b965a2"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-win_amd64.whl", hash = "sha256:090782b5fb9d98df96509eecdbcaffd037d47389a89492320280d52f91330d78"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:7df6f6e9d0e33c7b1d435defb185095386c469109de723d514142632a7b9d07f"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-macosx_15_0_arm64.whl", hash = "sha256:70eda7703b8126f5e52fcf276e6c0f40b0d314674f896fc58c47b0aef2b9ae83"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:a0cb71ccc6ef9ce36eecb6272c81afdc2f565950cdcec33ae8e6cd8f7fc86f27"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e7cb9ad1d525d40f7d87b6df7c0ff916a66bc52cb61b66ac1b2a16d0c1b07640"}, + {file = "ruamel.yaml.clib-0.2.14.tar.gz", hash = "sha256:803f5044b13602d58ea378576dd75aa759f52116a0232608e8fdada4da33752e"}, ] [[package]] name = "ruff" -version = "0.8.4" +version = "0.14.3" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." groups = ["default"] files = [ - {file = "ruff-0.8.4-py3-none-linux_armv6l.whl", hash = "sha256:58072f0c06080276804c6a4e21a9045a706584a958e644353603d36ca1eb8a60"}, - {file = "ruff-0.8.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ffb60904651c00a1e0b8df594591770018a0f04587f7deeb3838344fe3adabac"}, - {file = "ruff-0.8.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ddf5d654ac0d44389f6bf05cee4caeefc3132a64b58ea46738111d687352296"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e248b1f0fa2749edd3350a2a342b67b43a2627434c059a063418e3d375cfe643"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bf197b98ed86e417412ee3b6c893f44c8864f816451441483253d5ff22c0e81e"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c41319b85faa3aadd4d30cb1cffdd9ac6b89704ff79f7664b853785b48eccdf3"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9f8402b7c4f96463f135e936d9ab77b65711fcd5d72e5d67597b543bbb43cf3f"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e4e56b3baa9c23d324ead112a4fdf20db9a3f8f29eeabff1355114dd96014604"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:736272574e97157f7edbbb43b1d046125fce9e7d8d583d5d65d0c9bf2c15addf"}, - {file = "ruff-0.8.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5fe710ab6061592521f902fca7ebcb9fabd27bc7c57c764298b1c1f15fff720"}, - {file = "ruff-0.8.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:13e9ec6d6b55f6da412d59953d65d66e760d583dd3c1c72bf1f26435b5bfdbae"}, - {file = "ruff-0.8.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:97d9aefef725348ad77d6db98b726cfdb075a40b936c7984088804dfd38268a7"}, - {file = "ruff-0.8.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ab78e33325a6f5374e04c2ab924a3367d69a0da36f8c9cb6b894a62017506111"}, - {file = "ruff-0.8.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8ef06f66f4a05c3ddbc9121a8b0cecccd92c5bf3dd43b5472ffe40b8ca10f0f8"}, - {file = "ruff-0.8.4-py3-none-win32.whl", hash = "sha256:552fb6d861320958ca5e15f28b20a3d071aa83b93caee33a87b471f99a6c0835"}, - {file = "ruff-0.8.4-py3-none-win_amd64.whl", hash = "sha256:f21a1143776f8656d7f364bd264a9d60f01b7f52243fbe90e7670c0dfe0cf65d"}, - {file = "ruff-0.8.4-py3-none-win_arm64.whl", hash = "sha256:9183dd615d8df50defa8b1d9a074053891ba39025cf5ae88e8bcb52edcc4bf08"}, - {file = "ruff-0.8.4.tar.gz", hash = "sha256:0d5f89f254836799af1615798caa5f80b7f935d7a670fad66c5007928e57ace8"}, + {file = "ruff-0.14.3-py3-none-linux_armv6l.whl", hash = "sha256:876b21e6c824f519446715c1342b8e60f97f93264012de9d8d10314f8a79c371"}, + {file = "ruff-0.14.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b6fd8c79b457bedd2abf2702b9b472147cd860ed7855c73a5247fa55c9117654"}, + {file = "ruff-0.14.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:71ff6edca490c308f083156938c0c1a66907151263c4abdcb588602c6e696a14"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:786ee3ce6139772ff9272aaf43296d975c0217ee1b97538a98171bf0d21f87ed"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cd6291d0061811c52b8e392f946889916757610d45d004e41140d81fb6cd5ddc"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a497ec0c3d2c88561b6d90f9c29f5ae68221ac00d471f306fa21fa4264ce5fcd"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e231e1be58fc568950a04fbe6887c8e4b85310e7889727e2b81db205c45059eb"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:469e35872a09c0e45fecf48dd960bfbce056b5db2d5e6b50eca329b4f853ae20"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d6bc90307c469cb9d28b7cfad90aaa600b10d67c6e22026869f585e1e8a2db0"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2f8a0bbcffcfd895df39c9a4ecd59bb80dca03dc43f7fb63e647ed176b741e"}, + {file = "ruff-0.14.3-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:678fdd7c7d2d94851597c23ee6336d25f9930b460b55f8598e011b57c74fd8c5"}, + {file = "ruff-0.14.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1ec1ac071e7e37e0221d2f2dbaf90897a988c531a8592a6a5959f0603a1ecf5e"}, + {file = "ruff-0.14.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:afcdc4b5335ef440d19e7df9e8ae2ad9f749352190e96d481dc501b753f0733e"}, + {file = "ruff-0.14.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:7bfc42f81862749a7136267a343990f865e71fe2f99cf8d2958f684d23ce3dfa"}, + {file = "ruff-0.14.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a65e448cfd7e9c59fae8cf37f9221585d3354febaad9a07f29158af1528e165f"}, + {file = "ruff-0.14.3-py3-none-win32.whl", hash = "sha256:f3d91857d023ba93e14ed2d462ab62c3428f9bbf2b4fbac50a03ca66d31991f7"}, + {file = "ruff-0.14.3-py3-none-win_amd64.whl", hash = "sha256:d7b7006ac0756306db212fd37116cce2bd307e1e109375e1c6c106002df0ae5f"}, + {file = "ruff-0.14.3-py3-none-win_arm64.whl", hash = "sha256:26eb477ede6d399d898791d01961e16b86f02bc2486d0d1a7a9bb2379d055dc1"}, + {file = "ruff-0.14.3.tar.gz", hash = "sha256:4ff876d2ab2b161b6de0aa1f5bd714e8e9b4033dc122ee006925fbacc4f62153"}, ] [[package]] @@ -861,64 +951,74 @@ files = [ [[package]] name = "syrupy" -version = "4.8.0" -requires_python = ">=3.8.1" +version = "5.0.0" +requires_python = ">=3.10" summary = "Pytest Snapshot Test Utility" groups = ["dev"] dependencies = [ - "pytest<9.0.0,>=7.0.0", + "pytest>=8.0.0", ] files = [ - {file = "syrupy-4.8.0-py3-none-any.whl", hash = "sha256:544f4ec6306f4b1c460fdab48fd60b2c7fe54a6c0a8243aeea15f9ad9c638c3f"}, - {file = "syrupy-4.8.0.tar.gz", hash = "sha256:648f0e9303aaa8387c8365d7314784c09a6bab0a407455c6a01d6a4f5c6a8ede"}, + {file = "syrupy-5.0.0-py3-none-any.whl", hash = "sha256:c848e1a980ca52a28715cd2d2b4d434db424699c05653bd1158fb31cf56e9546"}, + {file = "syrupy-5.0.0.tar.gz", hash = "sha256:3282fe963fa5d4d3e47231b16d1d4d0f4523705e8199eeb99a22a1bc9f5942f2"}, ] [[package]] name = "tomli" -version = "2.2.1" +version = "2.3.0" requires_python = ">=3.8" summary = "A lil' TOML parser" groups = ["dev"] marker = "python_version < \"3.11\"" files = [ - {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, - {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, - {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, - {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, - {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, - {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, - {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, - {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, - {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, - {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, + {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, + {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, + {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, + {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, + {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, + {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, + {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, + {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, + {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, + {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, + {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, + {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, ] [[package]] name = "typer" -version = "0.15.1" -requires_python = ">=3.7" +version = "0.20.0" +requires_python = ">=3.8" summary = "Typer, build great CLIs. Easy to code. Based on Python type hints." groups = ["default"] dependencies = [ @@ -928,8 +1028,8 @@ dependencies = [ "typing-extensions>=3.7.4.3", ] files = [ - {file = "typer-0.15.1-py3-none-any.whl", hash = "sha256:7994fb7b8155b64d3402518560648446072864beefd44aa2dc36972a5972e847"}, - {file = "typer-0.15.1.tar.gz", hash = "sha256:a0588c0a7fa68a1978a069818657778f86abe6ff5ea6abf472f940a08bfe4f0a"}, + {file = "typer-0.20.0-py3-none-any.whl", hash = "sha256:5b463df6793ec1dca6213a3cf4c0f03bc6e322ac5e16e13ddd622a889489784a"}, + {file = "typer-0.20.0.tar.gz", hash = "sha256:1aaf6494031793e4876fb0bacfa6a912b551cf43c1e63c800df8b1a866720c37"}, ] [[package]] @@ -944,33 +1044,47 @@ files = [ [[package]] name = "types-python-dateutil" -version = "2.9.0.20241206" -requires_python = ">=3.8" +version = "2.9.0.20251008" +requires_python = ">=3.9" summary = "Typing stubs for python-dateutil" groups = ["dev"] files = [ - {file = "types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53"}, - {file = "types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb"}, + {file = "types_python_dateutil-2.9.0.20251008-py3-none-any.whl", hash = "sha256:b9a5232c8921cf7661b29c163ccc56055c418ab2c6eabe8f917cbcc73a4c4157"}, + {file = "types_python_dateutil-2.9.0.20251008.tar.gz", hash = "sha256:c3826289c170c93ebd8360c3485311187df740166dbab9dd3b792e69f2bc1f9c"}, ] [[package]] name = "types-pyyaml" -version = "6.0.12.20241221" -requires_python = ">=3.8" +version = "6.0.12.20250915" +requires_python = ">=3.9" summary = "Typing stubs for PyYAML" groups = ["dev"] files = [ - {file = "types_PyYAML-6.0.12.20241221-py3-none-any.whl", hash = "sha256:0657a4ff8411a030a2116a196e8e008ea679696b5b1a8e1a6aa8ebb737b34688"}, - {file = "types_pyyaml-6.0.12.20241221.tar.gz", hash = "sha256:4f149aa893ff6a46889a30af4c794b23833014c469cc57cbc3ad77498a58996f"}, + {file = "types_pyyaml-6.0.12.20250915-py3-none-any.whl", hash = "sha256:e7d4d9e064e89a3b3cae120b4990cd370874d2bf12fa5f46c97018dd5d3c9ab6"}, + {file = "types_pyyaml-6.0.12.20250915.tar.gz", hash = "sha256:0f8b54a528c303f0e6f7165687dd33fafa81c807fcac23f632b63aa624ced1d3"}, ] [[package]] name = "typing-extensions" -version = "4.12.2" -requires_python = ">=3.8" -summary = "Backported and Experimental Type Hints for Python 3.8+" +version = "4.15.0" +requires_python = ">=3.9" +summary = "Backported and Experimental Type Hints for Python 3.9+" groups = ["default", "dev"] files = [ - {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, - {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, + {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, + {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, +] + +[[package]] +name = "typing-inspection" +version = "0.4.2" +requires_python = ">=3.9" +summary = "Runtime typing introspection tools" +groups = ["default"] +dependencies = [ + "typing-extensions>=4.12.0", +] +files = [ + {file = "typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7"}, + {file = "typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464"}, ] diff --git a/pdm.minimal.lock b/pdm.minimal.lock index 8b9ef2698..a413f6a86 100644 --- a/pdm.minimal.lock +++ b/pdm.minimal.lock @@ -5,10 +5,10 @@ groups = ["default", "dev"] strategy = ["direct_minimal_versions", "inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:7f8035cfb12eec0bca9053eb34cc6b70a1cfbf464921c1abb3ae3c3e63cfeab4" +content_hash = "sha256:f55a39ef7a9c0210dab1151ceda8e273982dbeff1a97cb10553cb7838c8a1f2e" [[metadata.targets]] -requires_python = "~=3.9" +requires_python = "~=3.10" [[package]] name = "annotated-types" @@ -54,104 +54,27 @@ files = [ [[package]] name = "certifi" -version = "2024.12.14" -requires_python = ">=3.6" -summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default"] -files = [ - {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, - {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, -] - -[[package]] -name = "charset-normalizer" -version = "3.4.1" +version = "2025.10.5" requires_python = ">=3.7" -summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +summary = "Python package for providing Mozilla's CA Bundle." groups = ["default"] files = [ - {file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-win32.whl", hash = "sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f"}, - {file = "charset_normalizer-3.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-win32.whl", hash = "sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b"}, - {file = "charset_normalizer-3.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-win32.whl", hash = "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35"}, - {file = "charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-win32.whl", hash = "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407"}, - {file = "charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-win32.whl", hash = "sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5"}, - {file = "charset_normalizer-3.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765"}, - {file = "charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85"}, - {file = "charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3"}, + {file = "certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de"}, + {file = "certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43"}, ] [[package]] name = "click" -version = "8.1.8" -requires_python = ">=3.7" +version = "8.3.0" +requires_python = ">=3.10" summary = "Composable command line interface toolkit" groups = ["default"] dependencies = [ "colorama; platform_system == \"Windows\"", - "importlib-metadata; python_version < \"3.8\"", ] files = [ - {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, - {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, + {file = "click-8.3.0-py3-none-any.whl", hash = "sha256:9b9f285302c6e3064f4330c05f05b81945b2a39544279343e6e7c5f27a9baddc"}, + {file = "click-8.3.0.tar.gz", hash = "sha256:e7b8232224eba16f4ebe410c25ced9f7875cb5f3263ffc93cc3e8da705e229c4"}, ] [[package]] @@ -168,85 +91,118 @@ files = [ [[package]] name = "coverage" -version = "7.6.9" -requires_python = ">=3.9" +version = "7.11.0" +requires_python = ">=3.10" summary = "Code coverage measurement for Python" groups = ["dev"] files = [ - {file = "coverage-7.6.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:85d9636f72e8991a1706b2b55b06c27545448baf9f6dbf51c4004609aacd7dcb"}, - {file = "coverage-7.6.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:608a7fd78c67bee8936378299a6cb9f5149bb80238c7a566fc3e6717a4e68710"}, - {file = "coverage-7.6.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:96d636c77af18b5cb664ddf12dab9b15a0cfe9c0bde715da38698c8cea748bfa"}, - {file = "coverage-7.6.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d75cded8a3cff93da9edc31446872d2997e327921d8eed86641efafd350e1df1"}, - {file = "coverage-7.6.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f7b15f589593110ae767ce997775d645b47e5cbbf54fd322f8ebea6277466cec"}, - {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:44349150f6811b44b25574839b39ae35291f6496eb795b7366fef3bd3cf112d3"}, - {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:d891c136b5b310d0e702e186d70cd16d1119ea8927347045124cb286b29297e5"}, - {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:db1dab894cc139f67822a92910466531de5ea6034ddfd2b11c0d4c6257168073"}, - {file = "coverage-7.6.9-cp310-cp310-win32.whl", hash = "sha256:41ff7b0da5af71a51b53f501a3bac65fb0ec311ebed1632e58fc6107f03b9198"}, - {file = "coverage-7.6.9-cp310-cp310-win_amd64.whl", hash = "sha256:35371f8438028fdccfaf3570b31d98e8d9eda8bb1d6ab9473f5a390969e98717"}, - {file = "coverage-7.6.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:932fc826442132dde42ee52cf66d941f581c685a6313feebed358411238f60f9"}, - {file = "coverage-7.6.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:085161be5f3b30fd9b3e7b9a8c301f935c8313dcf928a07b116324abea2c1c2c"}, - {file = "coverage-7.6.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ccc660a77e1c2bf24ddbce969af9447a9474790160cfb23de6be4fa88e3951c7"}, - {file = "coverage-7.6.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c69e42c892c018cd3c8d90da61d845f50a8243062b19d228189b0224150018a9"}, - {file = "coverage-7.6.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0824a28ec542a0be22f60c6ac36d679e0e262e5353203bea81d44ee81fe9c6d4"}, - {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4401ae5fc52ad8d26d2a5d8a7428b0f0c72431683f8e63e42e70606374c311a1"}, - {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:98caba4476a6c8d59ec1eb00c7dd862ba9beca34085642d46ed503cc2d440d4b"}, - {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ee5defd1733fd6ec08b168bd4f5387d5b322f45ca9e0e6c817ea6c4cd36313e3"}, - {file = "coverage-7.6.9-cp311-cp311-win32.whl", hash = "sha256:f2d1ec60d6d256bdf298cb86b78dd715980828f50c46701abc3b0a2b3f8a0dc0"}, - {file = "coverage-7.6.9-cp311-cp311-win_amd64.whl", hash = "sha256:0d59fd927b1f04de57a2ba0137166d31c1a6dd9e764ad4af552912d70428c92b"}, - {file = "coverage-7.6.9-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:99e266ae0b5d15f1ca8d278a668df6f51cc4b854513daab5cae695ed7b721cf8"}, - {file = "coverage-7.6.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9901d36492009a0a9b94b20e52ebfc8453bf49bb2b27bca2c9706f8b4f5a554a"}, - {file = "coverage-7.6.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:abd3e72dd5b97e3af4246cdada7738ef0e608168de952b837b8dd7e90341f015"}, - {file = "coverage-7.6.9-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ff74026a461eb0660366fb01c650c1d00f833a086b336bdad7ab00cc952072b3"}, - {file = "coverage-7.6.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65dad5a248823a4996724a88eb51d4b31587aa7aa428562dbe459c684e5787ae"}, - {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:22be16571504c9ccea919fcedb459d5ab20d41172056206eb2994e2ff06118a4"}, - {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f957943bc718b87144ecaee70762bc2bc3f1a7a53c7b861103546d3a403f0a6"}, - {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0ae1387db4aecb1f485fb70a6c0148c6cdaebb6038f1d40089b1fc84a5db556f"}, - {file = "coverage-7.6.9-cp312-cp312-win32.whl", hash = "sha256:1a330812d9cc7ac2182586f6d41b4d0fadf9be9049f350e0efb275c8ee8eb692"}, - {file = "coverage-7.6.9-cp312-cp312-win_amd64.whl", hash = "sha256:b12c6b18269ca471eedd41c1b6a1065b2f7827508edb9a7ed5555e9a56dcfc97"}, - {file = "coverage-7.6.9-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:899b8cd4781c400454f2f64f7776a5d87bbd7b3e7f7bda0cb18f857bb1334664"}, - {file = "coverage-7.6.9-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:61f70dc68bd36810972e55bbbe83674ea073dd1dcc121040a08cdf3416c5349c"}, - {file = "coverage-7.6.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8a289d23d4c46f1a82d5db4abeb40b9b5be91731ee19a379d15790e53031c014"}, - {file = "coverage-7.6.9-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7e216d8044a356fc0337c7a2a0536d6de07888d7bcda76febcb8adc50bdbbd00"}, - {file = "coverage-7.6.9-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c026eb44f744acaa2bda7493dad903aa5bf5fc4f2554293a798d5606710055d"}, - {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e77363e8425325384f9d49272c54045bbed2f478e9dd698dbc65dbc37860eb0a"}, - {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:777abfab476cf83b5177b84d7486497e034eb9eaea0d746ce0c1268c71652077"}, - {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:447af20e25fdbe16f26e84eb714ba21d98868705cb138252d28bc400381f6ffb"}, - {file = "coverage-7.6.9-cp313-cp313-win32.whl", hash = "sha256:d872ec5aeb086cbea771c573600d47944eea2dcba8be5f3ee649bfe3cb8dc9ba"}, - {file = "coverage-7.6.9-cp313-cp313-win_amd64.whl", hash = "sha256:fd1213c86e48dfdc5a0cc676551db467495a95a662d2396ecd58e719191446e1"}, - {file = "coverage-7.6.9-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:ba9e7484d286cd5a43744e5f47b0b3fb457865baf07bafc6bee91896364e1419"}, - {file = "coverage-7.6.9-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e5ea1cf0872ee455c03e5674b5bca5e3e68e159379c1af0903e89f5eba9ccc3a"}, - {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d10e07aa2b91835d6abec555ec8b2733347956991901eea6ffac295f83a30e4"}, - {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:13a9e2d3ee855db3dd6ea1ba5203316a1b1fd8eaeffc37c5b54987e61e4194ae"}, - {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c38bf15a40ccf5619fa2fe8f26106c7e8e080d7760aeccb3722664c8656b030"}, - {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:d5275455b3e4627c8e7154feaf7ee0743c2e7af82f6e3b561967b1cca755a0be"}, - {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:8f8770dfc6e2c6a2d4569f411015c8d751c980d17a14b0530da2d7f27ffdd88e"}, - {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8d2dfa71665a29b153a9681edb1c8d9c1ea50dfc2375fb4dac99ea7e21a0bcd9"}, - {file = "coverage-7.6.9-cp313-cp313t-win32.whl", hash = "sha256:5e6b86b5847a016d0fbd31ffe1001b63355ed309651851295315031ea7eb5a9b"}, - {file = "coverage-7.6.9-cp313-cp313t-win_amd64.whl", hash = "sha256:97ddc94d46088304772d21b060041c97fc16bdda13c6c7f9d8fcd8d5ae0d8611"}, - {file = "coverage-7.6.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:adb697c0bd35100dc690de83154627fbab1f4f3c0386df266dded865fc50a902"}, - {file = "coverage-7.6.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:be57b6d56e49c2739cdf776839a92330e933dd5e5d929966fbbd380c77f060be"}, - {file = "coverage-7.6.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1592791f8204ae9166de22ba7e6705fa4ebd02936c09436a1bb85aabca3e599"}, - {file = "coverage-7.6.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e12ae8cc979cf83d258acb5e1f1cf2f3f83524d1564a49d20b8bec14b637f08"}, - {file = "coverage-7.6.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb5555cff66c4d3d6213a296b360f9e1a8e323e74e0426b6c10ed7f4d021e464"}, - {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:b9389a429e0e5142e69d5bf4a435dd688c14478a19bb901735cdf75e57b13845"}, - {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:592ac539812e9b46046620341498caf09ca21023c41c893e1eb9dbda00a70cbf"}, - {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a27801adef24cc30871da98a105f77995e13a25a505a0161911f6aafbd66e678"}, - {file = "coverage-7.6.9-cp39-cp39-win32.whl", hash = "sha256:8e3c3e38930cfb729cb8137d7f055e5a473ddaf1217966aa6238c88bd9fd50e6"}, - {file = "coverage-7.6.9-cp39-cp39-win_amd64.whl", hash = "sha256:e28bf44afa2b187cc9f41749138a64435bf340adfcacb5b2290c070ce99839d4"}, - {file = "coverage-7.6.9-pp39.pp310-none-any.whl", hash = "sha256:f3ca78518bc6bc92828cd11867b121891d75cae4ea9e908d72030609b996db1b"}, - {file = "coverage-7.6.9.tar.gz", hash = "sha256:4a8d8977b0c6ef5aeadcb644da9e69ae0dcfe66ec7f368c89c72e058bd71164d"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eb53f1e8adeeb2e78962bade0c08bfdc461853c7969706ed901821e009b35e31"}, + {file = "coverage-7.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d9a03ec6cb9f40a5c360f138b88266fd8f58408d71e89f536b4f91d85721d075"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0d7f0616c557cbc3d1c2090334eddcbb70e1ae3a40b07222d62b3aa47f608fab"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e44a86a47bbdf83b0a3ea4d7df5410d6b1a0de984fbd805fa5101f3624b9abe0"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:596763d2f9a0ee7eec6e643e29660def2eef297e1de0d334c78c08706f1cb785"}, + {file = "coverage-7.11.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef55537ff511b5e0a43edb4c50a7bf7ba1c3eea20b4f49b1490f1e8e0e42c591"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9cbabd8f4d0d3dc571d77ae5bdbfa6afe5061e679a9d74b6797c48d143307088"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e24045453384e0ae2a587d562df2a04d852672eb63051d16096d3f08aa4c7c2f"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:7161edd3426c8d19bdccde7d49e6f27f748f3c31cc350c5de7c633fea445d866"}, + {file = "coverage-7.11.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d4ed4de17e692ba6415b0587bc7f12bc80915031fc9db46a23ce70fc88c9841"}, + {file = "coverage-7.11.0-cp310-cp310-win32.whl", hash = "sha256:765c0bc8fe46f48e341ef737c91c715bd2a53a12792592296a095f0c237e09cf"}, + {file = "coverage-7.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:24d6f3128f1b2d20d84b24f4074475457faedc3d4613a7e66b5e769939c7d969"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d58ecaa865c5b9fa56e35efc51d1014d4c0d22838815b9fce57a27dd9576847"}, + {file = "coverage-7.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b679e171f1c104a5668550ada700e3c4937110dbdd153b7ef9055c4f1a1ee3cc"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ca61691ba8c5b6797deb221a0d09d7470364733ea9c69425a640f1f01b7c5bf0"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aef1747ede4bd8ca9cfc04cc3011516500c6891f1b33a94add3253f6f876b7b7"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a1839d08406e4cba2953dcc0ffb312252f14d7c4c96919f70167611f4dee2623"}, + {file = "coverage-7.11.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e0eb0a2dcc62478eb5b4cbb80b97bdee852d7e280b90e81f11b407d0b81c4287"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bc1fbea96343b53f65d5351d8fd3b34fd415a2670d7c300b06d3e14a5af4f552"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:214b622259dd0cf435f10241f1333d32caa64dbc27f8790ab693428a141723de"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:258d9967520cca899695d4eb7ea38be03f06951d6ca2f21fb48b1235f791e601"}, + {file = "coverage-7.11.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cf9e6ff4ca908ca15c157c409d608da77a56a09877b97c889b98fb2c32b6465e"}, + {file = "coverage-7.11.0-cp311-cp311-win32.whl", hash = "sha256:fcc15fc462707b0680cff6242c48625da7f9a16a28a41bb8fd7a4280920e676c"}, + {file = "coverage-7.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:865965bf955d92790f1facd64fe7ff73551bd2c1e7e6b26443934e9701ba30b9"}, + {file = "coverage-7.11.0-cp311-cp311-win_arm64.whl", hash = "sha256:5693e57a065760dcbeb292d60cc4d0231a6d4b6b6f6a3191561e1d5e8820b745"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:9c49e77811cf9d024b95faf86c3f059b11c0c9be0b0d61bc598f453703bd6fd1"}, + {file = "coverage-7.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a61e37a403a778e2cda2a6a39abcc895f1d984071942a41074b5c7ee31642007"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c79cae102bb3b1801e2ef1511fb50e91ec83a1ce466b2c7c25010d884336de46"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:16ce17ceb5d211f320b62df002fa7016b7442ea0fd260c11cec8ce7730954893"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:80027673e9d0bd6aef86134b0771845e2da85755cf686e7c7c59566cf5a89115"}, + {file = "coverage-7.11.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d3ffa07a08657306cd2215b0da53761c4d73cb54d9143b9303a6481ec0cd415"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a3b6a5f8b2524fd6c1066bc85bfd97e78709bb5e37b5b94911a6506b65f47186"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fcc0a4aa589de34bc56e1a80a740ee0f8c47611bdfb28cd1849de60660f3799d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:dba82204769d78c3fd31b35c3d5f46e06511936c5019c39f98320e05b08f794d"}, + {file = "coverage-7.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:81b335f03ba67309a95210caf3eb43bd6fe75a4e22ba653ef97b4696c56c7ec2"}, + {file = "coverage-7.11.0-cp312-cp312-win32.whl", hash = "sha256:037b2d064c2f8cc8716fe4d39cb705779af3fbf1ba318dc96a1af858888c7bb5"}, + {file = "coverage-7.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:d66c0104aec3b75e5fd897e7940188ea1892ca1d0235316bf89286d6a22568c0"}, + {file = "coverage-7.11.0-cp312-cp312-win_arm64.whl", hash = "sha256:d91ebeac603812a09cf6a886ba6e464f3bbb367411904ae3790dfe28311b15ad"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:cc3f49e65ea6e0d5d9bd60368684fe52a704d46f9e7fc413918f18d046ec40e1"}, + {file = "coverage-7.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f39ae2f63f37472c17b4990f794035c9890418b1b8cca75c01193f3c8d3e01be"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7db53b5cdd2917b6eaadd0b1251cf4e7d96f4a8d24e174bdbdf2f65b5ea7994d"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10ad04ac3a122048688387828b4537bc9cf60c0bf4869c1e9989c46e45690b82"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4036cc9c7983a2b1f2556d574d2eb2154ac6ed55114761685657e38782b23f52"}, + {file = "coverage-7.11.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7ab934dd13b1c5e94b692b1e01bd87e4488cb746e3a50f798cb9464fd128374b"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59a6e5a265f7cfc05f76e3bb53eca2e0dfe90f05e07e849930fecd6abb8f40b4"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:df01d6c4c81e15a7c88337b795bb7595a8596e92310266b5072c7e301168efbd"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:8c934bd088eed6174210942761e38ee81d28c46de0132ebb1801dbe36a390dcc"}, + {file = "coverage-7.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5a03eaf7ec24078ad64a07f02e30060aaf22b91dedf31a6b24d0d98d2bba7f48"}, + {file = "coverage-7.11.0-cp313-cp313-win32.whl", hash = "sha256:695340f698a5f56f795b2836abe6fb576e7c53d48cd155ad2f80fd24bc63a040"}, + {file = "coverage-7.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:2727d47fce3ee2bac648528e41455d1b0c46395a087a229deac75e9f88ba5a05"}, + {file = "coverage-7.11.0-cp313-cp313-win_arm64.whl", hash = "sha256:0efa742f431529699712b92ecdf22de8ff198df41e43aeaaadf69973eb93f17a"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:587c38849b853b157706407e9ebdca8fd12f45869edb56defbef2daa5fb0812b"}, + {file = "coverage-7.11.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b971bdefdd75096163dd4261c74be813c4508477e39ff7b92191dea19f24cd37"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:269bfe913b7d5be12ab13a95f3a76da23cf147be7fa043933320ba5625f0a8de"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dadbcce51a10c07b7c72b0ce4a25e4b6dcb0c0372846afb8e5b6307a121eb99f"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ed43fa22c6436f7957df036331f8fe4efa7af132054e1844918866cd228af6c"}, + {file = "coverage-7.11.0-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9516add7256b6713ec08359b7b05aeff8850c98d357784c7205b2e60aa2513fa"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:eb92e47c92fcbcdc692f428da67db33337fa213756f7adb6a011f7b5a7a20740"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:d06f4fc7acf3cabd6d74941d53329e06bab00a8fe10e4df2714f0b134bfc64ef"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:6fbcee1a8f056af07ecd344482f711f563a9eb1c2cad192e87df00338ec3cdb0"}, + {file = "coverage-7.11.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dbbf012be5f32533a490709ad597ad8a8ff80c582a95adc8d62af664e532f9ca"}, + {file = "coverage-7.11.0-cp313-cp313t-win32.whl", hash = "sha256:cee6291bb4fed184f1c2b663606a115c743df98a537c969c3c64b49989da96c2"}, + {file = "coverage-7.11.0-cp313-cp313t-win_amd64.whl", hash = "sha256:a386c1061bf98e7ea4758e4313c0ab5ecf57af341ef0f43a0bf26c2477b5c268"}, + {file = "coverage-7.11.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f9ea02ef40bb83823b2b04964459d281688fe173e20643870bb5d2edf68bc836"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c770885b28fb399aaf2a65bbd1c12bf6f307ffd112d6a76c5231a94276f0c497"}, + {file = "coverage-7.11.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a3d0e2087dba64c86a6b254f43e12d264b636a39e88c5cc0a01a7c71bcfdab7e"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:73feb83bb41c32811973b8565f3705caf01d928d972b72042b44e97c71fd70d1"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c6f31f281012235ad08f9a560976cc2fc9c95c17604ff3ab20120fe480169bca"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9570ad567f880ef675673992222746a124b9595506826b210fbe0ce3f0499cd"}, + {file = "coverage-7.11.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8badf70446042553a773547a61fecaa734b55dc738cacf20c56ab04b77425e43"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a09c1211959903a479e389685b7feb8a17f59ec5a4ef9afde7650bd5eabc2777"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:5ef83b107f50db3f9ae40f69e34b3bd9337456c5a7fe3461c7abf8b75dd666a2"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:f91f927a3215b8907e214af77200250bb6aae36eca3f760f89780d13e495388d"}, + {file = "coverage-7.11.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:cdbcd376716d6b7fbfeedd687a6c4be019c5a5671b35f804ba76a4c0a778cba4"}, + {file = "coverage-7.11.0-cp314-cp314-win32.whl", hash = "sha256:bab7ec4bb501743edc63609320aaec8cd9188b396354f482f4de4d40a9d10721"}, + {file = "coverage-7.11.0-cp314-cp314-win_amd64.whl", hash = "sha256:3d4ba9a449e9364a936a27322b20d32d8b166553bfe63059bd21527e681e2fad"}, + {file = "coverage-7.11.0-cp314-cp314-win_arm64.whl", hash = "sha256:ce37f215223af94ef0f75ac68ea096f9f8e8c8ec7d6e8c346ee45c0d363f0479"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:f413ce6e07e0d0dc9c433228727b619871532674b45165abafe201f200cc215f"}, + {file = "coverage-7.11.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:05791e528a18f7072bf5998ba772fe29db4da1234c45c2087866b5ba4dea710e"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cacb29f420cfeb9283b803263c3b9a068924474ff19ca126ba9103e1278dfa44"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:314c24e700d7027ae3ab0d95fbf8d53544fca1f20345fd30cd219b737c6e58d3"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:630d0bd7a293ad2fc8b4b94e5758c8b2536fdf36c05f1681270203e463cbfa9b"}, + {file = "coverage-7.11.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e89641f5175d65e2dbb44db15fe4ea48fade5d5bbb9868fdc2b4fce22f4a469d"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c9f08ea03114a637dab06cedb2e914da9dc67fa52c6015c018ff43fdde25b9c2"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce9f3bde4e9b031eaf1eb61df95c1401427029ea1bfddb8621c1161dcb0fa02e"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:e4dc07e95495923d6fd4d6c27bf70769425b71c89053083843fd78f378558996"}, + {file = "coverage-7.11.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:424538266794db2861db4922b05d729ade0940ee69dcf0591ce8f69784db0e11"}, + {file = "coverage-7.11.0-cp314-cp314t-win32.whl", hash = "sha256:4c1eeb3fb8eb9e0190bebafd0462936f75717687117339f708f395fe455acc73"}, + {file = "coverage-7.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b56efee146c98dbf2cf5cffc61b9829d1e94442df4d7398b26892a53992d3547"}, + {file = "coverage-7.11.0-cp314-cp314t-win_arm64.whl", hash = "sha256:b5c2705afa83f49bd91962a4094b6b082f94aef7626365ab3f8f4bd159c5acf3"}, + {file = "coverage-7.11.0-py3-none-any.whl", hash = "sha256:4b7589765348d78fb4e5fb6ea35d07564e387da2fc5efff62e0222971f155f68"}, + {file = "coverage-7.11.0.tar.gz", hash = "sha256:167bd504ac1ca2af7ff3b81d245dfea0292c5032ebef9d66cc08a7d28c1b8050"}, ] [[package]] name = "exceptiongroup" -version = "1.2.2" +version = "1.3.0" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" groups = ["default", "dev"] marker = "python_version < \"3.11\"" +dependencies = [ + "typing-extensions>=4.6.0; python_version < \"3.13\"", +] files = [ - {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, - {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, + {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, + {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] [[package]] @@ -273,59 +229,58 @@ files = [ [[package]] name = "httpcore" -version = "0.13.7" -requires_python = ">=3.6" +version = "0.15.0" +requires_python = ">=3.7" summary = "A minimal low-level HTTP client." groups = ["default"] dependencies = [ "anyio==3.*", + "certifi", "h11<0.13,>=0.11", "sniffio==1.*", ] files = [ - {file = "httpcore-0.13.7-py3-none-any.whl", hash = "sha256:369aa481b014cf046f7067fddd67d00560f2f00426e79569d99cb11245134af0"}, - {file = "httpcore-0.13.7.tar.gz", hash = "sha256:036f960468759e633574d7c121afba48af6419615d36ab8ede979f1ad6276fa3"}, + {file = "httpcore-0.15.0-py3-none-any.whl", hash = "sha256:1105b8b73c025f23ff7c36468e4432226cbb959176eab66864b8e31c4ee27fa6"}, + {file = "httpcore-0.15.0.tar.gz", hash = "sha256:18b68ab86a3ccf3e7dc0f43598eaddcf472b602aba29f9aa6ab85fe2ada3980b"}, ] [[package]] name = "httpx" -version = "0.20.0" -requires_python = ">=3.6" +version = "0.23.0" +requires_python = ">=3.7" summary = "The next generation HTTP client." groups = ["default"] dependencies = [ - "async-generator; python_version < \"3.7\"", "certifi", - "charset-normalizer", - "httpcore<0.14.0,>=0.13.3", + "httpcore<0.16.0,>=0.15.0", "rfc3986[idna2008]<2,>=1.3", "sniffio", ] files = [ - {file = "httpx-0.20.0-py3-none-any.whl", hash = "sha256:33af5aad9bdc82ef1fc89219c1e36f5693bf9cd0ebe330884df563445682c0f8"}, - {file = "httpx-0.20.0.tar.gz", hash = "sha256:09606d630f070d07f9ff28104fbcea429ea0014c1e89ac90b4d8de8286c40e7b"}, + {file = "httpx-0.23.0-py3-none-any.whl", hash = "sha256:42974f577483e1e932c3cdc3cd2303e883cbfba17fe228b0f63589764d7b9c4b"}, + {file = "httpx-0.23.0.tar.gz", hash = "sha256:f28eac771ec9eb4866d3fb4ab65abd42d38c424739e80c08d8d20570de60b0ef"}, ] [[package]] name = "idna" -version = "3.10" -requires_python = ">=3.6" +version = "3.11" +requires_python = ">=3.8" summary = "Internationalized Domain Names in Applications (IDNA)" groups = ["default"] files = [ - {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, - {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, + {file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"}, + {file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"}, ] [[package]] name = "iniconfig" -version = "2.0.0" -requires_python = ">=3.7" +version = "2.3.0" +requires_python = ">=3.10" summary = "brain-dead simple config-ini parsing" groups = ["dev"] files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"}, + {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, ] [[package]] @@ -342,74 +297,116 @@ files = [ {file = "Jinja2-3.0.0.tar.gz", hash = "sha256:ea8d7dd814ce9df6de6a761ec7f1cac98afe305b8cdc4aaae4e114b8d8ce24c5"}, ] +[[package]] +name = "markdown-it-py" +version = "4.0.0" +requires_python = ">=3.10" +summary = "Python port of markdown-it. Markdown parsing, done right!" +groups = ["default"] +dependencies = [ + "mdurl~=0.1", +] +files = [ + {file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"}, + {file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"}, +] + [[package]] name = "markupsafe" -version = "3.0.2" +version = "3.0.3" requires_python = ">=3.9" summary = "Safely add untrusted strings to HTML/XML markup." groups = ["default"] files = [ - {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"}, - {file = "MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d"}, - {file = "MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30"}, - {file = "MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1"}, - {file = "MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6"}, - {file = "MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-win32.whl", hash = "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f"}, - {file = "MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a"}, - {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"}, + {file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"}, + {file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1ba88449deb3de88bd40044603fafffb7bc2b055d626a330323a9ed736661695"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f42d0984e947b8adf7dd6dde396e720934d12c506ce84eea8476409563607591"}, + {file = "markupsafe-3.0.3-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c0c0b3ade1c0b13b936d7970b1d37a57acde9199dc2aecc4c336773e1d86049c"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:0303439a41979d9e74d18ff5e2dd8c43ed6c6001fd40e5bf2e43f7bd9bbc523f"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:d2ee202e79d8ed691ceebae8e0486bd9a2cd4794cec4824e1c99b6f5009502f6"}, + {file = "markupsafe-3.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:177b5253b2834fe3678cb4a5f0059808258584c559193998be2601324fdeafb1"}, + {file = "markupsafe-3.0.3-cp310-cp310-win32.whl", hash = "sha256:2a15a08b17dd94c53a1da0438822d70ebcd13f8c3a95abe3a9ef9f11a94830aa"}, + {file = "markupsafe-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:c4ffb7ebf07cfe8931028e3e4c85f0357459a3f9f9490886198848f4fa002ec8"}, + {file = "markupsafe-3.0.3-cp310-cp310-win_arm64.whl", hash = "sha256:e2103a929dfa2fcaf9bb4e7c091983a49c9ac3b19c9061b6d5427dd7d14d81a1"}, + {file = "markupsafe-3.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1cc7ea17a6824959616c525620e387f6dd30fec8cb44f649e31712db02123dad"}, + {file = "markupsafe-3.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bd4cd07944443f5a265608cc6aab442e4f74dff8088b0dfc8238647b8f6ae9a"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b5420a1d9450023228968e7e6a9ce57f65d148ab56d2313fcd589eee96a7a50"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0bf2a864d67e76e5c9a34dc26ec616a66b9888e25e7b9460e1c76d3293bd9dbf"}, + {file = "markupsafe-3.0.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc51efed119bc9cfdf792cdeaa4d67e8f6fcccab66ed4bfdd6bde3e59bfcbb2f"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:068f375c472b3e7acbe2d5318dea141359e6900156b5b2ba06a30b169086b91a"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:7be7b61bb172e1ed687f1754f8e7484f1c8019780f6f6b0786e76bb01c2ae115"}, + {file = "markupsafe-3.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f9e130248f4462aaa8e2552d547f36ddadbeaa573879158d721bbd33dfe4743a"}, + {file = "markupsafe-3.0.3-cp311-cp311-win32.whl", hash = "sha256:0db14f5dafddbb6d9208827849fad01f1a2609380add406671a26386cdf15a19"}, + {file = "markupsafe-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:de8a88e63464af587c950061a5e6a67d3632e36df62b986892331d4620a35c01"}, + {file = "markupsafe-3.0.3-cp311-cp311-win_arm64.whl", hash = "sha256:3b562dd9e9ea93f13d53989d23a7e775fdfd1066c33494ff43f5418bc8c58a5c"}, + {file = "markupsafe-3.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d53197da72cc091b024dd97249dfc7794d6a56530370992a5e1a08983ad9230e"}, + {file = "markupsafe-3.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1872df69a4de6aead3491198eaf13810b565bdbeec3ae2dc8780f14458ec73ce"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3a7e8ae81ae39e62a41ec302f972ba6ae23a5c5396c8e60113e9066ef893da0d"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6dd0be5b5b189d31db7cda48b91d7e0a9795f31430b7f271219ab30f1d3ac9d"}, + {file = "markupsafe-3.0.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:94c6f0bb423f739146aec64595853541634bde58b2135f27f61c1ffd1cd4d16a"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:be8813b57049a7dc738189df53d69395eba14fb99345e0a5994914a3864c8a4b"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:83891d0e9fb81a825d9a6d61e3f07550ca70a076484292a70fde82c4b807286f"}, + {file = "markupsafe-3.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:77f0643abe7495da77fb436f50f8dab76dbc6e5fd25d39589a0f1fe6548bfa2b"}, + {file = "markupsafe-3.0.3-cp312-cp312-win32.whl", hash = "sha256:d88b440e37a16e651bda4c7c2b930eb586fd15ca7406cb39e211fcff3bf3017d"}, + {file = "markupsafe-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:26a5784ded40c9e318cfc2bdb30fe164bdb8665ded9cd64d500a34fb42067b1c"}, + {file = "markupsafe-3.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:35add3b638a5d900e807944a078b51922212fb3dedb01633a8defc4b01a3c85f"}, + {file = "markupsafe-3.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e1cf1972137e83c5d4c136c43ced9ac51d0e124706ee1c8aa8532c1287fa8795"}, + {file = "markupsafe-3.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:116bb52f642a37c115f517494ea5feb03889e04df47eeff5b130b1808ce7c219"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:133a43e73a802c5562be9bbcd03d090aa5a1fe899db609c29e8c8d815c5f6de6"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfcd093f13f0f0b7fdd0f198b90053bf7b2f02a3927a30e63f3ccc9df56b676"}, + {file = "markupsafe-3.0.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:509fa21c6deb7a7a273d629cf5ec029bc209d1a51178615ddf718f5918992ab9"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4afe79fb3de0b7097d81da19090f4df4f8d3a2b3adaa8764138aac2e44f3af1"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:795e7751525cae078558e679d646ae45574b47ed6e7771863fcc079a6171a0fc"}, + {file = "markupsafe-3.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8485f406a96febb5140bfeca44a73e3ce5116b2501ac54fe953e488fb1d03b12"}, + {file = "markupsafe-3.0.3-cp313-cp313-win32.whl", hash = "sha256:bdd37121970bfd8be76c5fb069c7751683bdf373db1ed6c010162b2a130248ed"}, + {file = "markupsafe-3.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:9a1abfdc021a164803f4d485104931fb8f8c1efd55bc6b748d2f5774e78b62c5"}, + {file = "markupsafe-3.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:7e68f88e5b8799aa49c85cd116c932a1ac15caaa3f5db09087854d218359e485"}, + {file = "markupsafe-3.0.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:218551f6df4868a8d527e3062d0fb968682fe92054e89978594c28e642c43a73"}, + {file = "markupsafe-3.0.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3524b778fe5cfb3452a09d31e7b5adefeea8c5be1d43c4f810ba09f2ceb29d37"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e885a3d1efa2eadc93c894a21770e4bc67899e3543680313b09f139e149ab19"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8709b08f4a89aa7586de0aadc8da56180242ee0ada3999749b183aa23df95025"}, + {file = "markupsafe-3.0.3-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b8512a91625c9b3da6f127803b166b629725e68af71f8184ae7e7d54686a56d6"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:9b79b7a16f7fedff2495d684f2b59b0457c3b493778c9eed31111be64d58279f"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:12c63dfb4a98206f045aa9563db46507995f7ef6d83b2f68eda65c307c6829eb"}, + {file = "markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8f71bc33915be5186016f675cd83a1e08523649b0e33efdb898db577ef5bb009"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win32.whl", hash = "sha256:69c0b73548bc525c8cb9a251cddf1931d1db4d2258e9599c28c07ef3580ef354"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win_amd64.whl", hash = "sha256:1b4b79e8ebf6b55351f0d91fe80f893b4743f104bff22e90697db1590e47a218"}, + {file = "markupsafe-3.0.3-cp313-cp313t-win_arm64.whl", hash = "sha256:ad2cf8aa28b8c020ab2fc8287b0f823d0a7d8630784c31e9ee5edea20f406287"}, + {file = "markupsafe-3.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe"}, + {file = "markupsafe-3.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97"}, + {file = "markupsafe-3.0.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf"}, + {file = "markupsafe-3.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe"}, + {file = "markupsafe-3.0.3-cp314-cp314-win32.whl", hash = "sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9"}, + {file = "markupsafe-3.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581"}, + {file = "markupsafe-3.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4"}, + {file = "markupsafe-3.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab"}, + {file = "markupsafe-3.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50"}, + {file = "markupsafe-3.0.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523"}, + {file = "markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win32.whl", hash = "sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9"}, + {file = "markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa"}, + {file = "markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698"}, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +requires_python = ">=3.7" +summary = "Markdown URL utilities" +groups = ["default"] +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, ] [[package]] @@ -444,46 +441,41 @@ files = [ {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, - {file = "mypy-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc"}, - {file = "mypy-1.13.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732"}, - {file = "mypy-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc"}, - {file = "mypy-1.13.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d"}, - {file = "mypy-1.13.0-cp39-cp39-win_amd64.whl", hash = "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24"}, {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, ] [[package]] name = "mypy-extensions" -version = "1.0.0" -requires_python = ">=3.5" +version = "1.1.0" +requires_python = ">=3.8" summary = "Type system extensions for programs checked with the mypy type checker." groups = ["dev"] files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, ] [[package]] name = "packaging" -version = "24.2" +version = "25.0" requires_python = ">=3.8" summary = "Core utilities for Python packages" groups = ["dev"] files = [ - {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, - {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, ] [[package]] name = "pluggy" -version = "1.5.0" -requires_python = ">=3.8" +version = "1.6.0" +requires_python = ">=3.9" summary = "plugin and hook calling mechanisms for python" groups = ["dev"] files = [ - {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, - {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, ] [[package]] @@ -499,93 +491,106 @@ files = [ [[package]] name = "pydantic" -version = "2.1.1" -requires_python = ">=3.7" +version = "2.10.0" +requires_python = ">=3.8" summary = "Data validation using Python type hints" groups = ["default"] dependencies = [ - "annotated-types>=0.4.0", - "pydantic-core==2.4.0", - "typing-extensions>=4.6.1", + "annotated-types>=0.6.0", + "pydantic-core==2.27.0", + "typing-extensions>=4.12.2", ] files = [ - {file = "pydantic-2.1.1-py3-none-any.whl", hash = "sha256:43bdbf359d6304c57afda15c2b95797295b702948082d4c23851ce752f21da70"}, - {file = "pydantic-2.1.1.tar.gz", hash = "sha256:22d63db5ce4831afd16e7c58b3192d3faf8f79154980d9397d9867254310ba4b"}, + {file = "pydantic-2.10.0-py3-none-any.whl", hash = "sha256:5e7807ba9201bdf61b1b58aa6eb690916c40a47acfb114b1b4fef3e7fd5b30fc"}, + {file = "pydantic-2.10.0.tar.gz", hash = "sha256:0aca0f045ff6e2f097f1fe89521115335f15049eeb8a7bef3dafe4b19a74e289"}, ] [[package]] name = "pydantic-core" -version = "2.4.0" -requires_python = ">=3.7" -summary = "" +version = "2.27.0" +requires_python = ">=3.8" +summary = "Core functionality for Pydantic validation and serialization" groups = ["default"] dependencies = [ "typing-extensions!=4.7.0,>=4.6.0", ] files = [ - {file = "pydantic_core-2.4.0-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:2ca4687dd996bde7f3c420def450797feeb20dcee2b9687023e3323c73fc14a2"}, - {file = "pydantic_core-2.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:782fced7d61469fd1231b184a80e4f2fa7ad54cd7173834651a453f96f29d673"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6213b471b68146af97b8551294e59e7392c2117e28ffad9c557c65087f4baee3"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63797499a219d8e81eb4e0c42222d0a4c8ec896f5c76751d4258af95de41fdf1"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_24_armv7l.whl", hash = "sha256:0455876d575a35defc4da7e0a199596d6c773e20d3d42fa1fc29f6aa640369ed"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_24_ppc64le.whl", hash = "sha256:8c938c96294d983dcf419b54dba2d21056959c22911d41788efbf949a29ae30d"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_24_s390x.whl", hash = "sha256:878a5017d93e776c379af4e7b20f173c82594d94fa073059bcc546789ad50bf8"}, - {file = "pydantic_core-2.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:69159afc2f2dc43285725f16143bc5df3c853bc1cb7df6021fce7ef1c69e8171"}, - {file = "pydantic_core-2.4.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:54df7df399b777c1fd144f541c95d351b3aa110535a6810a6a569905d106b6f3"}, - {file = "pydantic_core-2.4.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e412607ca89a0ced10758dfb8f9adcc365ce4c1c377e637c01989a75e9a9ec8a"}, - {file = "pydantic_core-2.4.0-cp310-none-win32.whl", hash = "sha256:853f103e2b9a58832fdd08a587a51de8b552ae90e1a5d167f316b7eabf8d7dde"}, - {file = "pydantic_core-2.4.0-cp310-none-win_amd64.whl", hash = "sha256:3ba2c9c94a9176f6321a879c8b864d7c5b12d34f549a4c216c72ce213d7d953c"}, - {file = "pydantic_core-2.4.0-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:a8b7acd04896e8f161e1500dc5f218017db05c1d322f054e89cbd089ce5d0071"}, - {file = "pydantic_core-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:16468bd074fa4567592d3255bf25528ed41e6b616d69bf07096bdb5b66f947d1"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cba5ad5eef02c86a1f3da00544cbc59a510d596b27566479a7cd4d91c6187a11"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7206e41e04b443016e930e01685bab7a308113c0b251b3f906942c8d4b48fcb"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_24_armv7l.whl", hash = "sha256:c1375025f0bfc9155286ebae8eecc65e33e494c90025cda69e247c3ccd2bab00"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_24_ppc64le.whl", hash = "sha256:3534118289e33130ed3f1cc487002e8d09b9f359be48b02e9cd3de58ce58fba9"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_24_s390x.whl", hash = "sha256:94d2b36a74623caab262bf95f0e365c2c058396082bd9d6a9e825657d0c1e7fa"}, - {file = "pydantic_core-2.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:af24ad4fbaa5e4a2000beae0c3b7fd1c78d7819ab90f9370a1cfd8998e3f8a3c"}, - {file = "pydantic_core-2.4.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bf10963d8aed8bbe0165b41797c9463d4c5c8788ae6a77c68427569be6bead41"}, - {file = "pydantic_core-2.4.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:68199ada7c310ddb8c76efbb606a0de656b40899388a7498954f423e03fc38be"}, - {file = "pydantic_core-2.4.0-cp311-none-win32.whl", hash = "sha256:6f855bcc96ed3dd56da7373cfcc9dcbabbc2073cac7f65c185772d08884790ce"}, - {file = "pydantic_core-2.4.0-cp311-none-win_amd64.whl", hash = "sha256:de39eb3bab93a99ddda1ac1b9aa331b944d8bcc4aa9141148f7fd8ee0299dafc"}, - {file = "pydantic_core-2.4.0-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:f773b39780323a0499b53ebd91a28ad11cde6705605d98d999dfa08624caf064"}, - {file = "pydantic_core-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a297c0d6c61963c5c3726840677b798ca5b7dfc71bc9c02b9a4af11d23236008"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:546064c55264156b973b5e65e5fafbe5e62390902ce3cf6b4005765505e8ff56"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:36ba9e728588588f0196deaf6751b9222492331b5552f865a8ff120869d372e0"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_24_armv7l.whl", hash = "sha256:57a53a75010c635b3ad6499e7721eaa3b450e03f6862afe2dbef9c8f66e46ec8"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_24_ppc64le.whl", hash = "sha256:4b262bbc13022f2097c48a21adcc360a81d83dc1d854c11b94953cd46d7d3c07"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_24_s390x.whl", hash = "sha256:01947ad728f426fa07fcb26457ebf90ce29320259938414bc0edd1476e75addb"}, - {file = "pydantic_core-2.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b2799c2eaf182769889761d4fb4d78b82bc47dae833799fedbf69fc7de306faa"}, - {file = "pydantic_core-2.4.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:a08fd490ba36d1fbb2cd5dcdcfb9f3892deb93bd53456724389135712b5fc735"}, - {file = "pydantic_core-2.4.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1e8a7c62d15a5c4b307271e4252d76ebb981d6251c6ecea4daf203ef0179ea4f"}, - {file = "pydantic_core-2.4.0-cp312-none-win32.whl", hash = "sha256:9206c14a67c38de7b916e486ae280017cf394fa4b1aa95cfe88621a4e1d79725"}, - {file = "pydantic_core-2.4.0-cp312-none-win_amd64.whl", hash = "sha256:884235507549a6b2d3c4113fb1877ae263109e787d9e0eb25c35982ab28d0399"}, - {file = "pydantic_core-2.4.0-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:867d3eea954bea807cabba83cfc939c889a18576d66d197c60025b15269d7cc0"}, - {file = "pydantic_core-2.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:664402ef0c238a7f8a46efb101789d5f2275600fb18114446efec83cfadb5b66"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64e8012ad60a5f0da09ed48725e6e923d1be25f2f091a640af6079f874663813"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac2b680de398f293b68183317432b3d67ab3faeba216aec18de0c395cb5e3060"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_24_armv7l.whl", hash = "sha256:8efc1be43b036c2b6bcfb1451df24ee0ddcf69c31351003daf2699ed93f5687b"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_24_ppc64le.whl", hash = "sha256:d93aedbc4614cc21b9ab0d0c4ccd7143354c1f7cffbbe96ae5216ad21d1b21b5"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_24_s390x.whl", hash = "sha256:af788b64e13d52fc3600a68b16d31fa8d8573e3ff2fc9a38f8a60b8d94d1f012"}, - {file = "pydantic_core-2.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:97c6349c81cee2e69ef59eba6e6c08c5936e6b01c2d50b9e4ac152217845ae09"}, - {file = "pydantic_core-2.4.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:cc086ddb6dc654a15deeed1d1f2bcb1cb924ebd70df9dca738af19f64229b06c"}, - {file = "pydantic_core-2.4.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:e953353180bec330c3b830891d260b6f8e576e2d18db3c78d314e56bb2276066"}, - {file = "pydantic_core-2.4.0-cp39-none-win32.whl", hash = "sha256:6feb4b64d11d5420e517910d60a907d08d846cacaf4e029668725cd21d16743c"}, - {file = "pydantic_core-2.4.0-cp39-none-win_amd64.whl", hash = "sha256:153a61ac4030fa019b70b31fb7986461119230d3ba0ab661c757cfea652f4332"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:3fcf529382b282a30b466bd7af05be28e22aa620e016135ac414f14e1ee6b9e1"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2edef05b63d82568b877002dc4cb5cc18f8929b59077120192df1e03e0c633f8"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:da055a1b0bfa8041bb2ff586b2cb0353ed03944a3472186a02cc44a557a0e661"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:77dadc764cf7c5405e04866181c5bd94a447372a9763e473abb63d1dfe9b7387"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:a4ea23b07f29487a7bef2a869f68c7ee0e05424d81375ce3d3de829314c6b5ec"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:382f0baa044d674ad59455a5eff83d7965572b745cc72df35c52c2ce8c731d37"}, - {file = "pydantic_core-2.4.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:08f89697625e453421401c7f661b9d1eb4c9e4c0a12fd256eeb55b06994ac6af"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:efff8b6761a1f6e45cebd1b7a6406eb2723d2d5710ff0d1b624fe11313693989"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32a1e0352558cd7ccc014ffe818c7d87b15ec6145875e2cc5fa4bb7351a1033d"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a027f41c5008571314861744d83aff75a34cf3a07022e0be32b214a5bc93f7f1"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1927f0e15d190f11f0b8344373731e28fd774c6d676d8a6cfadc95c77214a48b"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:7aa82d483d5fb867d4fb10a138ffd57b0f1644e99f2f4f336e48790ada9ada5e"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b85778308bf945e9b33ac604e6793df9b07933108d20bdf53811bc7c2798a4af"}, - {file = "pydantic_core-2.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:3ded19dcaefe2f6706d81e0db787b59095f4ad0fbadce1edffdf092294c8a23f"}, - {file = "pydantic_core-2.4.0.tar.gz", hash = "sha256:ec3473c9789cc00c7260d840c3db2c16dbfc816ca70ec87a00cddfa3e1a1cdd5"}, + {file = "pydantic_core-2.27.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:cd2ac6b919f7fed71b17fe0b4603c092a4c9b5bae414817c9c81d3c22d1e1bcc"}, + {file = "pydantic_core-2.27.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e015833384ca3e1a0565a79f5d953b0629d9138021c27ad37c92a9fa1af7623c"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db72e40628967f6dc572020d04b5f800d71264e0531c6da35097e73bdf38b003"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:df45c4073bed486ea2f18757057953afed8dd77add7276ff01bccb79982cf46c"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:836a4bfe0cc6d36dc9a9cc1a7b391265bf6ce9d1eb1eac62ac5139f5d8d9a6fa"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4bf1340ae507f6da6360b24179c2083857c8ca7644aab65807023cf35404ea8d"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ab325fc86fbc077284c8d7f996d904d30e97904a87d6fb303dce6b3de7ebba9"}, + {file = "pydantic_core-2.27.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1da0c98a85a6c6ed702d5556db3b09c91f9b0b78de37b7593e2de8d03238807a"}, + {file = "pydantic_core-2.27.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:7b0202ebf2268954090209a84f9897345719e46a57c5f2c9b7b250ca0a9d3e63"}, + {file = "pydantic_core-2.27.0-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:35380671c3c921fe8adf31ad349dc6f7588b7e928dbe44e1093789734f607399"}, + {file = "pydantic_core-2.27.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6b4c19525c3538fbc0bbda6229f9682fb8199ce9ac37395880e6952798e00373"}, + {file = "pydantic_core-2.27.0-cp310-none-win32.whl", hash = "sha256:333c840a1303d1474f491e7be0b718226c730a39ead0f7dab2c7e6a2f3855555"}, + {file = "pydantic_core-2.27.0-cp310-none-win_amd64.whl", hash = "sha256:99b2863c1365f43f74199c980a3d40f18a218fbe683dd64e470199db426c4d6a"}, + {file = "pydantic_core-2.27.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:4523c4009c3f39d948e01962223c9f5538602e7087a628479b723c939fab262d"}, + {file = "pydantic_core-2.27.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:84af1cf7bfdcbc6fcf5a5f70cc9896205e0350306e4dd73d54b6a18894f79386"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e65466b31be1070b4a5b7dbfbd14b247884cb8e8b79c64fb0f36b472912dbaea"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a5c022bb0d453192426221605efc865373dde43b17822a264671c53b068ac20c"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bb69bf3b6500f195c3deb69c1205ba8fc3cb21d1915f1f158a10d6b1ef29b6a"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0aa4d1b2eba9a325897308b3124014a142cdccb9f3e016f31d3ebee6b5ea5e75"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e96ca781e0c01e32115912ebdf7b3fb0780ce748b80d7d28a0802fa9fbaf44e"}, + {file = "pydantic_core-2.27.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b872c86d8d71827235c7077461c502feb2db3f87d9d6d5a9daa64287d75e4fa0"}, + {file = "pydantic_core-2.27.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:82e1ad4ca170e8af4c928b67cff731b6296e6a0a0981b97b2eb7c275cc4e15bd"}, + {file = "pydantic_core-2.27.0-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:eb40f828bc2f73f777d1eb8fee2e86cd9692a4518b63b6b5aa8af915dfd3207b"}, + {file = "pydantic_core-2.27.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9a8fbf506fde1529a1e3698198fe64bfbe2e0c09557bc6a7dcf872e7c01fec40"}, + {file = "pydantic_core-2.27.0-cp311-none-win32.whl", hash = "sha256:24f984fc7762ed5f806d9e8c4c77ea69fdb2afd987b4fd319ef06c87595a8c55"}, + {file = "pydantic_core-2.27.0-cp311-none-win_amd64.whl", hash = "sha256:68950bc08f9735306322bfc16a18391fcaac99ded2509e1cc41d03ccb6013cfe"}, + {file = "pydantic_core-2.27.0-cp311-none-win_arm64.whl", hash = "sha256:3eb8849445c26b41c5a474061032c53e14fe92a11a5db969f722a2716cd12206"}, + {file = "pydantic_core-2.27.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:8117839a9bdbba86e7f9df57018fe3b96cec934c3940b591b0fd3fbfb485864a"}, + {file = "pydantic_core-2.27.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a291d0b4243a259c8ea7e2b84eb9ccb76370e569298875a7c5e3e71baf49057a"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:84e35afd9e10b2698e6f2f32256678cb23ca6c1568d02628033a837638b3ed12"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:58ab0d979c969983cdb97374698d847a4acffb217d543e172838864636ef10d9"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0d06b667e53320332be2bf6f9461f4a9b78092a079b8ce8634c9afaa7e10cd9f"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:78f841523729e43e3928a364ec46e2e3f80e6625a4f62aca5c345f3f626c6e8a"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:400bf470e4327e920883b51e255617dfe4496d4e80c3fea0b5a5d0bf2c404dd4"}, + {file = "pydantic_core-2.27.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:951e71da6c89d354572098bada5ba5b5dc3a9390c933af8a614e37755d3d1840"}, + {file = "pydantic_core-2.27.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:2a51ce96224eadd1845150b204389623c8e129fde5a67a84b972bd83a85c6c40"}, + {file = "pydantic_core-2.27.0-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:483c2213a609e7db2c592bbc015da58b6c75af7360ca3c981f178110d9787bcf"}, + {file = "pydantic_core-2.27.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:359e7951f04ad35111b5ddce184db3391442345d0ab073aa63a95eb8af25a5ef"}, + {file = "pydantic_core-2.27.0-cp312-none-win32.whl", hash = "sha256:ee7d9d5537daf6d5c74a83b38a638cc001b648096c1cae8ef695b0c919d9d379"}, + {file = "pydantic_core-2.27.0-cp312-none-win_amd64.whl", hash = "sha256:2be0ad541bb9f059954ccf8877a49ed73877f862529575ff3d54bf4223e4dd61"}, + {file = "pydantic_core-2.27.0-cp312-none-win_arm64.whl", hash = "sha256:6e19401742ed7b69e51d8e4df3c03ad5ec65a83b36244479fd70edde2828a5d9"}, + {file = "pydantic_core-2.27.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:5f2b19b8d6fca432cb3acf48cf5243a7bf512988029b6e6fd27e9e8c0a204d85"}, + {file = "pydantic_core-2.27.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c86679f443e7085ea55a7376462553996c688395d18ef3f0d3dbad7838f857a2"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:510b11e9c3b1a852876d1ccd8d5903684336d635214148637ceb27366c75a467"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb704155e73b833801c247f39d562229c0303f54770ca14fb1c053acb376cf10"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ce048deb1e033e7a865ca384770bccc11d44179cf09e5193a535c4c2f497bdc"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:58560828ee0951bb125c6f2862fbc37f039996d19ceb6d8ff1905abf7da0bf3d"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:abb4785894936d7682635726613c44578c420a096729f1978cd061a7e72d5275"}, + {file = "pydantic_core-2.27.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2883b260f7a93235488699d39cbbd94fa7b175d3a8063fbfddd3e81ad9988cb2"}, + {file = "pydantic_core-2.27.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c6fcb3fa3855d583aa57b94cf146f7781d5d5bc06cb95cb3afece33d31aac39b"}, + {file = "pydantic_core-2.27.0-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:e851a051f7260e6d688267eb039c81f05f23a19431bd7dfa4bf5e3cb34c108cd"}, + {file = "pydantic_core-2.27.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:edb1bfd45227dec8d50bc7c7d86463cd8728bcc574f9b07de7369880de4626a3"}, + {file = "pydantic_core-2.27.0-cp313-none-win32.whl", hash = "sha256:678f66462058dd978702db17eb6a3633d634f7aa0deaea61e0a674152766d3fc"}, + {file = "pydantic_core-2.27.0-cp313-none-win_amd64.whl", hash = "sha256:d28ca7066d6cdd347a50d8b725dc10d9a1d6a1cce09836cf071ea6a2d4908be0"}, + {file = "pydantic_core-2.27.0-cp313-none-win_arm64.whl", hash = "sha256:6f4a53af9e81d757756508b57cae1cf28293f0f31b9fa2bfcb416cc7fb230f9d"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:4fb49cfdb53af5041aba909be00cccfb2c0d0a2e09281bf542371c5fd36ad04c"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:49633583eb7dc5cba61aaf7cdb2e9e662323ad394e543ee77af265736bcd3eaa"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:153017e3d6cd3ce979de06d84343ca424bb6092727375eba1968c8b4693c6ecb"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff63a92f6e249514ef35bc795de10745be0226eaea06eb48b4bbeaa0c8850a4a"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5982048129f40b082c2654de10c0f37c67a14f5ff9d37cf35be028ae982f26df"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:91bc66f878557313c2a6bcf396e7befcffe5ab4354cfe4427318968af31143c3"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:68ef5377eb582fa4343c9d0b57a5b094046d447b4c73dd9fbd9ffb216f829e7d"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:c5726eec789ee38f2c53b10b1821457b82274f81f4f746bb1e666d8741fcfadb"}, + {file = "pydantic_core-2.27.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:c0c431e4be5c1a0c6654e0c31c661cd89e0ca956ef65305c3c3fd96f4e72ca39"}, + {file = "pydantic_core-2.27.0.tar.gz", hash = "sha256:f57783fbaf648205ac50ae7d646f27582fc706be3977e87c3c124e7a92407b10"}, +] + +[[package]] +name = "pygments" +version = "2.19.2" +requires_python = ">=3.8" +summary = "Pygments is a syntax highlighting package written in Python." +groups = ["default"] +files = [ + {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"}, + {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"}, ] [[package]] @@ -637,8 +642,8 @@ files = [ [[package]] name = "pytest-xdist" -version = "3.6.1" -requires_python = ">=3.8" +version = "3.8.0" +requires_python = ">=3.9" summary = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" groups = ["dev"] dependencies = [ @@ -646,8 +651,8 @@ dependencies = [ "pytest>=7.0.0", ] files = [ - {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, - {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, + {file = "pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88"}, + {file = "pytest_xdist-3.8.0.tar.gz", hash = "sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1"}, ] [[package]] @@ -698,12 +703,27 @@ files = [ {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, ] +[[package]] +name = "rich" +version = "14.2.0" +requires_python = ">=3.8.0" +summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +groups = ["default"] +dependencies = [ + "markdown-it-py>=2.2.0", + "pygments<3.0.0,>=2.13.0", +] +files = [ + {file = "rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd"}, + {file = "rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4"}, +] + [[package]] name = "ruamel-yaml" version = "0.18.6" requires_python = ">=3.7" summary = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" -groups = ["default", "dev"] +groups = ["default"] dependencies = [ "ruamel-yaml-clib>=0.2.7; platform_python_implementation == \"CPython\" and python_version < \"3.13\"", ] @@ -714,72 +734,57 @@ files = [ [[package]] name = "ruamel-yaml-clib" -version = "0.2.12" +version = "0.2.14" requires_python = ">=3.9" summary = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" -groups = ["default", "dev"] +groups = ["default"] marker = "platform_python_implementation == \"CPython\" and python_version < \"3.13\"" files = [ - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:11f891336688faf5156a36293a9c362bdc7c88f03a8a027c2c1d8e0bcde998e5"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a606ef75a60ecf3d924613892cc603b154178ee25abb3055db5062da811fd969"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd5415dded15c3822597455bc02bcd66e81ef8b7a48cb71a33628fc9fdde39df"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f66efbc1caa63c088dead1c4170d148eabc9b80d95fb75b6c92ac0aad2437d76"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:22353049ba4181685023b25b5b51a574bce33e7f51c759371a7422dcae5402a6"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:932205970b9f9991b34f55136be327501903f7c66830e9760a8ffb15b07f05cd"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a52d48f4e7bf9005e8f0a89209bf9a73f7190ddf0489eee5eb51377385f59f2a"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-win32.whl", hash = "sha256:3eac5a91891ceb88138c113f9db04f3cebdae277f5d44eaa3651a4f573e6a5da"}, - {file = "ruamel.yaml.clib-0.2.12-cp310-cp310-win_amd64.whl", hash = "sha256:ab007f2f5a87bd08ab1499bdf96f3d5c6ad4dcfa364884cb4549aa0154b13a28"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:4a6679521a58256a90b0d89e03992c15144c5f3858f40d7c18886023d7943db6"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:d84318609196d6bd6da0edfa25cedfbabd8dbde5140a0a23af29ad4b8f91fb1e"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb43a269eb827806502c7c8efb7ae7e9e9d0573257a46e8e952f4d4caba4f31e"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:811ea1594b8a0fb466172c384267a4e5e367298af6b228931f273b111f17ef52"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:cf12567a7b565cbf65d438dec6cfbe2917d3c1bdddfce84a9930b7d35ea59642"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7dd5adc8b930b12c8fc5b99e2d535a09889941aa0d0bd06f4749e9a9397c71d2"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1492a6051dab8d912fc2adeef0e8c72216b24d57bd896ea607cb90bb0c4981d3"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-win32.whl", hash = "sha256:bd0a08f0bab19093c54e18a14a10b4322e1eacc5217056f3c063bd2f59853ce4"}, - {file = "ruamel.yaml.clib-0.2.12-cp311-cp311-win_amd64.whl", hash = "sha256:a274fb2cb086c7a3dea4322ec27f4cb5cc4b6298adb583ab0e211a4682f241eb"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:20b0f8dc160ba83b6dcc0e256846e1a02d044e13f7ea74a3d1d56ede4e48c632"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:943f32bc9dedb3abff9879edc134901df92cfce2c3d5c9348f172f62eb2d771d"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95c3829bb364fdb8e0332c9931ecf57d9be3519241323c5274bd82f709cebc0c"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:749c16fcc4a2b09f28843cda5a193e0283e47454b63ec4b81eaa2242f50e4ccd"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bf165fef1f223beae7333275156ab2022cffe255dcc51c27f066b4370da81e31"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:32621c177bbf782ca5a18ba4d7af0f1082a3f6e517ac2a18b3974d4edf349680"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b82a7c94a498853aa0b272fd5bc67f29008da798d4f93a2f9f289feb8426a58d"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-win32.whl", hash = "sha256:e8c4ebfcfd57177b572e2040777b8abc537cdef58a2120e830124946aa9b42c5"}, - {file = "ruamel.yaml.clib-0.2.12-cp312-cp312-win_amd64.whl", hash = "sha256:0467c5965282c62203273b838ae77c0d29d7638c8a4e3a1c8bdd3602c10904e4"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:4c8c5d82f50bb53986a5e02d1b3092b03622c02c2eb78e29bec33fd9593bae1a"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux2014_aarch64.whl", hash = "sha256:e7e3736715fbf53e9be2a79eb4db68e4ed857017344d697e8b9749444ae57475"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b7e75b4965e1d4690e93021adfcecccbca7d61c7bddd8e22406ef2ff20d74ef"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96777d473c05ee3e5e3c3e999f5d23c6f4ec5b0c38c098b3a5229085f74236c6"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_1_i686.whl", hash = "sha256:3bc2a80e6420ca8b7d3590791e2dfc709c88ab9152c00eeb511c9875ce5778bf"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:e188d2699864c11c36cdfdada94d781fd5d6b0071cd9c427bceb08ad3d7c70e1"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4f6f3eac23941b32afccc23081e1f50612bdbe4e982012ef4f5797986828cd01"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-win32.whl", hash = "sha256:6442cb36270b3afb1b4951f060eccca1ce49f3d087ca1ca4563a6eb479cb3de6"}, - {file = "ruamel.yaml.clib-0.2.12-cp313-cp313-win_amd64.whl", hash = "sha256:e5b8daf27af0b90da7bb903a876477a9e6d7270be6146906b276605997c7e9a3"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:fc4b630cd3fa2cf7fce38afa91d7cfe844a9f75d7f0f36393fa98815e911d987"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:bc5f1e1c28e966d61d2519f2a3d451ba989f9ea0f2307de7bc45baa526de9e45"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5a0e060aace4c24dcaf71023bbd7d42674e3b230f7e7b97317baf1e953e5b519"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e2f1c3765db32be59d18ab3953f43ab62a761327aafc1594a2a1fbe038b8b8a7"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:d85252669dc32f98ebcd5d36768f5d4faeaeaa2d655ac0473be490ecdae3c285"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:e143ada795c341b56de9418c58d028989093ee611aa27ffb9b7f609c00d813ed"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2c59aa6170b990d8d2719323e628aaf36f3bfbc1c26279c0eeeb24d05d2d11c7"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-win32.whl", hash = "sha256:beffaed67936fbbeffd10966a4eb53c402fafd3d6833770516bf7314bc6ffa12"}, - {file = "ruamel.yaml.clib-0.2.12-cp39-cp39-win_amd64.whl", hash = "sha256:040ae85536960525ea62868b642bdb0c2cc6021c9f9d507810c0c604e66f5a7b"}, - {file = "ruamel.yaml.clib-0.2.12.tar.gz", hash = "sha256:6c8fbb13ec503f99a91901ab46e0b07ae7941cd527393187039aec586fdfd36f"}, -] - -[[package]] -name = "ruamel-yaml-string" -version = "0.1.1" -requires_python = ">=3" -summary = "add dump_to_string/dumps method that returns YAML document as string" -groups = ["dev"] -dependencies = [ - "ruamel-yaml>=0.17.17", -] -files = [ - {file = "ruamel.yaml.string-0.1.1-py3-none-any.whl", hash = "sha256:eb146bcb42b116216638034a434e9cf3ae2a5d3933aa37183a9854b5f3ff42de"}, - {file = "ruamel.yaml.string-0.1.1.tar.gz", hash = "sha256:7a7aedcc055d45c004d38b756f58474ebefb106851f4ce56ce58415709784350"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f8b2acb0ffdd2ce8208accbec2dca4a06937d556fdcaefd6473ba1b5daa7e3c4"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:aef953f3b8bd0b50bd52a2e52fb54a6a2171a1889d8dea4a5959d46c6624c451"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:a0ac90efbc7a77b0d796c03c8cc4e62fd710b3f1e4c32947713ef2ef52e09543"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9bf6b699223afe6c7fe9f2ef76e0bfa6dd892c21e94ce8c957478987ade76cd8"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d73a0187718f6eec5b2f729b0f98e4603f7bd9c48aa65d01227d1a5dcdfbe9e8"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:81f6d3b19bc703679a5705c6a16dabdc79823c71d791d73c65949be7f3012c02"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b28caeaf3e670c08cb7e8de221266df8494c169bd6ed8875493fab45be9607a4"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:94f3efb718f8f49b031f2071ec7a27dd20cbfe511b4dfd54ecee54c956da2b31"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-win32.whl", hash = "sha256:27c070cf3888e90d992be75dd47292ff9aa17dafd36492812a6a304a1aedc182"}, + {file = "ruamel.yaml.clib-0.2.14-cp310-cp310-win_amd64.whl", hash = "sha256:4f4a150a737fccae13fb51234d41304ff2222e3b7d4c8e9428ed1a6ab48389b8"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5bae1a073ca4244620425cd3d3aa9746bde590992b98ee8c7c8be8c597ca0d4e"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:0a54e5e40a7a691a426c2703b09b0d61a14294d25cfacc00631aa6f9c964df0d"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:10d9595b6a19778f3269399eff6bab642608e5966183abc2adbe558a42d4efc9"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dba72975485f2b87b786075e18a6e5d07dc2b4d8973beb2732b9b2816f1bad70"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29757bdb7c142f9595cc1b62ec49a3d1c83fab9cef92db52b0ccebaad4eafb98"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:557df28dbccf79b152fe2d1b935f6063d9cc431199ea2b0e84892f35c03bb0ee"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:26a8de280ab0d22b6e3ec745b4a5a07151a0f74aad92dd76ab9c8d8d7087720d"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e501c096aa3889133d674605ebd018471bc404a59cbc17da3c5924421c54d97c"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-win32.whl", hash = "sha256:915748cfc25b8cfd81b14d00f4bfdb2ab227a30d6d43459034533f4d1c207a2a"}, + {file = "ruamel.yaml.clib-0.2.14-cp311-cp311-win_amd64.whl", hash = "sha256:4ccba93c1e5a40af45b2f08e4591969fa4697eae951c708f3f83dcbf9f6c6bb1"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:6aeadc170090ff1889f0d2c3057557f9cd71f975f17535c26a5d37af98f19c27"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:5e56ac47260c0eed992789fa0b8efe43404a9adb608608631a948cee4fc2b052"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:a911aa73588d9a8b08d662b9484bc0567949529824a55d3885b77e8dd62a127a"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a05ba88adf3d7189a974b2de7a9d56731548d35dc0a822ec3dc669caa7019b29"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fb04c5650de6668b853623eceadcdb1a9f2fee381f5d7b6bc842ee7c239eeec4"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:df3ec9959241d07bc261f4983d25a1205ff37703faf42b474f15d54d88b4f8c9"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:fbc08c02e9b147a11dfcaa1ac8a83168b699863493e183f7c0c8b12850b7d259"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c099cafc1834d3c5dac305865d04235f7c21c167c8dd31ebc3d6bbc357e2f023"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-win32.whl", hash = "sha256:b5b0f7e294700b615a3bcf6d28b26e6da94e8eba63b079f4ec92e9ba6c0d6b54"}, + {file = "ruamel.yaml.clib-0.2.14-cp312-cp312-win_amd64.whl", hash = "sha256:a37f40a859b503304dd740686359fcf541d6fb3ff7fc10f539af7f7150917c68"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7e4f9da7e7549946e02a6122dcad00b7c1168513acb1f8a726b1aaf504a99d32"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-macosx_15_0_arm64.whl", hash = "sha256:dd7546c851e59c06197a7c651335755e74aa383a835878ca86d2c650c07a2f85"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux2014_aarch64.whl", hash = "sha256:1c1acc3a0209ea9042cc3cfc0790edd2eddd431a2ec3f8283d081e4d5018571e"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2070bf0ad1540d5c77a664de07ebcc45eebd1ddcab71a7a06f26936920692beb"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bd8fe07f49c170e09d76773fb86ad9135e0beee44f36e1576a201b0676d3d1d"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ff86876889ea478b1381089e55cf9e345707b312beda4986f823e1d95e8c0f59"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:1f118b707eece8cf84ecbc3e3ec94d9db879d85ed608f95870d39b2d2efa5dca"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b30110b29484adc597df6bd92a37b90e63a8c152ca8136aad100a02f8ba6d1b6"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-win32.whl", hash = "sha256:f4e97a1cf0b7a30af9e1d9dad10a5671157b9acee790d9e26996391f49b965a2"}, + {file = "ruamel.yaml.clib-0.2.14-cp313-cp313-win_amd64.whl", hash = "sha256:090782b5fb9d98df96509eecdbcaffd037d47389a89492320280d52f91330d78"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:7df6f6e9d0e33c7b1d435defb185095386c469109de723d514142632a7b9d07f"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-macosx_15_0_arm64.whl", hash = "sha256:70eda7703b8126f5e52fcf276e6c0f40b0d314674f896fc58c47b0aef2b9ae83"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:a0cb71ccc6ef9ce36eecb6272c81afdc2f565950cdcec33ae8e6cd8f7fc86f27"}, + {file = "ruamel.yaml.clib-0.2.14-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e7cb9ad1d525d40f7d87b6df7c0ff916a66bc52cb61b66ac1b2a16d0c1b07640"}, + {file = "ruamel.yaml.clib-0.2.14.tar.gz", hash = "sha256:803f5044b13602d58ea378576dd75aa759f52116a0232608e8fdada4da33752e"}, ] [[package]] @@ -857,58 +862,71 @@ files = [ [[package]] name = "tomli" -version = "2.2.1" +version = "2.3.0" requires_python = ">=3.8" summary = "A lil' TOML parser" groups = ["dev"] marker = "python_version < \"3.11\"" files = [ - {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, - {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, - {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, - {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, - {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, - {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, - {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, - {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, - {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, - {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, + {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, + {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, + {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, + {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, + {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, + {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, + {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, + {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, + {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, + {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, + {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, + {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, + {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, + {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, + {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, + {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, + {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, + {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, + {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, + {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, + {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, + {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, + {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, + {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, + {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, + {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, + {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, ] [[package]] name = "typer" -version = "0.6.1" -requires_python = ">=3.6" +version = "0.16.1" +requires_python = ">=3.7" summary = "Typer, build great CLIs. Easy to code. Based on Python type hints." groups = ["default"] dependencies = [ - "click<9.0.0,>=7.1.1", + "click>=8.0.0", + "rich>=10.11.0", + "shellingham>=1.3.0", + "typing-extensions>=3.7.4.3", ] files = [ - {file = "typer-0.6.1-py3-none-any.whl", hash = "sha256:54b19e5df18654070a82f8c2aa1da456a4ac16a2a83e6dcd9f170e291c56338e"}, - {file = "typer-0.6.1.tar.gz", hash = "sha256:2d5720a5e63f73eaf31edaa15f6ab87f35f0690f8ca233017d7d23d743a91d73"}, + {file = "typer-0.16.1-py3-none-any.whl", hash = "sha256:90ee01cb02d9b8395ae21ee3368421faf21fa138cb2a541ed369c08cec5237c9"}, + {file = "typer-0.16.1.tar.gz", hash = "sha256:d358c65a464a7a90f338e3bb7ff0c74ac081449e53884b12ba658cbd72990614"}, ] [[package]] @@ -943,11 +961,11 @@ files = [ [[package]] name = "typing-extensions" -version = "4.8.0" -requires_python = ">=3.8" -summary = "Backported and Experimental Type Hints for Python 3.8+" +version = "4.15.0" +requires_python = ">=3.9" +summary = "Backported and Experimental Type Hints for Python 3.9+" groups = ["default", "dev"] files = [ - {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, - {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, + {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, + {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, ] diff --git a/pyproject.toml b/pyproject.toml index 4966e5f55..5cc6ce863 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,22 +3,21 @@ authors = [ { name = "Dylan Anthony", email = "contact@dylananthony.com" }, ] license = { text = "MIT" } -requires-python = ">=3.9,<4.0" +requires-python = ">=3.10,<4.0" dependencies = [ "jinja2>=3.0.0,<4.0.0", - "typer>0.6,<0.16", + "typer>0.16,<0.21", "colorama>=0.4.3; sys_platform == \"win32\"", "shellingham>=1.3.2,<2.0.0", - "pydantic>=2.1.1,<3.0.0", + "pydantic>=2.10,<3.0.0", "attrs>=22.2.0", "python-dateutil>=2.8.1,<3.0.0", - "httpx>=0.20.0,<0.29.0", + "httpx>=0.23.0,<0.29.0", "ruamel.yaml>=0.18.6,<0.19.0", - "ruff>=0.2,<0.9", - "typing-extensions>=4.8.0,<5.0.0", + "ruff>=0.2", ] name = "openapi-python-client" -version = "0.23.0" +version = "0.27.1" description = "Generate modern Python clients from OpenAPI" keywords = [ "OpenAPI", @@ -30,11 +29,11 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Intended Audience :: Developers", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Software Development :: Code Generators", "Typing :: Typed", ] @@ -66,7 +65,7 @@ ignore = ["E501", "PLR0913", "PLR2004"] "tests/*" = ["PLR2004"] [tool.coverage.run] -omit = ["openapi_python_client/__main__.py", "openapi_python_client/templates/*"] +omit = ["openapi_python_client/__main__.py", "openapi_python_client/templates/*", "end_to_end_tests/*", "integration_tests/*", "tests/*"] [tool.mypy] plugins = ["pydantic.mypy"] @@ -95,7 +94,6 @@ dev = [ "types-PyYAML<7.0.0,>=6.0.3", "types-certifi<2021.10.9,>=2020.0.0", "types-python-dateutil<3.0.0,>=2.0.0", - "ruamel-yaml-string>=0.1.1", "syrupy>=4", ] @@ -107,7 +105,7 @@ includes = [ ] [tool.pdm.scripts] -lint = "ruff check --fix ." +lint = "ruff check ." format = "ruff format ." mypy = "mypy openapi_python_client" check = { composite = ["lint", "format", "mypy", "test"] } @@ -118,7 +116,7 @@ regen_e2e = "python -m end_to_end_tests.regen_golden_record" unit_test = "pytest tests" [tool.pdm.scripts.test] -cmd = "pytest tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp" +cmd = "pytest tests end_to_end_tests/test_end_to_end.py end_to_end_tests/functional_tests --basetemp=tests/tmp" [tool.pdm.scripts.test.env] "TEST_RELATIVE" = "true" @@ -130,7 +128,7 @@ composite = ["test --cov openapi_python_client tests --cov-report=term-missing"] [tool.pdm.scripts.regen_integration] shell = """ -openapi-python-client generate --overwrite --url https://raw.githubusercontent.com/openapi-generators/openapi-test-server/main/openapi.json --config integration-tests/config.yaml --meta pdm --output-path integration-tests \ +openapi-python-client generate --overwrite --url https://raw.githubusercontent.com/openapi-generators/openapi-test-server/refs/tags/v0.2.1/openapi.yaml --config integration-tests/config.yaml --meta none --output-path integration-tests/integration_tests \ """ [build-system] diff --git a/tests/conftest.py b/tests/conftest.py index 969e57cbd..500ebf911 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,12 +1,13 @@ from __future__ import annotations +from collections.abc import Callable from pathlib import Path -from typing import Any, Callable +from typing import Any import pytest from mypy.semanal_shared import Protocol -from openapi_python_client import Config, MetaType +from openapi_python_client import Config, MetaType, utils from openapi_python_client import schema as oai from openapi_python_client.config import ConfigFile from openapi_python_client.parser.properties import ( @@ -56,7 +57,6 @@ def model_property_factory() -> ModelFactory: You can pass the same params into this as the ModelProperty constructor to override defaults. """ - from openapi_python_client.parser.properties import Class def _factory(**kwargs): kwargs = _common_kwargs(kwargs) @@ -130,7 +130,6 @@ def enum_property_factory() -> EnumFactory[EnumProperty]: You can pass the same params into this as the EnumProerty constructor to override defaults. """ - from openapi_python_client.parser.properties import Class return _simple_factory( EnumProperty, @@ -149,7 +148,6 @@ def literal_enum_property_factory() -> EnumFactory[LiteralEnumProperty]: You can pass the same params into this as the LiteralEnumProerty constructor to override defaults. """ - from openapi_python_client.parser.properties import Class return _simple_factory( LiteralEnumProperty, @@ -324,5 +322,5 @@ def _common_kwargs(kwargs: dict[str, Any]) -> dict[str, Any]: **kwargs, } if not kwargs.get("python_name"): - kwargs["python_name"] = kwargs["name"] + kwargs["python_name"] = utils.PythonIdentifier(value=kwargs["name"], prefix="") return kwargs diff --git a/tests/test___init__.py b/tests/test___init__.py index c419fdf32..34ad3188f 100644 --- a/tests/test___init__.py +++ b/tests/test___init__.py @@ -1,3 +1,5 @@ +from unittest.mock import MagicMock + import pytest from openapi_python_client import Config, ErrorLevel, Project @@ -7,10 +9,6 @@ def make_project(config: Config) -> Project: - from unittest.mock import MagicMock - - from openapi_python_client import Project - return Project(openapi=MagicMock(title="My Test API"), config=config) @@ -42,23 +40,23 @@ def test__run_post_hooks_reports_missing_commands(self, project_with_dir: Projec assert fake_command_name in error.detail def test__run_post_hooks_reports_stdout_of_commands_that_error_with_no_stderr(self, project_with_dir): - failing_command = "python -c \"print('a message'); exit(1)\"" + failing_command = "python3 -c \"print('a message'); exit(1)\"" project_with_dir.config.post_hooks = [failing_command] project_with_dir._run_post_hooks() assert len(project_with_dir.errors) == 1 error = project_with_dir.errors[0] assert error.level == ErrorLevel.ERROR - assert error.header == "python failed" + assert error.header == "python3 failed" assert "a message" in error.detail def test__run_post_hooks_reports_stderr_of_commands_that_error(self, project_with_dir): - failing_command = "python -c \"print('a message'); raise Exception('some exception')\"" + failing_command = "python3 -c \"print('a message'); raise Exception('some exception')\"" project_with_dir.config.post_hooks = [failing_command] project_with_dir._run_post_hooks() assert len(project_with_dir.errors) == 1 error = project_with_dir.errors[0] assert error.level == ErrorLevel.ERROR - assert error.header == "python failed" + assert error.header == "python3 failed" assert "some exception" in error.detail diff --git a/tests/test_cli.py b/tests/test_cli.py index 8679584fd..9712b2a04 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,11 +1,11 @@ from typer.testing import CliRunner +from openapi_python_client.cli import app + runner = CliRunner() def test_version() -> None: - from openapi_python_client.cli import app - result = runner.invoke(app, ["--version", "generate"]) assert result.exit_code == 0 @@ -13,28 +13,22 @@ def test_version() -> None: def test_bad_config() -> None: - from openapi_python_client.cli import app - config_path = "config/path" path = "cool/path" result = runner.invoke(app, ["generate", f"--config={config_path}", f"--path={path}"]) assert result.exit_code == 2 - assert "Unable to parse config" in result.stdout + assert "Unable to parse config" in result.output class TestGenerate: def test_generate_no_params(self) -> None: - from openapi_python_client.cli import app - result = runner.invoke(app, ["generate"]) assert result.exit_code == 1, result.output def test_generate_url_and_path(self) -> None: - from openapi_python_client.cli import app - result = runner.invoke(app, ["generate", "--path=blah", "--url=otherblah"]) assert result.exit_code == 1 @@ -43,8 +37,6 @@ def test_generate_url_and_path(self) -> None: def test_generate_encoding_errors(self) -> None: path = "cool/path" file_encoding = "error-file-encoding" - from openapi_python_client.cli import app - result = runner.invoke(app, ["generate", f"--path={path}", f"--file-encoding={file_encoding}"]) assert result.exit_code == 1 diff --git a/tests/test_config.py b/tests/test_config.py index c24766f9b..be2e8bf59 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,12 +1,22 @@ import json import os +from io import StringIO from pathlib import Path +from typing import Any import pytest -from ruamel.yaml import YAML +from ruamel.yaml import YAML as _YAML from openapi_python_client.config import ConfigFile + +class YAML(_YAML): + def dump_to_string(self, data: Any, **kwargs: Any) -> str: + stream = StringIO() + self.dump(data=data, stream=stream, **kwargs) + return stream.getvalue() + + yaml = YAML(typ=["safe", "string"]) diff --git a/tests/test_parser/test_openapi.py b/tests/test_parser/test_openapi.py index 57a07070b..3bd743804 100644 --- a/tests/test_parser/test_openapi.py +++ b/tests/test_parser/test_openapi.py @@ -4,63 +4,16 @@ import pytest import openapi_python_client.schema as oai -from openapi_python_client import GeneratorError from openapi_python_client.parser.errors import ParseError -from openapi_python_client.parser.openapi import Endpoint, EndpointCollection -from openapi_python_client.parser.properties import IntProperty, Parameters, Schemas +from openapi_python_client.parser.openapi import Endpoint, EndpointCollection, import_string_from_class +from openapi_python_client.parser.properties import Class, IntProperty, Parameters, Schemas from openapi_python_client.schema import DataType MODULE_NAME = "openapi_python_client.parser.openapi" -class TestGeneratorData: - def test_from_dict_invalid_schema(self, mocker): - Schemas = mocker.patch(f"{MODULE_NAME}.Schemas") - config = mocker.MagicMock() - - in_dict = {} - - from openapi_python_client.parser.openapi import GeneratorData - - generator_data = GeneratorData.from_dict(in_dict, config=config) - - assert isinstance(generator_data, GeneratorError) - assert generator_data.header == "Failed to parse OpenAPI document" - keywords = ["3 validation errors for OpenAPI", "info", "paths", "openapi", "Field required"] - assert generator_data.detail and all(keyword in generator_data.detail for keyword in keywords) - - Schemas.build.assert_not_called() - Schemas.assert_not_called() - - def test_swagger_document_invalid_schema(self, mocker): - Schemas = mocker.patch(f"{MODULE_NAME}.Schemas") - config = mocker.MagicMock() - - in_dict = {"swagger": "2.0"} - - from openapi_python_client.parser.openapi import GeneratorData - - generator_data = GeneratorData.from_dict(in_dict, config=config) - - assert isinstance(generator_data, GeneratorError) - assert generator_data.header == "Failed to parse OpenAPI document" - keywords = [ - "You may be trying to use a Swagger document; this is not supported by this project.", - "info", - "paths", - "openapi", - "Field required", - ] - assert generator_data.detail and all(keyword in generator_data.detail for keyword in keywords) - - Schemas.build.assert_not_called() - Schemas.assert_not_called() - - class TestEndpoint: def make_endpoint(self): - from openapi_python_client.parser.openapi import Endpoint - return Endpoint( path="path", method="method", @@ -71,69 +24,7 @@ def make_endpoint(self): relative_imports={"import_3"}, ) - @pytest.mark.parametrize("response_status_code", ["not_a_number", 499]) - def test__add_responses_status_code_error(self, response_status_code, mocker): - from openapi_python_client.parser.openapi import Endpoint, Schemas - - schemas = Schemas() - response_1_data = mocker.MagicMock() - data = { - response_status_code: response_1_data, - } - endpoint = self.make_endpoint() - parse_error = ParseError(data=mocker.MagicMock()) - response_from_data = mocker.patch(f"{MODULE_NAME}.response_from_data", return_value=(parse_error, schemas)) - config = MagicMock() - - response, schemas = Endpoint._add_responses(endpoint=endpoint, data=data, schemas=schemas, config=config) - - assert response.errors == [ - ParseError( - detail=f"Invalid response status code {response_status_code} (not a valid HTTP status code), " - "response will be omitted from generated client" - ) - ] - response_from_data.assert_not_called() - - def test__add_responses_error(self, mocker): - from openapi_python_client.parser.openapi import Endpoint, Schemas - - schemas = Schemas() - response_1_data = mocker.MagicMock() - response_2_data = mocker.MagicMock() - data = { - "200": response_1_data, - "404": response_2_data, - } - endpoint = self.make_endpoint() - parse_error = ParseError(data=mocker.MagicMock(), detail="some problem") - response_from_data = mocker.patch(f"{MODULE_NAME}.response_from_data", return_value=(parse_error, schemas)) - config = MagicMock() - - response, schemas = Endpoint._add_responses(endpoint=endpoint, data=data, schemas=schemas, config=config) - - response_from_data.assert_has_calls( - [ - mocker.call(status_code=200, data=response_1_data, schemas=schemas, parent_name="name", config=config), - mocker.call(status_code=404, data=response_2_data, schemas=schemas, parent_name="name", config=config), - ] - ) - assert response.errors == [ - ParseError( - detail="Cannot parse response for status code 200 (some problem), " - "response will be omitted from generated client", - data=parse_error.data, - ), - ParseError( - detail="Cannot parse response for status code 404 (some problem), " - "response will be omitted from generated client", - data=parse_error.data, - ), - ] - def test_add_parameters_handles_no_params(self): - from openapi_python_client.parser.openapi import Endpoint, Schemas - endpoint = self.make_endpoint() schemas = Schemas() parameters = Parameters() @@ -149,8 +40,6 @@ def test_add_parameters_handles_no_params(self): ) == (endpoint, schemas, parameters) def test_add_parameters_parse_error(self, mocker): - from openapi_python_client.parser.openapi import Endpoint - endpoint = self.make_endpoint() initial_schemas = mocker.MagicMock() initial_parameters = mocker.MagicMock() @@ -190,8 +79,6 @@ def test_add_parameters_parse_error(self, mocker): ], ) def test_add_parameters_header_types(self, data_type, allowed, config): - from openapi_python_client.parser.openapi import Endpoint - endpoint = self.make_endpoint() initial_schemas = Schemas() parameters = Parameters() @@ -358,8 +245,6 @@ def test__add_parameters_query_optionality(self, config): assert not param.required def test_add_parameters_duplicate_properties(self, config): - from openapi_python_client.parser.openapi import Endpoint, Schemas - endpoint = self.make_endpoint() param = oai.Parameter.model_construct( name="test", required=True, param_schema=oai.Schema.model_construct(type="string"), param_in="path" @@ -383,8 +268,6 @@ def test_add_parameters_duplicate_properties(self, config): ) def test_add_parameters_duplicate_properties_different_location(self, config): - from openapi_python_client.parser.openapi import Endpoint, Schemas - endpoint = self.make_endpoint() path_param = oai.Parameter.model_construct( name="test", required=True, param_schema=oai.Schema.model_construct(type="string"), param_in="path" @@ -407,8 +290,6 @@ def test_add_parameters_duplicate_properties_different_location(self, config): assert result.query_parameters[0].name == "test" def test_sort_parameters(self, string_property_factory): - from openapi_python_client.parser.openapi import Endpoint - endpoint = self.make_endpoint() endpoint.path = "/multiple-path-parameters/{param4}/{param2}/{param1}/{param3}" @@ -423,8 +304,6 @@ def test_sort_parameters(self, string_property_factory): assert result_names == expected_names def test_sort_parameters_missing_param(self, string_property_factory): - from openapi_python_client.parser.openapi import Endpoint - endpoint = self.make_endpoint() endpoint.path = "/multiple-path-parameters/{param1}/{param2}" param = string_property_factory(name="param1") @@ -437,8 +316,6 @@ def test_sort_parameters_missing_param(self, string_property_factory): assert endpoint.path in result.detail def test_sort_parameters_extra_param(self, string_property_factory): - from openapi_python_client.parser.openapi import Endpoint - endpoint = self.make_endpoint() endpoint.path = "/multiple-path-parameters" param = string_property_factory(name="param1") @@ -451,8 +328,6 @@ def test_sort_parameters_extra_param(self, string_property_factory): assert endpoint.path in result.detail def test_from_data_bad_params(self, mocker, config): - from openapi_python_client.parser.openapi import Endpoint - path = mocker.MagicMock() method = mocker.MagicMock() parse_error = ParseError(data=mocker.MagicMock()) @@ -474,6 +349,7 @@ def test_from_data_bad_params(self, mocker, config): method=method, tags=["default"], schemas=initial_schemas, + responses={}, parameters=parameters, config=config, request_bodies={}, @@ -482,8 +358,6 @@ def test_from_data_bad_params(self, mocker, config): assert result == (parse_error, return_schemas, return_parameters) def test_from_data_bad_responses(self, mocker, config): - from openapi_python_client.parser.openapi import Endpoint - path = mocker.MagicMock() method = mocker.MagicMock() parse_error = ParseError(data=mocker.MagicMock()) @@ -509,6 +383,7 @@ def test_from_data_bad_responses(self, mocker, config): method=method, tags=["default"], schemas=initial_schemas, + responses={}, parameters=initial_parameters, config=config, request_bodies={}, @@ -517,8 +392,6 @@ def test_from_data_bad_responses(self, mocker, config): assert result == (parse_error, response_schemas, return_parameters) def test_from_data_standard(self, mocker, config): - from openapi_python_client.parser.openapi import Endpoint - path = mocker.MagicMock() method = mocker.MagicMock() param_schemas = mocker.MagicMock() @@ -549,6 +422,7 @@ def test_from_data_standard(self, mocker, config): method=method, tags=["default"], schemas=initial_schemas, + responses={}, parameters=initial_parameters, config=config, request_bodies={}, @@ -570,12 +444,10 @@ def test_from_data_standard(self, mocker, config): config=config, ) _add_responses.assert_called_once_with( - endpoint=param_endpoint, data=data.responses, schemas=param_schemas, config=config + endpoint=param_endpoint, data=data.responses, schemas=param_schemas, responses={}, config=config ) def test_from_data_no_operation_id(self, mocker, config): - from openapi_python_client.parser.openapi import Endpoint - path = "/path/with/{param}/" method = "get" add_parameters = mocker.patch.object( @@ -594,12 +466,13 @@ def test_from_data_no_operation_id(self, mocker, config): mocker.patch("openapi_python_client.utils.remove_string_escapes", return_value=data.description) parameters = mocker.MagicMock() - endpoint, _, return_params = Endpoint.from_data( + Endpoint.from_data( data=data, path=path, method=method, tags=["default"], schemas=schemas, + responses={}, parameters=parameters, config=config, request_bodies={}, @@ -624,12 +497,11 @@ def test_from_data_no_operation_id(self, mocker, config): endpoint=add_parameters.return_value[0], data=data.responses, schemas=add_parameters.return_value[1], + responses={}, config=config, ) def test_from_data_no_security(self, mocker, config): - from openapi_python_client.parser.openapi import Endpoint - data = oai.Operation.model_construct( description=mocker.MagicMock(), operationId=mocker.MagicMock(), @@ -654,6 +526,7 @@ def test_from_data_no_security(self, mocker, config): method=method, tags=["a"], schemas=schemas, + responses={}, parameters=parameters, config=config, request_bodies={}, @@ -678,6 +551,7 @@ def test_from_data_no_security(self, mocker, config): endpoint=add_parameters.return_value[0], data=data.responses, schemas=add_parameters.return_value[1], + responses={}, config=config, ) @@ -693,6 +567,7 @@ def test_from_data_some_bad_bodies(self, config): ), ), schemas=Schemas(), + responses={}, config=config, parameters=Parameters(), tags=["tag"], @@ -716,6 +591,7 @@ def test_from_data_all_bodies_bad(self, config): ), ), schemas=Schemas(), + responses={}, config=config, parameters=Parameters(), tags=["tag"], @@ -728,32 +604,26 @@ def test_from_data_all_bodies_bad(self, config): @pytest.mark.parametrize( "response_types, expected", - (([], "Any"), (["Something"], "Something"), (["First", "Second", "Second"], "Union[First, Second]")), + (([], "Any"), (["Something"], "Something"), (["First", "Second", "Second"], "First | Second")), ) def test_response_type(self, response_types, expected): endpoint = self.make_endpoint() for response_type in response_types: mock_response = MagicMock() mock_response.prop.get_type_string.return_value = response_type - endpoint.responses.append(mock_response) + endpoint.responses.patterns.append(mock_response) assert endpoint.response_type() == expected class TestImportStringFromReference: def test_import_string_from_reference_no_prefix(self, mocker): - from openapi_python_client.parser.openapi import import_string_from_class - from openapi_python_client.parser.properties import Class - class_ = mocker.MagicMock(autospec=Class) result = import_string_from_class(class_) assert result == f"from .{class_.module_name} import {class_.name}" def test_import_string_from_reference_with_prefix(self, mocker): - from openapi_python_client.parser.openapi import import_string_from_class - from openapi_python_client.parser.properties import Class - prefix = mocker.MagicMock(autospec=str) class_ = mocker.MagicMock(autospec=Class) result = import_string_from_class(class_=class_, prefix=prefix) @@ -781,12 +651,13 @@ def test_from_data_overrides_path_item_params_with_operation_params(self, config ) } - collections, schemas, parameters = EndpointCollection.from_data( + collections, _schemas, _parameters = EndpointCollection.from_data( data=data, schemas=Schemas(), parameters=Parameters(), config=config, request_bodies={}, + responses={}, ) collection: EndpointCollection = collections["default"] assert isinstance(collection.endpoints[0].query_parameters[0], IntProperty) diff --git a/tests/test_parser/test_properties/test_any.py b/tests/test_parser/test_properties/test_any.py deleted file mode 100644 index d80e93e64..000000000 --- a/tests/test_parser/test_properties/test_any.py +++ /dev/null @@ -1,13 +0,0 @@ -from openapi_python_client.parser.properties import AnyProperty -from openapi_python_client.utils import PythonIdentifier - - -def test_default() -> None: - AnyProperty.build( - name="test", - required=True, - default=42, - python_name=PythonIdentifier("test", ""), - description="test", - example="test", - ) diff --git a/tests/test_parser/test_properties/test_boolean.py b/tests/test_parser/test_properties/test_boolean.py deleted file mode 100644 index 0862f1507..000000000 --- a/tests/test_parser/test_properties/test_boolean.py +++ /dev/null @@ -1,55 +0,0 @@ -import pytest - -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import BooleanProperty -from openapi_python_client.utils import PythonIdentifier - - -def test_invalid_default_value() -> None: - err = BooleanProperty.build( - default="not a boolean", - description=None, - example=None, - required=False, - python_name=PythonIdentifier("not_a_boolean", ""), - name="not_a_boolean", - ) - - assert isinstance(err, PropertyError) - - -@pytest.mark.parametrize( - ("value", "expected"), - ( - ("true", "True"), - ("True", "True"), - ("false", "False"), - ("False", "False"), - ), -) -def test_string_default(value, expected) -> None: - prop = BooleanProperty.build( - default=value, - description=None, - example=None, - required=False, - python_name="not_a_boolean", - name="not_a_boolean", - ) - - assert isinstance(prop, BooleanProperty) - assert prop.default.python_code == expected - - -def test_bool_default() -> None: - prop = BooleanProperty.build( - default=True, - description=None, - example=None, - required=False, - python_name="not_a_boolean", - name="not_a_boolean", - ) - - assert isinstance(prop, BooleanProperty) - assert prop.default.python_code == "True" diff --git a/tests/test_parser/test_properties/test_const.py b/tests/test_parser/test_properties/test_const.py deleted file mode 100644 index ab9e29332..000000000 --- a/tests/test_parser/test_properties/test_const.py +++ /dev/null @@ -1,28 +0,0 @@ -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import ConstProperty - - -def test_default_doesnt_match_const() -> None: - err = ConstProperty.build( - name="test", - required=True, - default="not the value", - python_name="test", - description=None, - const="the value", - ) - - assert isinstance(err, PropertyError) - - -def test_non_string_const() -> None: - prop = ConstProperty.build( - name="test", - required=True, - default=123, - python_name="test", - description=None, - const=123, - ) - - assert isinstance(prop, ConstProperty) diff --git a/tests/test_parser/test_properties/test_date.py b/tests/test_parser/test_properties/test_date.py deleted file mode 100644 index bcc3292b6..000000000 --- a/tests/test_parser/test_properties/test_date.py +++ /dev/null @@ -1,28 +0,0 @@ -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import DateProperty - - -def test_invalid_default_value(): - err = DateProperty.build( - default="not a date", - description=None, - example=None, - required=False, - python_name="not_a_date", - name="not_a_date", - ) - - assert isinstance(err, PropertyError) - - -def test_default_with_bad_type(): - err = DateProperty.build( - default=123, - description=None, - example=None, - required=False, - python_name="not_a_date", - name="not_a_date", - ) - - assert isinstance(err, PropertyError) diff --git a/tests/test_parser/test_properties/test_datetime.py b/tests/test_parser/test_properties/test_datetime.py deleted file mode 100644 index 94ea6f09c..000000000 --- a/tests/test_parser/test_properties/test_datetime.py +++ /dev/null @@ -1,28 +0,0 @@ -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import DateTimeProperty - - -def test_invalid_default_value(): - err = DateTimeProperty.build( - default="not a date", - description=None, - example=None, - required=False, - python_name="not_a_date", - name="not_a_date", - ) - - assert isinstance(err, PropertyError) - - -def test_default_with_bad_type(): - err = DateTimeProperty.build( - default=123, - description=None, - example=None, - required=False, - python_name="not_a_date", - name="not_a_date", - ) - - assert isinstance(err, PropertyError) diff --git a/tests/test_parser/test_properties/test_enum_property.py b/tests/test_parser/test_properties/test_enum_property.py deleted file mode 100644 index 282298aaf..000000000 --- a/tests/test_parser/test_properties/test_enum_property.py +++ /dev/null @@ -1,81 +0,0 @@ -from typing import Union - -import pytest - -import openapi_python_client.schema as oai -from openapi_python_client import Config -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import LiteralEnumProperty, Schemas -from openapi_python_client.parser.properties.enum_property import EnumProperty - -PropertyClass = Union[type[EnumProperty], type[LiteralEnumProperty]] - - -@pytest.fixture(params=[EnumProperty, LiteralEnumProperty]) -def property_class(request) -> PropertyClass: - return request.param - - -def test_conflict(config: Config, property_class: PropertyClass) -> None: - schemas = Schemas() - - _, schemas = property_class.build( - data=oai.Schema(enum=["a"]), name="Existing", required=True, schemas=schemas, parent_name="", config=config - ) - err, new_schemas = property_class.build( - data=oai.Schema(enum=["a", "b"]), - name="Existing", - required=True, - schemas=schemas, - parent_name="", - config=config, - ) - - assert schemas == new_schemas - assert err.detail == "Found conflicting enums named Existing with incompatible values." - - -def test_bad_default_value(config: Config, property_class: PropertyClass) -> None: - data = oai.Schema(default="B", enum=["A"]) - schemas = Schemas() - - err, new_schemas = property_class.build( - data=data, name="Existing", required=True, schemas=schemas, parent_name="parent", config=config - ) - - assert schemas == new_schemas - assert err == PropertyError(detail="Value B is not valid for enum Existing", data=data) - - -def test_bad_default_type(config: Config, property_class: PropertyClass) -> None: - data = oai.Schema(default=123, enum=["A"]) - schemas = Schemas() - - err, new_schemas = property_class.build( - data=data, name="Existing", required=True, schemas=schemas, parent_name="parent", config=config - ) - - assert schemas == new_schemas - assert isinstance(err, PropertyError) - - -def test_mixed_types(config: Config, property_class: PropertyClass) -> None: - data = oai.Schema(enum=["A", 1]) - schemas = Schemas() - - err, _ = property_class.build( - data=data, name="Enum", required=True, schemas=schemas, parent_name="parent", config=config - ) - - assert isinstance(err, PropertyError) - - -def test_unsupported_type(config: Config, property_class: PropertyClass) -> None: - data = oai.Schema(enum=[1.4, 1.5]) - schemas = Schemas() - - err, _ = property_class.build( - data=data, name="Enum", required=True, schemas=schemas, parent_name="parent", config=config - ) - - assert isinstance(err, PropertyError) diff --git a/tests/test_parser/test_properties/test_file.py b/tests/test_parser/test_properties/test_file.py index 87298ba03..f399e8278 100644 --- a/tests/test_parser/test_properties/test_file.py +++ b/tests/test_parser/test_properties/test_file.py @@ -3,6 +3,8 @@ def test_no_default_allowed(): + # currently this is testing an unused code path: + # https://github.com/openapi-generators/openapi-python-client/issues/1162 err = FileProperty.build( default="not none", description=None, diff --git a/tests/test_parser/test_properties/test_float.py b/tests/test_parser/test_properties/test_float.py deleted file mode 100644 index 356a61424..000000000 --- a/tests/test_parser/test_properties/test_float.py +++ /dev/null @@ -1,38 +0,0 @@ -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import FloatProperty -from openapi_python_client.parser.properties.protocol import Value - - -def test_invalid_default(): - err = FloatProperty.build( - default="not a float", - description=None, - example=None, - required=False, - python_name="not_a_float", - name="not_a_float", - ) - - assert isinstance(err, PropertyError) - - -def test_convert_from_string(): - assert FloatProperty.convert_value("1.0") == Value(python_code="1.0", raw_value="1.0") - assert FloatProperty.convert_value("1") == Value(python_code="1.0", raw_value="1") - - -def test_convert_from_float(): - assert FloatProperty.convert_value(1.0) == Value(python_code="1.0", raw_value=1.0) - - -def test_invalid_type_default(): - err = FloatProperty.build( - default=True, - description=None, - example=None, - required=False, - python_name="not_a_float", - name="not_a_float", - ) - - assert isinstance(err, PropertyError) diff --git a/tests/test_parser/test_properties/test_init.py b/tests/test_parser/test_properties/test_init.py index 918defcdb..1aa0d1432 100644 --- a/tests/test_parser/test_properties/test_init.py +++ b/tests/test_parser/test_properties/test_init.py @@ -1,211 +1,39 @@ -from unittest.mock import MagicMock, call +from unittest.mock import call -import attr import pytest import openapi_python_client.schema as oai from openapi_python_client.parser.errors import ParameterError, PropertyError from openapi_python_client.parser.properties import ( - ListProperty, + Class, + Parameters, ReferencePath, Schemas, - StringProperty, - UnionProperty, + _create_schemas, + _process_model_errors, + _process_models, + _propogate_removal, + build_parameters, + build_schemas, + property_from_data, ) -from openapi_python_client.parser.properties.protocol import ModelProperty, Value -from openapi_python_client.parser.properties.schemas import Class -from openapi_python_client.schema import DataType +from openapi_python_client.schema import Parameter, Reference, Schema from openapi_python_client.utils import ClassName, PythonIdentifier MODULE_NAME = "openapi_python_client.parser.properties" -class TestStringProperty: - def test_is_base_type(self, string_property_factory): - assert string_property_factory().is_base_type is True - - @pytest.mark.parametrize( - "required, expected", - ( - (True, "str"), - (False, "Union[Unset, str]"), - ), - ) - def test_get_type_string(self, string_property_factory, required, expected): - p = string_property_factory(required=required) - - assert p.get_type_string() == expected - - -class TestDateTimeProperty: - def test_is_base_type(self, date_time_property_factory): - assert date_time_property_factory().is_base_type is True - - @pytest.mark.parametrize("required", (True, False)) - def test_get_imports(self, date_time_property_factory, required): - p = date_time_property_factory(required=required) - - expected = { - "import datetime", - "from typing import cast", - "from dateutil.parser import isoparse", - } - if not required: - expected |= { - "from typing import Union", - "from ...types import UNSET, Unset", - } - - assert p.get_imports(prefix="...") == expected - - -class TestDateProperty: - def test_is_base_type(self, date_property_factory): - assert date_property_factory().is_base_type is True - - @pytest.mark.parametrize("required", (True, False)) - def test_get_imports(self, date_property_factory, required): - p = date_property_factory(required=required) - - expected = { - "import datetime", - "from typing import cast", - "from dateutil.parser import isoparse", - } - if not required: - expected |= { - "from typing import Union", - "from ...types import UNSET, Unset", - } - - assert p.get_imports(prefix="...") == expected - - class TestFileProperty: - def test_is_base_type(self, file_property_factory): - assert file_property_factory().is_base_type is True - @pytest.mark.parametrize("required", (True, False)) def test_get_imports(self, file_property_factory, required): p = file_property_factory(required=required) expected = { "from io import BytesIO", - "from ...types import File, FileJsonType", + "from ...types import File, FileTypes", } if not required: expected |= { - "from typing import Union", - "from ...types import UNSET, Unset", - } - - assert p.get_imports(prefix="...") == expected - - -class TestNoneProperty: - def test_is_base_type(self, none_property_factory): - assert none_property_factory().is_base_type is True - - -class TestBooleanProperty: - def test_is_base_type(self, boolean_property_factory): - assert boolean_property_factory().is_base_type is True - - -class TestAnyProperty: - def test_is_base_type(self, any_property_factory): - assert any_property_factory().is_base_type is True - - -class TestIntProperty: - def test_is_base_type(self, int_property_factory): - assert int_property_factory().is_base_type is True - - -class TestListProperty: - def test_is_base_type(self, list_property_factory): - assert list_property_factory().is_base_type is False - - @pytest.mark.parametrize("quoted", (True, False)) - def test_get_base_json_type_string_base_inner(self, list_property_factory, quoted): - p = list_property_factory() - assert p.get_base_json_type_string(quoted=quoted) == "list[str]" - - @pytest.mark.parametrize("quoted", (True, False)) - def test_get_base_json_type_string_model_inner(self, list_property_factory, model_property_factory, quoted): - m = model_property_factory() - p = list_property_factory(inner_property=m) - assert p.get_base_json_type_string(quoted=quoted) == "list[dict[str, Any]]" - - def test_get_lazy_import_base_inner(self, list_property_factory): - p = list_property_factory() - assert p.get_lazy_imports(prefix="..") == set() - - def test_get_lazy_import_model_inner(self, list_property_factory, model_property_factory): - m = model_property_factory() - p = list_property_factory(inner_property=m) - assert p.get_lazy_imports(prefix="..") == {"from ..models.my_module import MyClass"} - - @pytest.mark.parametrize( - "required, expected", - ( - (True, "list[str]"), - (False, "Union[Unset, list[str]]"), - ), - ) - def test_get_type_string_base_inner(self, list_property_factory, required, expected): - p = list_property_factory(required=required) - - assert p.get_type_string() == expected - - @pytest.mark.parametrize( - "required, expected", - ( - (True, "list['MyClass']"), - (False, "Union[Unset, list['MyClass']]"), - ), - ) - def test_get_type_string_model_inner(self, list_property_factory, model_property_factory, required, expected): - m = model_property_factory() - p = list_property_factory(required=required, inner_property=m) - - assert p.get_type_string() == expected - - @pytest.mark.parametrize( - "quoted,expected", - [ - (False, "list[str]"), - (True, "list[str]"), - ], - ) - def test_get_base_type_string_base_inner(self, list_property_factory, quoted, expected): - p = list_property_factory() - assert p.get_base_type_string(quoted=quoted) == expected - - @pytest.mark.parametrize( - "quoted,expected", - [ - (False, "list['MyClass']"), - (True, "list['MyClass']"), - ], - ) - def test_get_base_type_string_model_inner(self, list_property_factory, model_property_factory, quoted, expected): - m = model_property_factory() - p = list_property_factory(inner_property=m) - assert p.get_base_type_string(quoted=quoted) == expected - - @pytest.mark.parametrize("required", (True, False)) - def test_get_type_imports(self, list_property_factory, date_time_property_factory, required): - inner_property = date_time_property_factory() - p = list_property_factory(inner_property=inner_property, required=required) - expected = { - "import datetime", - "from typing import cast", - "from dateutil.parser import isoparse", - } - if not required: - expected |= { - "from typing import Union", "from ...types import UNSET, Unset", } @@ -213,9 +41,6 @@ def test_get_type_imports(self, list_property_factory, date_time_property_factor class TestUnionProperty: - def test_is_base_type(self, union_property_factory): - assert union_property_factory().is_base_type is False - def test_get_lazy_import_base_inner(self, union_property_factory): p = union_property_factory() assert p.get_lazy_imports(prefix="..") == set() @@ -228,11 +53,11 @@ def test_get_lazy_import_model_inner(self, union_property_factory, model_propert @pytest.mark.parametrize( "required,no_optional,json,expected", [ - (False, False, False, "Union[Unset, datetime.datetime, str]"), - (False, True, False, "Union[datetime.datetime, str]"), - (True, False, False, "Union[datetime.datetime, str]"), - (True, True, False, "Union[datetime.datetime, str]"), - (False, False, True, "Union[Unset, str]"), + (False, False, False, "datetime.datetime | str | Unset"), + (False, True, False, "datetime.datetime | str"), + (True, False, False, "datetime.datetime | str"), + (True, True, False, "datetime.datetime | str"), + (False, False, True, "str | Unset"), (False, True, True, "str"), (True, False, True, "str"), (True, True, True, "str"), @@ -253,7 +78,7 @@ def test_get_type_string( inner_properties=[date_time_property_factory(), string_property_factory()], ) - assert p.get_base_type_string() == "Union[datetime.datetime, str]" + assert p.get_base_type_string() == "datetime.datetime | str" assert p.get_type_string(no_optional=no_optional, json=json) == expected @@ -262,7 +87,7 @@ def test_get_base_type_string_base_inners( ): p = union_property_factory(inner_properties=[date_time_property_factory(), string_property_factory()]) - assert p.get_base_type_string() == "Union[datetime.datetime, str]" + assert p.get_base_type_string() == "datetime.datetime | str" def test_get_base_type_string_one_base_inner(self, union_property_factory, date_time_property_factory): p = union_property_factory( @@ -276,14 +101,14 @@ def test_get_base_type_string_one_model_inner(self, union_property_factory, mode inner_properties=[model_property_factory()], ) - assert p.get_base_type_string() == "'MyClass'" + assert p.get_base_type_string() == "MyClass" def test_get_base_type_string_model_inners( self, union_property_factory, date_time_property_factory, model_property_factory ): p = union_property_factory(inner_properties=[date_time_property_factory(), model_property_factory()]) - assert p.get_base_type_string() == "Union['MyClass', datetime.datetime]" + assert p.get_base_type_string() == "datetime.datetime | MyClass" def test_get_base_json_type_string(self, union_property_factory, date_time_property_factory): p = union_property_factory( @@ -302,313 +127,17 @@ def test_get_type_imports(self, union_property_factory, date_time_property_facto "import datetime", "from typing import cast", "from dateutil.parser import isoparse", - "from typing import cast, Union", } if not required: expected |= { - "from typing import Union", "from ...types import UNSET, Unset", } assert p.get_imports(prefix="...") == expected -class TestEnumProperty: - def test_is_base_type(self, enum_property_factory): - assert enum_property_factory().is_base_type is True - - @pytest.mark.parametrize( - "required, expected", - ( - (False, "Union[Unset, {}]"), - (True, "{}"), - ), - ) - def test_get_type_string(self, mocker, enum_property_factory, required, expected): - fake_class = mocker.MagicMock() - fake_class.name = "MyTestEnum" - - p = enum_property_factory(class_info=fake_class, required=required) - - assert p.get_type_string() == expected.format(fake_class.name) - assert p.get_type_string(no_optional=True) == fake_class.name - assert p.get_type_string(json=True) == expected.format("str") - - def test_get_imports(self, mocker, enum_property_factory): - fake_class = mocker.MagicMock(module_name="my_test_enum") - fake_class.name = "MyTestEnum" - prefix = "..." - - enum_property = enum_property_factory(class_info=fake_class, required=False) - - assert enum_property.get_imports(prefix=prefix) == { - f"from {prefix}models.{fake_class.module_name} import {fake_class.name}", - "from typing import Union", # Makes sure unset is handled via base class - "from ...types import UNSET, Unset", - } - - def test_values_from_list(self): - from openapi_python_client.parser.properties import EnumProperty - - data = ["abc", "123", "a23", "1bc", 4, -3, "a Thing WIth spaces", ""] - - result = EnumProperty.values_from_list(data, Class("ClassName", "module_name")) - - assert result == { - "ABC": "abc", - "VALUE_1": "123", - "A23": "a23", - "VALUE_3": "1bc", - "VALUE_4": 4, - "VALUE_NEGATIVE_3": -3, - "A_THING_WITH_SPACES": "a Thing WIth spaces", - "VALUE_7": "", - } - - def test_values_from_list_duplicate(self): - from openapi_python_client.parser.properties import EnumProperty - - data = ["abc", "123", "a23", "abc"] - - with pytest.raises(ValueError): - EnumProperty.values_from_list(data, Class("ClassName", "module_name")) - - -class TestLiteralEnumProperty: - def test_is_base_type(self, literal_enum_property_factory): - assert literal_enum_property_factory().is_base_type is True - - @pytest.mark.parametrize( - "required, expected", - ( - (False, "Union[Unset, {}]"), - (True, "{}"), - ), - ) - def test_get_type_string(self, mocker, literal_enum_property_factory, required, expected): - fake_class = mocker.MagicMock() - fake_class.name = "MyTestEnum" - - p = literal_enum_property_factory(class_info=fake_class, required=required) - - assert p.get_type_string() == expected.format(fake_class.name) - assert p.get_type_string(no_optional=True) == fake_class.name - assert p.get_type_string(json=True) == expected.format("str") - - def test_get_imports(self, mocker, literal_enum_property_factory): - fake_class = mocker.MagicMock(module_name="my_test_enum") - fake_class.name = "MyTestEnum" - prefix = "..." - - literal_enum_property = literal_enum_property_factory(class_info=fake_class, required=False) - - assert literal_enum_property.get_imports(prefix=prefix) == { - "from typing import cast", - f"from {prefix}models.{fake_class.module_name} import {fake_class.name}", - f"from {prefix}models.{fake_class.module_name} import check_my_test_enum", - "from typing import Union", # Makes sure unset is handled via base class - "from ...types import UNSET, Unset", - } - - class TestPropertyFromData: - def test_property_from_data_str_enum(self, enum_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - from openapi_python_client.schema import Schema - - existing = enum_property_factory() - data = Schema(title="AnEnum", enum=["A", "B", "C"], default="B") - name = "my_enum" - required = True - - schemas = Schemas(classes_by_name={ClassName("AnEnum", prefix=""): existing}) - - prop, new_schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - ) - - assert prop == enum_property_factory( - name=name, - required=required, - values={"A": "A", "B": "B", "C": "C"}, - class_info=Class(name=ClassName("ParentAnEnum", ""), module_name=PythonIdentifier("parent_an_enum", "")), - value_type=str, - default=Value(python_code="ParentAnEnum.B", raw_value="B"), - ) - assert schemas != new_schemas, "Provided Schemas was mutated" - assert new_schemas.classes_by_name == { - "AnEnum": existing, - "ParentAnEnum": prop, - } - - def test_property_from_data_str_enum_with_null( - self, enum_property_factory, union_property_factory, none_property_factory, config - ): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - from openapi_python_client.schema import Schema - - existing = enum_property_factory() - data = Schema(title="AnEnum", enum=["A", "B", "C", None], default="B") - name = "my_enum" - required = True - - schemas = Schemas(classes_by_name={ClassName("AnEnum", ""): existing}) - - prop, new_schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - ) - - # None / null is removed from enum, and property is now nullable - assert isinstance(prop, UnionProperty), "Enums with None should be converted to UnionProperties" - enum_prop = enum_property_factory( - name="my_enum_type_1", - required=required, - values={"A": "A", "B": "B", "C": "C"}, - class_info=Class(name=ClassName("ParentAnEnum", ""), module_name=PythonIdentifier("parent_an_enum", "")), - value_type=str, - default=Value(python_code="ParentAnEnum.B", raw_value="B"), - ) - none_property = none_property_factory(name="my_enum_type_0", required=required) - assert prop == union_property_factory( - name=name, - default=Value(python_code="ParentAnEnum.B", raw_value="B"), - inner_properties=[none_property, enum_prop], - ) - assert schemas != new_schemas, "Provided Schemas was mutated" - assert new_schemas.classes_by_name == { - "AnEnum": existing, - "ParentAnEnum": enum_prop, - } - - def test_property_from_data_null_enum(self, enum_property_factory, none_property_factory, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - from openapi_python_client.schema import Schema - - data = Schema(title="AnEnumWithOnlyNull", enum=[None], default=None) - name = "my_enum" - required = True - - schemas = Schemas() - - prop, new_schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - ) - - assert prop == none_property_factory( - name="my_enum", required=required, default=Value(python_code="None", raw_value="None") - ) - - def test_property_from_data_int_enum(self, enum_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - from openapi_python_client.schema import Schema - - name = "my_enum" - required = True - data = Schema.model_construct(title="anEnum", enum=[1, 2, 3], default=3) - - existing = enum_property_factory() - schemas = Schemas(classes_by_name={ClassName("AnEnum", ""): existing}) - - prop, new_schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - ) - - assert prop == enum_property_factory( - name=name, - required=required, - values={"VALUE_1": 1, "VALUE_2": 2, "VALUE_3": 3}, - class_info=Class(name=ClassName("ParentAnEnum", ""), module_name=PythonIdentifier("parent_an_enum", "")), - value_type=int, - default=Value(python_code="ParentAnEnum.VALUE_3", raw_value=3), - ) - assert schemas != new_schemas, "Provided Schemas was mutated" - assert new_schemas.classes_by_name == { - "AnEnum": existing, - "ParentAnEnum": prop, - } - - def test_property_from_data_ref_enum(self, enum_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - - name = "some_enum" - data = oai.Reference.model_construct(ref="#/components/schemas/MyEnum") - existing_enum = enum_property_factory( - name="an_enum", - required=False, - values={"A": "a"}, - class_info=Class(name="MyEnum", module_name="my_enum"), - ) - schemas = Schemas(classes_by_reference={"/components/schemas/MyEnum": existing_enum}) - - prop, new_schemas = property_from_data( - name=name, required=False, data=data, schemas=schemas, parent_name="", config=config - ) - - assert prop == enum_property_factory( - name="some_enum", - required=False, - values={"A": "a"}, - class_info=Class(name="MyEnum", module_name="my_enum"), - ) - assert schemas == new_schemas - - def test_property_from_data_ref_enum_with_overridden_default(self, enum_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - - name = "some_enum" - required = False - data = oai.Schema.model_construct( - default="b", allOf=[oai.Reference.model_construct(ref="#/components/schemas/MyEnum")] - ) - existing_enum = enum_property_factory( - name="an_enum", - default=Value(python_code="MyEnum.A", raw_value="A"), - required=required, - values={"A": "a", "B": "b"}, - class_info=Class(name=ClassName("MyEnum", ""), module_name=PythonIdentifier("my_enum", "")), - ) - schemas = Schemas(classes_by_reference={ReferencePath("/components/schemas/MyEnum"): existing_enum}) - - prop, new_schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="", config=config - ) - new_schemas = attr.evolve(new_schemas, models_to_process=[]) # intermediate state irrelevant to this test - - assert prop == enum_property_factory( - name="some_enum", - default=Value(python_code="MyEnum.B", raw_value="b"), - required=required, - values={"A": "a", "B": "b"}, - class_info=Class(name=ClassName("MyEnum", ""), module_name=PythonIdentifier("my_enum", "")), - ) - assert schemas == new_schemas - - def test_property_from_data_ref_enum_with_invalid_default(self, enum_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - - name = "some_enum" - data = oai.Schema.model_construct( - default="x", allOf=[oai.Reference.model_construct(ref="#/components/schemas/MyEnum")] - ) - existing_enum = enum_property_factory( - name="an_enum", - default=Value(python_code="MyEnum.A", raw_value="A"), - values={"A": "a", "B": "b"}, - class_info=Class(name=ClassName("MyEnum", ""), module_name=PythonIdentifier("my_enum", "")), - python_name=PythonIdentifier("an_enum", ""), - ) - schemas = Schemas(classes_by_reference={ReferencePath("/components/schemas/MyEnum"): existing_enum}) - - prop, new_schemas = property_from_data( - name=name, required=False, data=data, schemas=schemas, parent_name="", config=config - ) - - assert schemas == new_schemas - assert prop == PropertyError(data=data, detail="Value x is not valid for enum an_enum") - def test_property_from_data_ref_model(self, model_property_factory, config): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data - name = "new_name" required = False class_name = ClassName("MyModel", "") @@ -633,8 +162,6 @@ def test_property_from_data_ref_model(self, model_property_factory, config): assert schemas == new_schemas def test_property_from_data_ref_not_found(self, mocker): - from openapi_python_client.parser.properties import PropertyError, Schemas, property_from_data - data = oai.Reference.model_construct(ref="a/b/c") parse_reference_path = mocker.patch(f"{MODULE_NAME}.parse_reference_path") schemas = Schemas() @@ -650,8 +177,6 @@ def test_property_from_data_ref_not_found(self, mocker): @pytest.mark.parametrize("references_exist", (True, False)) def test_property_from_data_ref(self, any_property_factory, references_exist, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - name = "new_name" required = False ref_path = "/components/schemas/RefName" @@ -671,8 +196,6 @@ def test_property_from_data_ref(self, any_property_factory, references_exist, co assert schemas.dependencies == {ref_path: {*roots, *references.get(ref_path, set())}} def test_property_from_data_invalid_ref(self, mocker): - from openapi_python_client.parser.properties import PropertyError, Schemas, property_from_data - name = mocker.MagicMock() required = mocker.MagicMock() data = oai.Reference.model_construct(ref=mocker.MagicMock()) @@ -689,183 +212,9 @@ def test_property_from_data_invalid_ref(self, mocker): assert prop == PropertyError(data=data, detail="bad stuff") assert schemas == new_schemas - def test_property_from_data_array(self, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - - name = "a_list_prop" - required = True - data = oai.Schema( - type=DataType.ARRAY, - items=oai.Schema(type=DataType.STRING), - ) - schemas = Schemas() - - response = property_from_data( - name=name, - required=required, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - )[0] - - assert isinstance(response, ListProperty) - assert isinstance(response.inner_property, StringProperty) - - def test_property_from_data_union(self, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - - name = "union_prop" - required = True - data = oai.Schema( - anyOf=[oai.Schema(type=DataType.NUMBER)], - oneOf=[ - oai.Schema(type=DataType.INTEGER), - ], - ) - schemas = Schemas() - - response = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - )[0] - - assert isinstance(response, UnionProperty) - assert len(response.inner_properties) == 2 - - def test_property_from_data_list_of_types(self, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - - name = "union_prop" - required = True - data = oai.Schema( - type=[DataType.NUMBER, DataType.NULL], - ) - schemas = Schemas() - - response = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - )[0] - - assert isinstance(response, UnionProperty) - assert len(response.inner_properties) == 2 - - def test_property_from_data_union_of_one_element(self, model_property_factory, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - - name = "new_name" - required = False - class_name = "MyModel" - existing_model: ModelProperty = model_property_factory() - schemas = Schemas(classes_by_reference={f"/{class_name}": existing_model}) - - data = oai.Schema.model_construct( - allOf=[oai.Reference.model_construct(ref=f"#/{class_name}")], - ) - - prop, schemas = property_from_data( - name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=config - ) - - assert prop == attr.evolve(existing_model, name=name, required=required, python_name=PythonIdentifier(name, "")) - - def test_property_from_data_no_valid_props_in_data(self, any_property_factory): - from openapi_python_client.parser.properties import Schemas, property_from_data - - schemas = Schemas() - data = oai.Schema() - name = "blah" - - prop, new_schemas = property_from_data( - name=name, required=True, data=data, schemas=schemas, parent_name="parent", config=MagicMock() - ) - - assert prop == any_property_factory(name=name, required=True, default=None) - assert new_schemas == schemas - class TestStringBasedProperty: - @pytest.mark.parametrize("required", (True, False)) - def test_no_format(self, string_property_factory, required, config): - from openapi_python_client.parser.properties import property_from_data - - name = "some_prop" - data = oai.Schema.model_construct(type="string", default="hello world") - - p, _ = property_from_data( - name=name, required=required, data=data, parent_name=None, config=config, schemas=Schemas() - ) - - assert p == string_property_factory( - name=name, required=required, default=StringProperty.convert_value("hello world") - ) - - def test_datetime_format(self, date_time_property_factory, config): - from openapi_python_client.parser.properties import property_from_data - - name = "datetime_prop" - required = True - data = oai.Schema.model_construct(type="string", schema_format="date-time", default="2020-11-06T12:00:00") - - p, _ = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), config=config, parent_name="" - ) - - assert p == date_time_property_factory( - name=name, - required=required, - default=Value(python_code=f"isoparse('{data.default}')", raw_value=data.default), - ) - - def test_datetime_bad_default(self, config): - from openapi_python_client.parser.properties import property_from_data - - name = "datetime_prop" - required = True - data = oai.Schema.model_construct(type="string", schema_format="date-time", default="a") - - result, _ = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), config=config, parent_name="" - ) - - assert isinstance(result, PropertyError) - assert result.detail.startswith("Invalid datetime") - - def test_date_format(self, date_property_factory, config): - from openapi_python_client.parser.properties import property_from_data - - name = "date_prop" - required = True - - data = oai.Schema.model_construct(type="string", schema_format="date", default="2020-11-06") - - p, _ = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), config=config, parent_name="" - ) - - assert p == date_property_factory( - name=name, - required=required, - default=Value(python_code=f"isoparse('{data.default}').date()", raw_value=data.default), - ) - - def test_date_format_bad_default(self, config): - from openapi_python_client.parser.properties import property_from_data - - name = "date_prop" - required = True - - data = oai.Schema.model_construct(type="string", schema_format="date", default="a") - - p, _ = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), config=config, parent_name="" - ) - - assert isinstance(p, PropertyError) - assert p.detail.startswith("Invalid date") - def test__string_based_property_binary_format(self, file_property_factory, config): - from openapi_python_client.parser.properties import property_from_data - name = "file_prop" required = True data = oai.Schema.model_construct(type="string", schema_format="binary", default="a") @@ -875,47 +224,28 @@ def test__string_based_property_binary_format(self, file_property_factory, confi ) assert p == file_property_factory(name=name, required=required) - def test__string_based_property_unsupported_format(self, string_property_factory, config): - from openapi_python_client.parser.properties import property_from_data - - name = "unknown" - required = True - data = oai.Schema.model_construct(type="string", schema_format="blah") - - p, _ = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), config=config, parent_name="" - ) - - assert p == string_property_factory(name=name, required=required) - class TestCreateSchemas: - def test_skips_references_and_keeps_going(self, mocker, config): - from openapi_python_client.parser.properties import Schemas, _create_schemas - from openapi_python_client.schema import Reference, Schema - - components = {"a_ref": Reference.model_construct(), "a_schema": Schema.model_construct()} + def test_dereference_references(self, mocker, config): + components = {"a_ref": Reference(ref="#/components/schemas/a_schema"), "a_schema": Schema.model_construct()} update_schemas_with_data = mocker.patch(f"{MODULE_NAME}.update_schemas_with_data") parse_reference_path = mocker.patch(f"{MODULE_NAME}.parse_reference_path") schemas = Schemas() result = _create_schemas(components=components, schemas=schemas, config=config) - # Should not even try to parse a path for the Reference - parse_reference_path.assert_called_once_with("#/components/schemas/a_schema") - update_schemas_with_data.assert_called_once_with( + + parse_reference_path.assert_has_calls( + [call("#/components/schemas/a_ref"), call("#/components/schemas/a_schema")] + ) + update_schemas_with_data.assert_called_with( ref_path=parse_reference_path.return_value, config=config, data=components["a_schema"], - schemas=Schemas( - errors=[PropertyError(detail="Reference schemas are not supported.", data=components["a_ref"])] - ), + schemas=result, ) assert result == update_schemas_with_data.return_value def test_records_bad_uris_and_keeps_going(self, mocker, config): - from openapi_python_client.parser.properties import Schemas, _create_schemas - from openapi_python_client.schema import Schema - components = {"first": Schema.model_construct(), "second": Schema.model_construct()} update_schemas_with_data = mocker.patch(f"{MODULE_NAME}.update_schemas_with_data") parse_reference_path = mocker.patch( @@ -939,9 +269,6 @@ def test_records_bad_uris_and_keeps_going(self, mocker, config): assert result == update_schemas_with_data.return_value def test_retries_failing_properties_while_making_progress(self, mocker, config): - from openapi_python_client.parser.properties import Schemas, _create_schemas - from openapi_python_client.schema import Schema - components = {"first": Schema.model_construct(), "second": Schema.model_construct()} update_schemas_with_data = mocker.patch( f"{MODULE_NAME}.update_schemas_with_data", side_effect=[PropertyError(), Schemas(), PropertyError()] @@ -963,9 +290,6 @@ def test_retries_failing_properties_while_making_progress(self, mocker, config): class TestProcessModels: def test_detect_recursive_allof_reference_no_retry(self, mocker, model_property_factory, config): - from openapi_python_client.parser.properties import Class, _process_models - from openapi_python_client.schema import Reference - class_name = ClassName("class_name", "") recursive_model = model_property_factory( class_info=Class(name=class_name, module_name=PythonIdentifier("module_name", "")) @@ -996,7 +320,6 @@ def test_detect_recursive_allof_reference_no_retry(self, mocker, model_property_ def test_resolve_reference_to_single_allof_reference(self, config, model_property_factory): # test for https://github.com/openapi-generators/openapi-python-client/issues/1091 - from openapi_python_client.parser.properties import Schemas, build_schemas components = { "Model1": oai.Schema.model_construct( @@ -1049,9 +372,6 @@ def test_resolve_reference_to_single_allof_reference(self, config, model_propert class TestPropogateRemoval: def test_propogate_removal_class_name(self): - from openapi_python_client.parser.properties import ReferencePath, _propogate_removal - from openapi_python_client.utils import ClassName - root = ClassName("ClassName", "") ref_path = ReferencePath("/reference") other_class_name = ClassName("OtherClassName", "") @@ -1069,9 +389,6 @@ def test_propogate_removal_class_name(self): assert not error.detail def test_propogate_removal_ref_path(self): - from openapi_python_client.parser.properties import ReferencePath, _propogate_removal - from openapi_python_client.utils import ClassName - root = ReferencePath("/root/reference") class_name = ClassName("ClassName", "") ref_path = ReferencePath("/ref/path") @@ -1089,9 +406,6 @@ def test_propogate_removal_ref_path(self): assert error.detail == f"\n{root}\n{ref_path}" def test_propogate_removal_ref_path_no_refs(self): - from openapi_python_client.parser.properties import ReferencePath, _propogate_removal - from openapi_python_client.utils import ClassName - root = ReferencePath("/root/reference") class_name = ClassName("ClassName", "") ref_path = ReferencePath("/ref/path") @@ -1105,9 +419,6 @@ def test_propogate_removal_ref_path_no_refs(self): assert error.detail == f"\n{root}" def test_propogate_removal_ref_path_already_removed(self): - from openapi_python_client.parser.properties import ReferencePath, _propogate_removal - from openapi_python_client.utils import ClassName - root = ReferencePath("/root/reference") class_name = ClassName("ClassName", "") ref_path = ReferencePath("/ref/path") @@ -1126,8 +437,6 @@ def test_propogate_removal_ref_path_already_removed(self): def test_process_model_errors(mocker, model_property_factory): - from openapi_python_client.parser.properties import _process_model_errors - propogate_removal = mocker.patch(f"{MODULE_NAME}._propogate_removal") model_errors = [ (model_property_factory(roots={"root1", "root2"}), PropertyError(detail="existing detail")), @@ -1147,9 +456,6 @@ def test_process_model_errors(mocker, model_property_factory): class TestBuildParameters: def test_skips_references_and_keeps_going(self, mocker, config): - from openapi_python_client.parser.properties import Parameters, build_parameters - from openapi_python_client.schema import Parameter, Reference - parameters = { "reference": Reference(ref="#/components/parameters/another_parameter"), "defined": Parameter( @@ -1179,9 +485,6 @@ def test_skips_references_and_keeps_going(self, mocker, config): assert result == update_parameters_with_data.return_value def test_records_bad_uris_and_keeps_going(self, mocker, config): - from openapi_python_client.parser.properties import Parameters, build_parameters - from openapi_python_client.schema import Parameter - parameters = {"first": Parameter.model_construct(), "second": Parameter.model_construct()} update_parameters_with_data = mocker.patch(f"{MODULE_NAME}.update_parameters_with_data") parse_reference_path = mocker.patch( @@ -1204,9 +507,6 @@ def test_records_bad_uris_and_keeps_going(self, mocker, config): assert result == update_parameters_with_data.return_value def test_retries_failing_parameters_while_making_progress(self, mocker, config): - from openapi_python_client.parser.properties import Parameters, build_parameters - from openapi_python_client.schema import Parameter - parameters = {"first": Parameter.model_construct(), "second": Parameter.model_construct()} update_parameters_with_data = mocker.patch( f"{MODULE_NAME}.update_parameters_with_data", side_effect=[ParameterError(), Parameters(), ParameterError()] @@ -1226,9 +526,6 @@ def test_retries_failing_parameters_while_making_progress(self, mocker, config): def test_build_schemas(mocker, config): - from openapi_python_client.parser.properties import Schemas, build_schemas - from openapi_python_client.schema import Reference, Schema - create_schemas = mocker.patch(f"{MODULE_NAME}._create_schemas") process_models = mocker.patch(f"{MODULE_NAME}._process_models") diff --git a/tests/test_parser/test_properties/test_int.py b/tests/test_parser/test_properties/test_int.py deleted file mode 100644 index 7f9953761..000000000 --- a/tests/test_parser/test_properties/test_int.py +++ /dev/null @@ -1,34 +0,0 @@ -from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import IntProperty -from openapi_python_client.parser.properties.protocol import Value -from openapi_python_client.utils import PythonIdentifier - - -def test_invalid_default(): - err = IntProperty.build( - default="not a float", - description=None, - example=None, - required=False, - python_name="not_a_float", - name="not_a_float", - ) - - assert isinstance(err, PropertyError) - - -def test_convert_from_string(): - assert IntProperty.convert_value("1") == Value(python_code="1", raw_value="1") - - -def test_invalid_type_default(): - err = IntProperty.build( - default=True, - description=None, - example=None, - required=False, - python_name=PythonIdentifier("not_a_float", ""), - name="not_a_float", - ) - - assert isinstance(err, PropertyError) diff --git a/tests/test_parser/test_properties/test_list_property.py b/tests/test_parser/test_properties/test_list_property.py deleted file mode 100644 index 60fb0a35d..000000000 --- a/tests/test_parser/test_properties/test_list_property.py +++ /dev/null @@ -1,178 +0,0 @@ -import attr - -import openapi_python_client.schema as oai -from openapi_python_client.parser.errors import ParseError, PropertyError -from openapi_python_client.parser.properties import ListProperty -from openapi_python_client.parser.properties.schemas import ReferencePath -from openapi_python_client.schema import DataType -from openapi_python_client.utils import ClassName - - -def test_build_list_property_no_items(config): - from openapi_python_client.parser import properties - - name = "list_prop" - required = True - data = oai.Schema(type=DataType.ARRAY) - schemas = properties.Schemas() - - p, new_schemas = ListProperty.build( - name=name, - required=required, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - process_properties=True, - roots={ReferencePath("root")}, - ) - - assert p == PropertyError(data=data, detail="type array must have items or prefixItems defined") - assert new_schemas == schemas - - -def test_build_list_property_invalid_items(config): - from openapi_python_client.parser import properties - - name = "name" - required = True - data = oai.Schema( - type=DataType.ARRAY, - items=oai.Reference.model_validate({"$ref": "doesnt exist"}), - ) - schemas = properties.Schemas(errors=[ParseError("error")]) - process_properties = False - roots: set[ReferencePath | ClassName] = {ReferencePath("root")} - - p, new_schemas = ListProperty.build( - name=name, - required=required, - data=data, - schemas=attr.evolve(schemas), - parent_name="parent", - config=config, - roots=roots, - process_properties=process_properties, - ) - - assert isinstance(p, PropertyError) - assert p.data == data.items - assert p.header.startswith(f"invalid data in items of array {name}") - assert new_schemas == schemas - - -def test_build_list_property(any_property_factory, config): - from openapi_python_client.parser import properties - - name = "prop" - data = oai.Schema( - type=DataType.ARRAY, - items=oai.Schema(), - ) - schemas = properties.Schemas(errors=[ParseError("error")]) - - p, new_schemas = ListProperty.build( - name=name, - required=True, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - roots={ReferencePath("root")}, - process_properties=True, - ) - - assert isinstance(p, properties.ListProperty) - assert p.inner_property == any_property_factory(name=f"{name}_item") - assert new_schemas == schemas - - -def test_build_list_property_single_prefix_item(any_property_factory, config): - from openapi_python_client.parser import properties - - name = "prop" - data = oai.Schema( - type=DataType.ARRAY, - prefixItems=[oai.Schema()], - ) - schemas = properties.Schemas(errors=[ParseError("error")]) - - p, new_schemas = ListProperty.build( - name=name, - required=True, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - roots={ReferencePath("root")}, - process_properties=True, - ) - - assert isinstance(p, properties.ListProperty) - assert p.inner_property == any_property_factory(name=f"{name}_item") - assert new_schemas == schemas - - -def test_build_list_property_items_and_prefix_items( - union_property_factory, - string_property_factory, - none_property_factory, - int_property_factory, - config, -): - from openapi_python_client.parser import properties - - name = "list_prop" - required = True - data = oai.Schema( - type=DataType.ARRAY, - items=oai.Schema(type=DataType.INTEGER), - prefixItems=[oai.Schema(type=DataType.STRING), oai.Schema(type=DataType.NULL)], - ) - schemas = properties.Schemas() - - p, new_schemas = ListProperty.build( - name=name, - required=required, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - process_properties=True, - roots={ReferencePath("root")}, - ) - - assert isinstance(p, properties.ListProperty) - assert p.inner_property == union_property_factory( - name=f"{name}_item", - inner_properties=[ - string_property_factory(name=f"{name}_item_type_0"), - none_property_factory(name=f"{name}_item_type_1"), - int_property_factory(name=f"{name}_item_type_2"), - ], - ) - assert new_schemas == schemas - - -def test_build_list_property_prefix_items_only(any_property_factory, config): - from openapi_python_client.parser import properties - - name = "list_prop" - required = True - data = oai.Schema(type=DataType.ARRAY, prefixItems=[oai.Schema()]) - schemas = properties.Schemas() - - p, new_schemas = ListProperty.build( - name=name, - required=required, - data=data, - schemas=schemas, - parent_name="parent", - config=config, - process_properties=True, - roots={ReferencePath("root")}, - ) - - assert isinstance(p, properties.ListProperty) - assert p.inner_property == any_property_factory(name=f"{name}_item") - assert new_schemas == schemas diff --git a/tests/test_parser/test_properties/test_model_property.py b/tests/test_parser/test_properties/test_model_property.py index a51fd984b..4445d441a 100644 --- a/tests/test_parser/test_properties/test_model_property.py +++ b/tests/test_parser/test_properties/test_model_property.py @@ -1,44 +1,41 @@ -from typing import Optional - import pytest from attr import evolve import openapi_python_client.schema as oai from openapi_python_client.parser.errors import PropertyError -from openapi_python_client.parser.properties import Schemas, StringProperty -from openapi_python_client.parser.properties.model_property import ANY_ADDITIONAL_PROPERTY, _process_properties +from openapi_python_client.parser.properties import Class, ModelProperty, Schemas, StringProperty +from openapi_python_client.parser.properties.model_property import ( + ANY_ADDITIONAL_PROPERTY, + _process_properties, + _PropertyData, + process_model, +) MODULE_NAME = "openapi_python_client.parser.properties.model_property" class TestModelProperty: @pytest.mark.parametrize( - "no_optional,required,json,quoted,expected", + "no_optional,required,json,expected", [ - (False, False, False, False, "Union[Unset, MyClass]"), - (False, True, False, False, "MyClass"), - (True, False, False, False, "MyClass"), - (True, True, False, False, "MyClass"), - (False, True, True, False, "dict[str, Any]"), - (False, False, False, True, "Union[Unset, 'MyClass']"), - (False, True, False, True, "'MyClass'"), - (True, False, False, True, "'MyClass'"), - (True, True, False, True, "'MyClass'"), - (False, True, True, True, "dict[str, Any]"), + (False, False, False, "MyClass | Unset"), + (False, True, False, "MyClass"), + (True, False, False, "MyClass"), + (True, True, False, "MyClass"), + (False, True, True, "dict[str, Any]"), ], ) - def test_get_type_string(self, no_optional, required, json, expected, model_property_factory, quoted): + def test_get_type_string(self, no_optional, required, json, expected, model_property_factory): prop = model_property_factory( required=required, ) - assert prop.get_type_string(no_optional=no_optional, json=json, quoted=quoted) == expected + assert prop.get_type_string(no_optional=no_optional, json=json) == expected def test_get_imports(self, model_property_factory): prop = model_property_factory(required=False) assert prop.get_imports(prefix="..") == { - "from typing import Union", "from ..types import UNSET, Unset", "from typing import cast", } @@ -50,19 +47,9 @@ def test_get_lazy_imports(self, model_property_factory): "from ..models.my_module import MyClass", } - def test_is_base_type(self, model_property_factory): - assert model_property_factory().is_base_type is False - - @pytest.mark.parametrize( - "quoted,expected", - [ - (False, "MyClass"), - (True, '"MyClass"'), - ], - ) - def test_get_base_type_string(self, quoted, expected, model_property_factory): + def test_get_base_type_string(self, model_property_factory): m = model_property_factory() - assert m.get_base_type_string(quoted=quoted) == expected + assert m.get_base_type_string() == "MyClass" class TestBuild: @@ -87,8 +74,6 @@ class TestBuild: ], ) def test_additional_schemas(self, additional_properties_schema, expected_additional_properties, config): - from openapi_python_client.parser.properties import ModelProperty, Schemas - data = oai.Schema.model_construct( additionalProperties=additional_properties_schema, ) @@ -107,8 +92,6 @@ def test_additional_schemas(self, additional_properties_schema, expected_additio assert model.additional_properties == expected_additional_properties def test_happy_path(self, model_property_factory, string_property_factory, date_time_property_factory, config): - from openapi_python_client.parser.properties import Class, ModelProperty, Schemas - name = "prop" required = True @@ -159,15 +142,12 @@ def test_happy_path(self, model_property_factory, string_property_factory, date_ "from typing import cast", "import datetime", "from ..types import UNSET, Unset", - "from typing import Union", }, lazy_imports=set(), additional_properties=ANY_ADDITIONAL_PROPERTY, ) def test_model_name_conflict(self, config): - from openapi_python_client.parser.properties import ModelProperty - data = oai.Schema.model_construct() schemas = Schemas(classes_by_name={"OtherModel": None}) @@ -207,14 +187,12 @@ def test_model_name_conflict(self, config): def test_model_naming( self, name: str, - title: Optional[str], - parent_name: Optional[str], + title: str | None, + parent_name: str | None, use_title_prefixing: bool, expected: str, config, ): - from openapi_python_client.parser.properties import ModelProperty - data = oai.Schema( title=title, properties={}, @@ -233,8 +211,6 @@ def test_model_naming( assert result.class_info.name == expected def test_model_bad_properties(self, config): - from openapi_python_client.parser.properties import ModelProperty - data = oai.Schema( properties={ "bad": oai.Reference.model_construct(ref="#/components/schema/NotExist"), @@ -253,8 +229,6 @@ def test_model_bad_properties(self, config): assert isinstance(result, PropertyError) def test_model_bad_additional_properties(self, config): - from openapi_python_client.parser.properties import ModelProperty - additional_properties = oai.Schema( type="object", properties={ @@ -275,8 +249,6 @@ def test_model_bad_additional_properties(self, config): assert isinstance(result, PropertyError) def test_process_properties_false(self, model_property_factory, config): - from openapi_python_client.parser.properties import Class, ModelProperty - name = "prop" required = True @@ -671,9 +643,6 @@ def test_merge_inline_objects(self, model_property_factory, enum_property_factor class TestProcessModel: def test_process_model_error(self, mocker, model_property_factory, config): - from openapi_python_client.parser.properties import Schemas - from openapi_python_client.parser.properties.model_property import process_model - model_prop = model_property_factory() schemas = Schemas() process_property_data = mocker.patch(f"{MODULE_NAME}._process_property_data") @@ -688,9 +657,6 @@ def test_process_model_error(self, mocker, model_property_factory, config): assert model_prop.additional_properties is None def test_process_model(self, mocker, model_property_factory, config): - from openapi_python_client.parser.properties import Schemas - from openapi_python_client.parser.properties.model_property import _PropertyData, process_model - model_prop = model_property_factory() schemas = Schemas() property_data = _PropertyData( @@ -715,8 +681,6 @@ def test_process_model(self, mocker, model_property_factory, config): def test_set_relative_imports(model_property_factory): - from openapi_python_client.parser.properties import Class - class_info = Class("ClassName", module_name="module_name") relative_imports = {f"from ..models.{class_info.module_name} import {class_info.name}"} diff --git a/tests/test_parser/test_properties/test_none.py b/tests/test_parser/test_properties/test_none.py index d61ca0136..b6289cdb8 100644 --- a/tests/test_parser/test_properties/test_none.py +++ b/tests/test_parser/test_properties/test_none.py @@ -5,6 +5,8 @@ def test_default(): + # currently this is testing an unused code path: + # https://github.com/openapi-generators/openapi-python-client/issues/1162 err = NoneProperty.build( default="not None", description=None, diff --git a/tests/test_parser/test_properties/test_protocol.py b/tests/test_parser/test_properties/test_protocol.py index 1d4111750..625556c5b 100644 --- a/tests/test_parser/test_properties/test_protocol.py +++ b/tests/test_parser/test_properties/test_protocol.py @@ -2,41 +2,36 @@ import pytest +from openapi_python_client.parser.properties import AnyProperty from openapi_python_client.parser.properties.protocol import Value -def test_is_base_type(any_property_factory): - assert any_property_factory().is_base_type is True - - @pytest.mark.parametrize( - "required,no_optional,json,quoted,expected", + "required,no_optional,json,expected", [ - (False, False, False, False, "Union[Unset, TestType]"), - (False, True, False, False, "TestType"), - (True, False, False, False, "TestType"), - (True, True, False, False, "TestType"), - (False, False, True, False, "Union[Unset, str]"), - (False, True, True, False, "str"), - (True, False, True, False, "str"), - (True, True, True, False, "str"), + (False, False, False, "TestType | Unset"), + (False, True, False, "TestType"), + (True, False, False, "TestType"), + (True, True, False, "TestType"), + (False, False, True, "str | Unset"), + (False, True, True, "str"), + (True, False, True, "str"), + (True, True, True, "str"), ], ) -def test_get_type_string(any_property_factory, mocker, required, no_optional, json, expected, quoted): - from openapi_python_client.parser.properties import AnyProperty - +def test_get_type_string(any_property_factory, mocker, required, no_optional, json, expected): mocker.patch.object(AnyProperty, "_type_string", "TestType") mocker.patch.object(AnyProperty, "_json_type_string", "str") p = any_property_factory(required=required) - assert p.get_type_string(no_optional=no_optional, json=json, quoted=quoted) == expected + assert p.get_type_string(no_optional=no_optional, json=json) == expected @pytest.mark.parametrize( "default,required,expected", [ - (None, False, "test: Union[Unset, Any] = UNSET"), + (None, False, "test: Any | Unset = UNSET"), (None, True, "test: Any"), - ("Test", False, "test: Union[Unset, Any] = Test"), + ("Test", False, "test: Any | Unset = Test"), ("Test", True, "test: Any = Test"), ], ) @@ -54,34 +49,4 @@ def test_get_imports(any_property_factory): assert p.get_imports(prefix="") == set() p = any_property_factory(name="test", required=False, default=None) - assert p.get_imports(prefix="") == {"from types import UNSET, Unset", "from typing import Union"} - - -@pytest.mark.parametrize( - "quoted,expected", - [ - (False, "TestType"), - (True, "TestType"), - ], -) -def test_get_base_type_string(quoted, expected, any_property_factory, mocker): - from openapi_python_client.parser.properties import AnyProperty - - mocker.patch.object(AnyProperty, "_type_string", "TestType") - p = any_property_factory() - assert p.get_base_type_string(quoted=quoted) is expected - - -@pytest.mark.parametrize( - "quoted,expected", - [ - (False, "str"), - (True, "str"), - ], -) -def test_get_base_json_type_string(quoted, expected, any_property_factory, mocker): - from openapi_python_client.parser.properties import AnyProperty - - mocker.patch.object(AnyProperty, "_json_type_string", "str") - p = any_property_factory() - assert p.get_base_json_type_string(quoted=quoted) is expected + assert p.get_imports(prefix="") == {"from types import UNSET, Unset"} diff --git a/tests/test_parser/test_properties/test_schemas.py b/tests/test_parser/test_properties/test_schemas.py index 5560795cf..7e7af8514 100644 --- a/tests/test_parser/test_properties/test_schemas.py +++ b/tests/test_parser/test_properties/test_schemas.py @@ -1,18 +1,21 @@ import pytest from attr import evolve +from openapi_python_client.config import ClassOverride from openapi_python_client.parser.errors import ParameterError from openapi_python_client.parser.properties import Class, Parameters -from openapi_python_client.parser.properties.schemas import parameter_from_reference -from openapi_python_client.schema import Parameter, Reference +from openapi_python_client.parser.properties.schemas import ( + parameter_from_data, + parameter_from_reference, + update_parameters_with_data, +) +from openapi_python_client.schema import Parameter, ParameterLocation, Reference, Schema from openapi_python_client.utils import ClassName MODULE_NAME = "openapi_python_client.parser.properties.schemas" def test_class_from_string_default_config(config): - from openapi_python_client.parser.properties import Class - class_ = Class.from_string(string="#/components/schemas/PingResponse", config=config) assert class_.name == "PingResponse" @@ -29,9 +32,6 @@ def test_class_from_string_default_config(config): ), ) def test_class_from_string(class_override, module_override, expected_class, expected_module, config): - from openapi_python_client.config import ClassOverride - from openapi_python_client.parser.properties import Class - ref = "#/components/schemas/MyResponse" config = evolve( config, class_overrides={"MyResponse": ClassOverride(class_name=class_override, module_name=module_override)} @@ -44,9 +44,6 @@ def test_class_from_string(class_override, module_override, expected_class, expe class TestParameterFromData: def test_cannot_parse_parameters_by_reference(self, config): - from openapi_python_client.parser.properties import Parameters - from openapi_python_client.parser.properties.schemas import parameter_from_data - ref = Reference.model_construct(ref="#/components/parameters/a_param") parameters = Parameters() param_or_error, new_parameters = parameter_from_data( @@ -56,10 +53,6 @@ def test_cannot_parse_parameters_by_reference(self, config): assert new_parameters == parameters def test_parameters_without_schema_are_ignored(self, config): - from openapi_python_client.parser.properties import Parameters - from openapi_python_client.parser.properties.schemas import parameter_from_data - from openapi_python_client.schema import ParameterLocation - param = Parameter(name="a_schemaless_param", param_in=ParameterLocation.QUERY) parameters = Parameters() param_or_error, new_parameters = parameter_from_data( @@ -69,10 +62,6 @@ def test_parameters_without_schema_are_ignored(self, config): assert new_parameters == parameters def test_registers_new_parameters(self, config): - from openapi_python_client.parser.properties import Parameters - from openapi_python_client.parser.properties.schemas import parameter_from_data - from openapi_python_client.schema import ParameterLocation, Schema - param = Parameter.model_construct( name="a_param", param_in=ParameterLocation.QUERY, param_schema=Schema.model_construct() ) @@ -119,9 +108,6 @@ def test_returns_reference_from_registry(self): class TestUpdateParametersFromData: def test_reports_parameters_with_errors(self, mocker, config): - from openapi_python_client.parser.properties.schemas import update_parameters_with_data - from openapi_python_client.schema import ParameterLocation, Schema - parameters = Parameters() param = Parameter.model_construct( name="a_param", param_in=ParameterLocation.QUERY, param_schema=Schema.model_construct() @@ -141,9 +127,6 @@ def test_reports_parameters_with_errors(self, mocker, config): ) def test_records_references_to_parameters(self, mocker, config): - from openapi_python_client.parser.properties.schemas import update_parameters_with_data - from openapi_python_client.schema import ParameterLocation, Schema - parameters = Parameters() param = Parameter.model_construct( name="a_param", param_in=ParameterLocation.QUERY, param_schema=Schema.model_construct() diff --git a/tests/test_parser/test_properties/test_union.py b/tests/test_parser/test_properties/test_union.py index acbbd06d6..a36e14030 100644 --- a/tests/test_parser/test_properties/test_union.py +++ b/tests/test_parser/test_properties/test_union.py @@ -1,63 +1,9 @@ import openapi_python_client.schema as oai -from openapi_python_client.parser.errors import ParseError, PropertyError -from openapi_python_client.parser.properties import Schemas, UnionProperty -from openapi_python_client.parser.properties.protocol import Value +from openapi_python_client.parser.errors import ParseError +from openapi_python_client.parser.properties import Schemas, UnionProperty, property_from_data from openapi_python_client.schema import DataType, ParameterLocation -def test_property_from_data_union(union_property_factory, date_time_property_factory, string_property_factory, config): - from openapi_python_client.parser.properties import Schemas, property_from_data - - name = "union_prop" - required = True - data = oai.Schema( - anyOf=[oai.Schema(type=DataType.STRING, default="a")], - oneOf=[ - oai.Schema(type=DataType.STRING, schema_format="date-time"), - ], - ) - expected = union_property_factory( - name=name, - required=required, - inner_properties=[ - string_property_factory(name=f"{name}_type_0", default=Value("'a'", "a")), - date_time_property_factory(name=f"{name}_type_1"), - ], - ) - - p, s = property_from_data( - name=name, required=required, data=data, schemas=Schemas(), parent_name="parent", config=config - ) - - assert p == expected - assert s == Schemas() - - -def test_build_union_property_invalid_property(config): - name = "bad_union" - required = True - reference = oai.Reference.model_construct(ref="#/components/schema/NotExist") - data = oai.Schema(anyOf=[reference]) - - p, s = UnionProperty.build( - name=name, required=required, data=data, schemas=Schemas(), parent_name="parent", config=config - ) - assert p == PropertyError(detail=f"Invalid property in union {name}", data=reference) - - -def test_invalid_default(config): - data = oai.Schema( - type=[DataType.NUMBER, DataType.INTEGER], - default="a", - ) - - err, _ = UnionProperty.build( - data=data, required=True, schemas=Schemas(), parent_name="parent", name="name", config=config - ) - - assert isinstance(err, PropertyError) - - def test_invalid_location(config): data = oai.Schema( type=[DataType.NUMBER, DataType.NULL], @@ -82,3 +28,49 @@ def test_not_required_in_path(config): err = prop.validate_location(ParameterLocation.PATH) assert isinstance(err, ParseError) + + +def test_union_oneOf_descriptive_type_name( + union_property_factory, date_time_property_factory, string_property_factory, config +): + nested_schema_variant_A = oai.Schema(type=DataType.STRING, title="A") + nested_schema_variant_B = oai.Schema(type=DataType.STRING, title="B") + nested_schema_variant_2 = oai.Schema(type=DataType.STRING) + nested_schema_variant_C = oai.Schema(type=DataType.STRING, title="C") + nested_schema_variant_4 = oai.Schema(type=DataType.STRING) + + name = "union_prop" + required = True + data = oai.Schema( + anyOf=[ + # AnyOf retains the old naming convention + nested_schema_variant_C, + nested_schema_variant_4, + ], + oneOf=[ + # OneOf fields that define their own titles will have those titles as their Type names + nested_schema_variant_A, + nested_schema_variant_B, + nested_schema_variant_2, + oai.Schema(type=DataType.STRING, schema_format="date-time"), + ], + ) + expected = union_property_factory( + name=name, + required=required, + inner_properties=[ + string_property_factory(name=f"{name}_C"), + string_property_factory(name=f"{name}_type_1"), + string_property_factory(name=f"{name}_A"), + string_property_factory(name=f"{name}_B"), + string_property_factory(name=f"{name}_type_4"), + date_time_property_factory(name=f"{name}_type_5"), + ], + ) + + p, s = property_from_data( + name=name, required=required, data=data, schemas=Schemas(), parent_name="parent", config=config + ) + + assert p == expected + assert s == Schemas() diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index 0ac885764..6c0f60e2c 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -1,28 +1,36 @@ from unittest.mock import MagicMock +import pytest + import openapi_python_client.schema as oai +from openapi_python_client.parser import responses from openapi_python_client.parser.errors import ParseError, PropertyError from openapi_python_client.parser.properties import Schemas -from openapi_python_client.parser.responses import JSON_SOURCE, NONE_SOURCE +from openapi_python_client.parser.responses import ( + JSON_SOURCE, + NONE_SOURCE, + HTTPStatusPattern, + Response, + response_from_data, +) MODULE_NAME = "openapi_python_client.parser.responses" def test_response_from_data_no_content(any_property_factory): - from openapi_python_client.parser.responses import Response, response_from_data - data = oai.Response.model_construct(description="") - response, schemas = response_from_data( - status_code=200, + response, _schemas = response_from_data( + status_code=HTTPStatusPattern(pattern="200", code_range=(200, 200)), data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=MagicMock(), ) assert response == Response( - status_code=200, + status_code=HTTPStatusPattern(pattern="200", code_range=(200, 200)), prop=any_property_factory( name="response_200", default=None, @@ -34,41 +42,18 @@ def test_response_from_data_no_content(any_property_factory): ) -def test_response_from_data_reference(any_property_factory): - from openapi_python_client.parser.responses import Response, response_from_data - - data = oai.Reference.model_construct() - - response, schemas = response_from_data( - status_code=200, - data=data, - schemas=Schemas(), - parent_name="parent", - config=MagicMock(), - ) - - assert response == Response( - status_code=200, - prop=any_property_factory( - name="response_200", - default=None, - required=True, - ), - source=NONE_SOURCE, - data=data, - ) +status_code = HTTPStatusPattern(pattern="200", code_range=(200, 200)) def test_response_from_data_unsupported_content_type(): - from openapi_python_client.parser.responses import response_from_data - data = oai.Response.model_construct(description="", content={"blah": None}) config = MagicMock() config.content_type_overrides = {} - response, schemas = response_from_data( - status_code=200, + response, _schemas = response_from_data( + status_code=status_code, data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=config, ) @@ -77,24 +62,23 @@ def test_response_from_data_unsupported_content_type(): def test_response_from_data_no_content_schema(any_property_factory): - from openapi_python_client.parser.responses import Response, response_from_data - data = oai.Response.model_construct( description="", content={"application/vnd.api+json; version=2.2": oai.MediaType.model_construct()}, ) config = MagicMock() config.content_type_overrides = {} - response, schemas = response_from_data( - status_code=200, + response, _schemas = response_from_data( + status_code=status_code, data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=config, ) assert response == Response( - status_code=200, + status_code=status_code, prop=any_property_factory( name="response_200", default=None, @@ -107,8 +91,6 @@ def test_response_from_data_no_content_schema(any_property_factory): def test_response_from_data_property_error(mocker): - from openapi_python_client.parser import responses - property_from_data = mocker.patch.object(responses, "property_from_data", return_value=(PropertyError(), Schemas())) data = oai.Response.model_construct( description="", @@ -117,10 +99,11 @@ def test_response_from_data_property_error(mocker): config = MagicMock() config.content_type_overrides = {} - response, schemas = responses.response_from_data( - status_code=400, + response, _schemas = responses.response_from_data( + status_code=HTTPStatusPattern(pattern="400", code_range=(400, 400)), data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=config, ) @@ -137,8 +120,6 @@ def test_response_from_data_property_error(mocker): def test_response_from_data_property(mocker, any_property_factory): - from openapi_python_client.parser import responses - prop = any_property_factory() property_from_data = mocker.patch.object(responses, "property_from_data", return_value=(prop, Schemas())) data = oai.Response.model_construct( @@ -147,17 +128,19 @@ def test_response_from_data_property(mocker, any_property_factory): ) config = MagicMock() config.content_type_overrides = {} + status_code = HTTPStatusPattern(pattern="400", code_range=(400, 400)) - response, schemas = responses.response_from_data( - status_code=400, + response, _schemas = responses.response_from_data( + status_code=status_code, data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=config, ) assert response == responses.Response( - status_code=400, + status_code=status_code, prop=prop, source=JSON_SOURCE, data=data, @@ -172,25 +155,111 @@ def test_response_from_data_property(mocker, any_property_factory): ) -def test_response_from_data_content_type_overrides(any_property_factory): - from openapi_python_client.parser.responses import Response, response_from_data +def test_response_from_data_reference(mocker, any_property_factory): + prop = any_property_factory() + mocker.patch.object(responses, "property_from_data", return_value=(prop, Schemas())) + predefined_response_data = oai.Response.model_construct( + description="", + content={"application/json": oai.MediaType.model_construct(media_type_schema="something")}, + ) + config = MagicMock() + config.content_type_overrides = {} + response, _schemas = responses.response_from_data( + status_code=HTTPStatusPattern(pattern="400", code_range=(400, 400)), + data=oai.Reference.model_construct(ref="#/components/responses/ErrorResponse"), + schemas=Schemas(), + responses={"ErrorResponse": predefined_response_data}, + parent_name="parent", + config=config, + ) + + assert response == responses.Response( + status_code=HTTPStatusPattern(pattern="400", code_range=(400, 400)), + prop=prop, + source=JSON_SOURCE, + data=predefined_response_data, + ) + + +@pytest.mark.parametrize( + "ref_string,expected_error_string", + [ + ("#/components/responses/Nonexistent", "Could not find"), + ("https://remote-reference", "Remote references"), + ("#/components/something-that-isnt-responses/ErrorResponse", "not allowed in responses"), + ], +) +def test_response_from_data_invalid_reference(ref_string, expected_error_string, mocker, any_property_factory): + prop = any_property_factory() + mocker.patch.object(responses, "property_from_data", return_value=(prop, Schemas())) + predefined_response_data = oai.Response.model_construct( + description="", + content={"application/json": oai.MediaType.model_construct(media_type_schema="something")}, + ) + config = MagicMock() + config.content_type_overrides = {} + + response, _schemas = responses.response_from_data( + status_code=HTTPStatusPattern(pattern="400", code_range=(400, 400)), + data=oai.Reference.model_construct(ref=ref_string), + schemas=Schemas(), + responses={"ErrorResponse": predefined_response_data}, + parent_name="parent", + config=config, + ) + + assert isinstance(response, ParseError) + assert expected_error_string in response.detail + + +def test_response_from_data_ref_to_response_that_is_a_ref(mocker, any_property_factory): + prop = any_property_factory() + mocker.patch.object(responses, "property_from_data", return_value=(prop, Schemas())) + predefined_response_base_data = oai.Response.model_construct( + description="", + content={"application/json": oai.MediaType.model_construct(media_type_schema="something")}, + ) + predefined_response_data = oai.Reference.model_construct( + ref="#/components/references/BaseResponse", + ) + config = MagicMock() + config.content_type_overrides = {} + + response, _schemas = responses.response_from_data( + status_code=HTTPStatusPattern(pattern="400", code_range=(400, 400)), + data=oai.Reference.model_construct(ref="#/components/responses/ErrorResponse"), + schemas=Schemas(), + responses={ + "BaseResponse": predefined_response_base_data, + "ErrorResponse": predefined_response_data, + }, + parent_name="parent", + config=config, + ) + + assert isinstance(response, ParseError) + assert response.detail is not None and "Top-level $ref" in response.detail + + +def test_response_from_data_content_type_overrides(any_property_factory): data = oai.Response.model_construct( description="", content={"application/zip": oai.MediaType.model_construct()}, ) config = MagicMock() config.content_type_overrides = {"application/zip": "application/octet-stream"} - response, schemas = response_from_data( - status_code=200, + response, _schemas = response_from_data( + status_code=HTTPStatusPattern(pattern="200", code_range=(200, 200)), data=data, schemas=Schemas(), + responses={}, parent_name="parent", config=config, ) assert response == Response( - status_code=200, + status_code=HTTPStatusPattern(pattern="200", code_range=(200, 200)), prop=any_property_factory( name="response_200", default=None, @@ -200,3 +269,23 @@ def test_response_from_data_content_type_overrides(any_property_factory): source=NONE_SOURCE, data=data, ) + + +@pytest.mark.parametrize( + "pattern1, pattern2, result", + [ + ("400", "401", True), + ("503", "500", False), + ("default", "400", False), + ("400", "default", True), + ("2XX", "3XX", True), + ("3XX", "2XX", False), + ("2XX", "400", False), + ], +) +def test_http_status_pattern_lt(pattern1: str, pattern2: str, result: bool) -> None: + first = HTTPStatusPattern.parse(pattern1) + second = HTTPStatusPattern.parse(pattern2) + assert isinstance(first, HTTPStatusPattern) + assert isinstance(second, HTTPStatusPattern) + assert (first < second) == result diff --git a/tests/test_schema/test_data_type.py b/tests/test_schema/test_data_type.py index 19aa256eb..0a4d9681d 100644 --- a/tests/test_schema/test_data_type.py +++ b/tests/test_schema/test_data_type.py @@ -1,3 +1,4 @@ +import pydantic import pytest import openapi_python_client.schema as oai @@ -5,8 +6,6 @@ class TestDataType: def test_schema_bad_types(self): - import pydantic - with pytest.raises(pydantic.ValidationError): oai.Schema(type="bad_type") diff --git a/tests/test_schema/test_noisy_refs.py b/tests/test_schema/test_noisy_refs.py new file mode 100644 index 000000000..ff5a7cf1c --- /dev/null +++ b/tests/test_schema/test_noisy_refs.py @@ -0,0 +1,89 @@ +# If a field may be reference (`Union[Reference, OtherType]`) and the dictionary +# being processed for it contains "$ref", it seems like it should preferentially +# be parsed as a `Reference`[1]. Since the models are defined with +# `extra="allow"`, Pydantic won't guarantee this parse if the dictionary is in +# an unspecified sense a "better match" for `OtherType`[2], e.g., perhaps if it +# has several more fields matching that type versus the single match for `$ref`. +# +# We can use a discriminated union to force parsing these dictionaries as +# `Reference`s. +# +# References: +# [1] https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object +# [2] https://docs.pydantic.dev/latest/concepts/unions/#smart-mode +from typing import Annotated, TypeVar, get_args, get_origin + +import pytest +from pydantic import TypeAdapter + +from openapi_python_client.schema.openapi_schema_pydantic import ( + Callback, + Example, + Header, + Link, + Parameter, + PathItem, + Reference, + RequestBody, + Response, + Schema, + SecurityScheme, +) + +try: + from openapi_python_client.schema.openapi_schema_pydantic.reference import ReferenceOr +except ImportError: + T = TypeVar("T") + ReferenceOr = Reference | T + + +def get_example(base_type): + schema = base_type.model_json_schema() + if "examples" in schema: + return schema["examples"][0] + if "$defs" in schema: + return schema["$defs"][base_type.__name__]["examples"][0] + raise TypeError(f"No example found for {base_type.__name__}") + + +def deannotate_type(t): + while get_origin(t) is Annotated: + t = get_args(t)[0] + return t + + +# The following types occur in various models, so we want to make sure they +# parse properly. They are verified to /fail/ to parse as of commit 3bd12f86. + + +@pytest.mark.parametrize( + ("ref_or_type", "get_example_fn"), + [ + (ReferenceOr[Callback], lambda t: {"test1": get_example(PathItem), "test2": get_example(PathItem)}), + (ReferenceOr[Example], get_example), + (ReferenceOr[Header], get_example), + (ReferenceOr[Link], get_example), + (ReferenceOr[Parameter], get_example), + (ReferenceOr[RequestBody], get_example), + (ReferenceOr[Response], get_example), + (ReferenceOr[Schema], get_example), + (ReferenceOr[SecurityScheme], get_example), + ], +) +def test_type(ref_or_type, get_example_fn): + base_type = None + for maybe_annotated_type in get_args(deannotate_type(ref_or_type)): + each_type = deannotate_type(maybe_annotated_type) + if each_type is not Reference: + base_type = each_type + break + assert base_type is not None + + example = get_example_fn(base_type) + + parsed = TypeAdapter(ref_or_type).validate_python(example) + assert type(parsed) is get_origin(base_type) or base_type + + example["$ref"] = "ref" + parsed = TypeAdapter(ref_or_type).validate_python(example) + assert type(parsed) is Reference diff --git a/tests/test_templates/test_property_templates/test_date_property/date_property_template.py.jinja b/tests/test_templates/test_property_templates/test_date_property/date_property_template.py.jinja index 3709963fe..66ed7a9fc 100644 --- a/tests/test_templates/test_property_templates/test_date_property/date_property_template.py.jinja +++ b/tests/test_templates/test_property_templates/test_date_property/date_property_template.py.jinja @@ -1,5 +1,4 @@ from datetime import date -from typing import cast, Union from dateutil.parser import isoparse {% from "property_templates/date_property.py.jinja" import transform, construct %} diff --git a/tests/test_templates/test_property_templates/test_date_property/required_not_null.py b/tests/test_templates/test_property_templates/test_date_property/required_not_null.py index ad4f380a4..c2a190fab 100644 --- a/tests/test_templates/test_property_templates/test_date_property/required_not_null.py +++ b/tests/test_templates/test_property_templates/test_date_property/required_not_null.py @@ -1,5 +1,4 @@ from datetime import date -from typing import cast, Union from dateutil.parser import isoparse some_source = date(2020, 10, 12) diff --git a/tests/test_templates/test_property_templates/test_datetime_property/datetime_property_template.py.jinja b/tests/test_templates/test_property_templates/test_datetime_property/datetime_property_template.py.jinja index 85fa1548d..c922fa469 100644 --- a/tests/test_templates/test_property_templates/test_datetime_property/datetime_property_template.py.jinja +++ b/tests/test_templates/test_property_templates/test_datetime_property/datetime_property_template.py.jinja @@ -1,5 +1,4 @@ from datetime import date -from typing import cast, Union from dateutil.parser import isoparse {% from "property_templates/datetime_property.py.jinja" import transform, construct %} diff --git a/tests/test_templates/test_property_templates/test_datetime_property/required_not_null.py b/tests/test_templates/test_property_templates/test_datetime_property/required_not_null.py index 8253828e3..ab016a8a1 100644 --- a/tests/test_templates/test_property_templates/test_datetime_property/required_not_null.py +++ b/tests/test_templates/test_property_templates/test_datetime_property/required_not_null.py @@ -1,5 +1,4 @@ from datetime import date -from typing import cast, Union from dateutil.parser import isoparse some_source = date(2020, 10, 12)