From 6aded7bc87957c8b9eb164f717c4be71b0183a7f Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 10:44:35 -0600 Subject: [PATCH 1/5] ci: Use Checkout releases instead of shas --- .github/workflows/checks.yml | 6 +++--- .github/workflows/preview_release_pr.yml | 2 +- .github/workflows/release-dry-run.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8de8f05d7..f6ead421c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,7 +15,7 @@ jobs: os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4.1.0 - name: Set up Python uses: actions/setup-python@v4 with: @@ -79,7 +79,7 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4.1.0 - name: Download coverage reports uses: actions/download-artifact@v3 with: @@ -102,7 +102,7 @@ jobs: ports: - "3000:3000" steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4.1.0 - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/preview_release_pr.yml b/.github/workflows/preview_release_pr.yml index b8c18bd7c..f251f9229 100644 --- a/.github/workflows/preview_release_pr.yml +++ b/.github/workflows/preview_release_pr.yml @@ -7,7 +7,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'chore: prepare release')" # Skip merges from releases runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.0 with: fetch-depth: 0 token: ${{ secrets.PAT }} diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index 303dec2d0..fcd54a3f0 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -6,7 +6,7 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4.1.0 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6cb5d007b..7fb564f58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: if: github.head_ref == 'release' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4.1.0 with: fetch-depth: 0 token: ${{ secrets.PAT }} From 0fa4c754331c017df647c5875a6ff2e17b390611 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 10:49:02 -0600 Subject: [PATCH 2/5] ci: Test Python 3.12 --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index f6ead421c..2bbee4fb4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,7 +11,7 @@ jobs: test: strategy: matrix: - python: [ "3.8", "3.9", "3.10", "3.11" ] + python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: @@ -106,7 +106,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.8" - name: Get Python Version id: get_python_version run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT From 948c05e85b420ee63cdc160f3d52cbc728e0fe09 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 10:49:50 -0600 Subject: [PATCH 3/5] ci: Fix Knope dry-run --- .github/workflows/release-dry-run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index fcd54a3f0..feafbeebe 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -14,4 +14,4 @@ jobs: uses: knope-dev/action@v2.0.0 with: version: 0.12.0 - - run: knope release --dry-run + - run: knope prepare-release --dry-run From 60070064cf7e83375c1502d1ec25719eaee0ac74 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 12:21:52 -0600 Subject: [PATCH 4/5] Switch to Ruff --- ...ess_pass_statements_from_generated_code.md | 5 + ...f_instead_of_isort_autoflake_at_runtime.md | 7 + .github/check_for_changes.py | 5 +- .github/workflows/checks.yml | 7 +- README.md | 5 +- .../api/default/get_common_parameters.py | 2 - .../api/default/post_common_parameters.py | 2 - .../api/default/reserved_parameters.py | 2 - .../get_location_query_optionality.py | 2 - ...st_naming_property_conflict_with_import.py | 2 - ...lete_common_parameters_overriding_param.py | 2 - .../get_common_parameters_overriding_param.py | 2 - .../parameters/multiple_path_parameters.py | 2 - ..._responses_unions_simple_before_complex.py | 2 - .../api/tag1/get_tag_with_number.py | 2 - .../api/tests/callback_test.py | 2 - .../api/tests/defaults_tests_defaults_post.py | 2 - .../api/tests/description_with_backslash.py | 2 - .../api/tests/get_basic_list_of_booleans.py | 2 - .../api/tests/get_basic_list_of_floats.py | 2 - .../api/tests/get_basic_list_of_integers.py | 2 - .../api/tests/get_basic_list_of_strings.py | 2 - .../api/tests/get_user_list.py | 2 - .../api/tests/int_enum_tests_int_enum_post.py | 2 - .../tests/json_body_tests_json_body_post.py | 2 - .../no_response_tests_no_response_get.py | 2 - .../octet_stream_tests_octet_stream_get.py | 2 - .../api/tests/post_form_data.py | 2 - .../api/tests/post_form_data_inline.py | 2 - .../api/tests/post_tests_json_body_string.py | 2 - .../api/tests/test_inline_objects.py | 2 - ...d_content_tests_unsupported_content_get.py | 2 - .../tests/upload_file_tests_upload_post.py | 2 - ...upload_multiple_files_tests_upload_post.py | 2 - .../my_test_api_client/api/true_/false_.py | 2 - ...ems_object_additional_properties_a_item.py | 2 - ...ems_object_additional_properties_b_item.py | 2 - ...circular_ref_in_additional_properties_a.py | 2 - ...circular_ref_in_additional_properties_b.py | 2 - end_to_end_tests/golden-record/pyproject.toml | 6 +- end_to_end_tests/test_end_to_end.py | 3 +- .../api/body/post_body_multipart.py | 2 - integration-tests/pyproject.toml | 6 +- openapi_python_client/__init__.py | 7 +- openapi_python_client/cli.py | 5 +- openapi_python_client/config.py | 3 +- openapi_python_client/parser/openapi.py | 9 +- .../parser/properties/__init__.py | 9 +- .../parser/properties/enum_property.py | 1 - .../parser/properties/model_property.py | 87 +++-- .../parser/properties/property.py | 3 +- .../parser/properties/schemas.py | 2 +- .../openapi_schema_pydantic/callback.py | 2 +- .../openapi_schema_pydantic/encoding.py | 2 +- .../openapi_schema_pydantic/open_api.py | 3 +- .../openapi_schema_pydantic/operation.py | 4 +- .../openapi_schema_pydantic/path_item.py | 2 +- .../templates/pyproject_no_poetry.toml.jinja | 6 +- poetry.lock | 306 ++---------------- pyproject.toml | 41 +-- tests/test___init__.py | 6 +- tests/test___main__.py | 3 +- tests/test_cli.py | 11 +- tests/test_parser/test_openapi.py | 18 +- .../test_parser/test_properties/test_init.py | 30 +- .../test_properties/test_model_property.py | 1 - tests/test_parser/test_responses.py | 2 +- 67 files changed, 165 insertions(+), 512 deletions(-) create mode 100644 .changeset/remove_useless_pass_statements_from_generated_code.md create mode 100644 .changeset/use_ruff_instead_of_isort_autoflake_at_runtime.md diff --git a/.changeset/remove_useless_pass_statements_from_generated_code.md b/.changeset/remove_useless_pass_statements_from_generated_code.md new file mode 100644 index 000000000..27b90e613 --- /dev/null +++ b/.changeset/remove_useless_pass_statements_from_generated_code.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +#### Remove useless `pass` statements from generated code diff --git a/.changeset/use_ruff_instead_of_isort_autoflake_at_runtime.md b/.changeset/use_ruff_instead_of_isort_autoflake_at_runtime.md new file mode 100644 index 000000000..56006f10d --- /dev/null +++ b/.changeset/use_ruff_instead_of_isort_autoflake_at_runtime.md @@ -0,0 +1,7 @@ +--- +default: major +--- + +#### Use Ruff instead of isort + autoflake at runtime + +`isort` and `autoflake` are no longer runtime dependencies, so if you have them set in custom `post_hooks` in a config file, you'll need to make sure they're being installed manually. [`ruff`](https://docs.astral.sh/ruff) is now installed and used by default instead. diff --git a/.github/check_for_changes.py b/.github/check_for_changes.py index 01a77d3df..03b61358d 100644 --- a/.github/check_for_changes.py +++ b/.github/check_for_changes.py @@ -1,10 +1,11 @@ import subprocess +import sys output = subprocess.run(["git", "status", "--porcelain"], capture_output=True, check=True).stdout if output == b"": # No changes - exit(0) + sys.exit(0) print(output) -exit(1) +sys.exit(1) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2bbee4fb4..c1fd00df5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -48,17 +48,14 @@ jobs: - name: Run Black run: poetry run black . --check - - name: Run isort - run: poetry run isort . --check - - name: Run safety run: poetry export -f requirements.txt | poetry run safety check --bare --stdin - name: Run mypy run: poetry run mypy --show-error-codes openapi_python_client - - name: Run pylint - run: poetry run pylint openapi_python_client + - name: Run Ruff + run: poetry run ruff check . - name: Run pytest run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp diff --git a/README.md b/README.md index cea385093..e82b4d2a9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This tool focuses on creating the best developer experience for Python developer I recommend you install with [pipx](https://pipxproject.github.io/pipx/) so you don't conflict with any other packages you might have: `pipx install openapi-python-client --include-deps`. -> Note the `--include-deps` option which will also make `black`, `isort`, and `autoflake` available in your path so that `openapi-python-client` can use them to clean up the generated code. +> Note the `--include-deps` option which will also make `black` and `ruff` available in your path so that `openapi-python-client` can use them to clean up the generated code. **If you use `pipx run` then the post-generation hooks will not be available unless you install them manually.** @@ -151,8 +151,7 @@ In the config file, there's an easy way to tell `openapi-python-client` to run a ```yaml post_hooks: - - "autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports ." - - "isort ." + - "ruff check . --fix" - "black ." ``` 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 6a5d59c1b..3eb7cae13 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 @@ -12,8 +12,6 @@ def _get_kwargs( *, common: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["common"] = common 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 c666d2553..4f82c6f90 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 @@ -12,8 +12,6 @@ def _get_kwargs( *, common: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["common"] = common 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 75e9c9eaf..7fb74c804 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 @@ -13,8 +13,6 @@ def _get_kwargs( client_query: str, url_query: str, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["client"] = client_query 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 c58dcad67..7daa34252 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 @@ -16,8 +16,6 @@ def _get_kwargs( null_not_required: Union[Unset, None, datetime.datetime] = UNSET, not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} json_not_null_required = not_null_required.isoformat() 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 ef3b0acfd..6174aea46 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 @@ -16,8 +16,6 @@ def _get_kwargs( *, json_body: PostNamingPropertyConflictWithImportJsonBody, ) -> Dict[str, Any]: - pass - json_json_body = json_body.to_dict() return { 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 22c847c93..bf33c3206 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 @@ -13,8 +13,6 @@ def _get_kwargs( *, param_query: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["param"] = param_query 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 0807f13cd..73d4dcfd7 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 @@ -13,8 +13,6 @@ def _get_kwargs( *, param_query: str = "overridden_in_GET", ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["param"] = param_query 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 837315e66..0e8ce7ec5 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 @@ -14,8 +14,6 @@ def _get_kwargs( param1: str, param3: int, ) -> Dict[str, Any]: - pass - return { "method": "get", "url": "/multiple-path-parameters/{param4}/something/{param2}/{param1}/{param3}".format( 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 e38719506..3bb13d534 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 @@ -12,8 +12,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "post", "url": "/responses/unions/simple_before_complex", 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 d2fe55457..c2bacd545 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tag_with_number", 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 654d24845..e46cf0e56 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 @@ -14,8 +14,6 @@ def _get_kwargs( *, json_body: AModel, ) -> Dict[str, Any]: - pass - json_json_body = json_body.to_dict() return { diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 422d36930..f958a03e1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -27,8 +27,6 @@ def _get_kwargs( model_prop: "ModelWithUnionProperty", required_model_prop: "ModelWithUnionProperty", ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["string_prop"] = string_prop 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 91c1dcbb1..20954b5d7 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/description-with-backslash", 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 496dbd714..73a08b31a 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/basic_lists/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 6f0e78f54..f64ec5570 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/basic_lists/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 180f6251d..859b09829 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/basic_lists/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 824ff5f20..7d9261007 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/basic_lists/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 840c486dd..c03b67369 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 @@ -20,8 +20,6 @@ def _get_kwargs( an_enum_value_with_only_null: List[None], some_date: Union[datetime.date, datetime.datetime], ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} json_an_enum_value = [] for an_enum_value_item_data in an_enum_value: diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py index aa6ec8964..e22287b08 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py @@ -14,8 +14,6 @@ def _get_kwargs( *, int_enum: AnIntEnum, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} json_int_enum = int_enum.value 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 cf4e1d48e..995c4c4d6 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 @@ -14,8 +14,6 @@ def _get_kwargs( *, json_body: AModel, ) -> Dict[str, Any]: - pass - json_json_body = json_body.to_dict() 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 2b1c4629b..5cd61aa15 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/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 33ae96595..5cde2b110 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 @@ -10,8 +10,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/octet_stream", 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 cfbe81076..d64cae452 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 @@ -12,8 +12,6 @@ def _get_kwargs( form_data: AFormData, ) -> Dict[str, Any]: - pass - return { "method": "post", "url": "/tests/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 919beee20..2fde59a15 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 @@ -12,8 +12,6 @@ def _get_kwargs( form_data: PostFormDataInlineData, ) -> Dict[str, Any]: - pass - return { "method": "post", "url": "/tests/post_form_data_inline", 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 34f1f413b..c3614b375 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 @@ -13,8 +13,6 @@ def _get_kwargs( *, json_body: str, ) -> Dict[str, Any]: - pass - json_json_body = json_body 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 ed5c24562..36f297c61 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 @@ -14,8 +14,6 @@ def _get_kwargs( *, json_body: TestInlineObjectsJsonBody, ) -> Dict[str, Any]: - pass - json_json_body = json_body.to_dict() return { 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 5ece512cb..b3f5a95e6 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 @@ -9,8 +9,6 @@ def _get_kwargs() -> Dict[str, Any]: - pass - return { "method": "get", "url": "/tests/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 7fd92c0a5..60b436985 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 @@ -14,8 +14,6 @@ def _get_kwargs( *, multipart_data: BodyUploadFileTestsUploadPost, ) -> Dict[str, Any]: - pass - multipart_multipart_data = multipart_data.to_multipart() 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 index cb6d51c88..9b62342f2 100644 --- 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 @@ -13,8 +13,6 @@ def _get_kwargs( *, multipart_data: List[File], ) -> Dict[str, Any]: - pass - multipart_multipart_data = [] for multipart_data_item_data in multipart_data: multipart_data_item = multipart_data_item_data.to_tuple() 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 41dc82ff4..586a1ecdd 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 @@ -12,8 +12,6 @@ def _get_kwargs( *, import_: str, ) -> Dict[str, Any]: - pass - params: Dict[str, Any] = {} params["import"] = import_ 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 01f4cd92f..8e0472f1f 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 @@ -21,8 +21,6 @@ class AnArrayWithACircularRefInItemsObjectAdditionalPropertiesAItem: ] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - pass - field_dict: Dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = [] 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 c6074744b..972367053 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 @@ -21,8 +21,6 @@ class AnArrayWithACircularRefInItemsObjectAdditionalPropertiesBItem: ] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - pass - field_dict: Dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = [] 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 206568f8b..4ab44178f 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 @@ -19,8 +19,6 @@ class ModelWithCircularRefInAdditionalPropertiesA: ) def to_dict(self) -> Dict[str, Any]: - pass - field_dict: Dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = prop.to_dict() 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 7efc724c7..d324cbe2b 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 @@ -19,8 +19,6 @@ class ModelWithCircularRefInAdditionalPropertiesB: ) def to_dict(self) -> Dict[str, Any]: - pass - field_dict: Dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = prop.to_dict() diff --git a/end_to_end_tests/golden-record/pyproject.toml b/end_to_end_tests/golden-record/pyproject.toml index 2c7896e31..e9c8fe2c6 100644 --- a/end_to_end_tests/golden-record/pyproject.toml +++ b/end_to_end_tests/golden-record/pyproject.toml @@ -34,6 +34,6 @@ exclude = ''' ) ''' -[tool.isort] -line_length = 120 -profile = "black" +[tool.ruff] +select = ["F", "I"] +line-length = 120 diff --git a/end_to_end_tests/test_end_to_end.py b/end_to_end_tests/test_end_to_end.py index 6ad49fcb9..3b76c9b5c 100644 --- a/end_to_end_tests/test_end_to_end.py +++ b/end_to_end_tests/test_end_to_end.py @@ -1,8 +1,7 @@ -import os import shutil from filecmp import cmpfiles, dircmp from pathlib import Path -from typing import Dict, List, Optional +from typing import Dict, List import pytest from typer.testing import CliRunner 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 cdeb2014b..19d2b7d11 100644 --- a/integration-tests/integration_tests/api/body/post_body_multipart.py +++ b/integration-tests/integration_tests/api/body/post_body_multipart.py @@ -15,8 +15,6 @@ def _get_kwargs( *, multipart_data: PostBodyMultipartMultipartData, ) -> Dict[str, Any]: - pass - multipart_multipart_data = multipart_data.to_multipart() return { diff --git a/integration-tests/pyproject.toml b/integration-tests/pyproject.toml index 8079f4692..062d8771f 100644 --- a/integration-tests/pyproject.toml +++ b/integration-tests/pyproject.toml @@ -39,6 +39,6 @@ exclude = ''' ) ''' -[tool.isort] -line_length = 120 -profile = "black" \ No newline at end of file +[tool.ruff] +select = ["F", "I"] +line-length = 120 diff --git a/openapi_python_client/__init__.py b/openapi_python_client/__init__.py index 975813bf4..e380b9b32 100644 --- a/openapi_python_client/__init__.py +++ b/openapi_python_client/__init__.py @@ -40,7 +40,7 @@ class MetaType(str, Enum): } -class Project: # pylint: disable=too-many-instance-attributes +class Project: """Represents a Python project (the top level file-tree) to generate""" def __init__( @@ -151,7 +151,7 @@ def _run_command(self, cmd: str) -> None: return try: cwd = self.package_dir if self.meta == MetaType.NONE else self.project_dir - subprocess.run(cmd, cwd=cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) + subprocess.run(cmd, cwd=cwd, shell=True, capture_output=True, check=True) except CalledProcessError as err: self.errors.append( GeneratorError( @@ -253,7 +253,6 @@ def _build_models(self) -> None: models_init_template = self.env.get_template("models_init.py.jinja") models_init.write_text(models_init_template.render(imports=imports, alls=alls), encoding=self.file_encoding) - # pylint: disable=too-many-locals def _build_api(self) -> None: # Generate Client client_path = self.package_dir / "client.py" @@ -297,7 +296,7 @@ def _build_api(self) -> None: ) -def _get_project_for_url_or_path( # pylint: disable=too-many-arguments +def _get_project_for_url_or_path( url: Optional[str], path: Optional[Path], meta: MetaType, diff --git a/openapi_python_client/cli.py b/openapi_python_client/cli.py index 7c18c6be8..92d3ae3df 100644 --- a/openapi_python_client/cli.py +++ b/openapi_python_client/cli.py @@ -31,7 +31,8 @@ def _process_config(path: Optional[pathlib.Path]) -> Config: # noinspection PyUnusedLocal -# pylint: disable=unused-argument + + @app.callback(name="openapi-python-client") def cli( version: bool = typer.Option(False, "--version", callback=_version_callback, help="Print the version and exit"), @@ -110,7 +111,6 @@ def handle_errors(errors: Sequence[GeneratorError], fail_on_warning: bool = Fals CONFIG_OPTION = typer.Option(None, "--config", help="Path to the config file to use") -# pylint: disable=too-many-arguments @app.command() def generate( url: Optional[str] = typer.Option(None, help="A URL to read the JSON from"), @@ -149,7 +149,6 @@ def generate( handle_errors(errors, fail_on_warning) -# pylint: disable=too-many-arguments @app.command() def update( url: Optional[str] = typer.Option(None, help="A URL to read the JSON from"), diff --git a/openapi_python_client/config.py b/openapi_python_client/config.py index 9f3084d9c..62f60aaa9 100644 --- a/openapi_python_client/config.py +++ b/openapi_python_client/config.py @@ -29,8 +29,7 @@ class Config(BaseModel): package_version_override: Optional[str] = None use_path_prefixes_for_title_model_names: bool = True post_hooks: List[str] = [ - "autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .", - "isort .", + "ruff check --fix .", "black .", ] field_prefix: str = "field_" diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index 96fac02fd..dc6e9f47b 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -103,7 +103,6 @@ def generate_operation_id(*, path: str, method: str) -> str: models_relative_prefix: str = "..." -# pylint: disable=too-many-instance-attributes @dataclass class Endpoint: """ @@ -179,7 +178,7 @@ def parse_request_json_body( """Return json_body""" json_body = None for content_type, schema in body.content.items(): - content_type = get_content_type(content_type) + content_type = get_content_type(content_type) # noqa: PLW2901 if content_type == "application/json" or content_type.endswith("+json"): json_body = schema @@ -307,9 +306,8 @@ def _add_responses( endpoint.responses.append(response) return endpoint, schemas - # pylint: disable=too-many-return-statements @staticmethod - def add_parameters( + def add_parameters( # noqa: PLR0911, PLR0912 *, endpoint: "Endpoint", data: Union[oai.Operation, oai.PathItem], @@ -338,7 +336,6 @@ def add_parameters( - https://swagger.io/docs/specification/describing-parameters/ - https://swagger.io/docs/specification/paths-and-operations/ """ - # pylint: disable=too-many-branches, too-many-locals # There isn't much value in breaking down this function further other than to satisfy the linter. if data.parameters is None: @@ -363,7 +360,7 @@ def add_parameters( param_or_error = parameter_from_reference(param=param, parameters=parameters) if isinstance(param_or_error, ParseError): return param_or_error, schemas, parameters - param = param_or_error + param = param_or_error # noqa: PLW2901 if param.param_schema is None: continue diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 981b586b6..f434bca61 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -16,9 +16,8 @@ from attrs import define, evolve -from ... import Config +from ... import Config, utils from ... import schema as oai -from ... import utils from ..errors import ParameterError, ParseError, PropertyError, ValidationError from .converter import convert, convert_chain from .enum_property import EnumProperty @@ -188,7 +187,6 @@ class ListProperty(Property, Generic[InnerProp]): inner_property: InnerProp template: ClassVar[str] = "list_property.py.jinja" - # pylint: disable=unused-argument 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)}]" @@ -236,7 +234,6 @@ def _get_type_string_from_inner_type_strings(inner_types: Set[str]) -> str: return inner_types.pop() return f"Union[{', '.join(sorted(inner_types))}]" - # pylint: disable=unused-argument 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)) @@ -570,7 +567,6 @@ def build_list_property( ) -# pylint: disable=too-many-arguments def _property_from_ref( name: str, required: bool, @@ -605,8 +601,7 @@ def _property_from_ref( return prop, schemas -# pylint: disable=too-many-arguments,too-many-return-statements -def _property_from_data( +def _property_from_data( # noqa: PLR0911 name: str, required: bool, data: Union[oai.Reference, oai.Schema], diff --git a/openapi_python_client/parser/properties/enum_property.py b/openapi_python_client/parser/properties/enum_property.py index df7c4d822..9ba858e50 100644 --- a/openapi_python_client/parser/properties/enum_property.py +++ b/openapi_python_client/parser/properties/enum_property.py @@ -30,7 +30,6 @@ class EnumProperty(Property): oai.ParameterLocation.HEADER, } - # pylint: disable=unused-argument def get_base_type_string(self, *, quoted: bool = False) -> str: return self.class_info.name diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index 81284e15a..28fb00b29 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -1,13 +1,12 @@ from __future__ import annotations from itertools import chain -from typing import ClassVar, Dict, List, NamedTuple, Optional, Set, Tuple, Union +from typing import ClassVar, NamedTuple from attrs import define, evolve -from ... import Config +from ... import Config, utils from ... import schema as oai -from ... import utils from ..errors import ParseError, PropertyError from .enum_property import EnumProperty from .property import Property @@ -21,12 +20,12 @@ class ModelProperty(Property): class_info: Class data: oai.Schema description: str - roots: Set[Union[ReferencePath, utils.ClassName]] - required_properties: Optional[List[Property]] - optional_properties: Optional[List[Property]] - relative_imports: Optional[Set[str]] - lazy_imports: Optional[Set[str]] - additional_properties: Optional[Union[bool, Property]] + roots: set[ReferencePath | utils.ClassName] + required_properties: list[Property] | None + optional_properties: list[Property] | None + relative_imports: set[str] | None + lazy_imports: set[str] | None + additional_properties: bool | Property | None _json_type_string: ClassVar[str] = "Dict[str, Any]" template: ClassVar[str] = "model_property.py.jinja" @@ -45,7 +44,7 @@ def self_import(self) -> str: 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_imports(self, *, prefix: str) -> Set[str]: + def get_imports(self, *, prefix: str) -> set[str]: """ Get a set of import strings that should be included when this property is used somewhere @@ -62,7 +61,7 @@ def get_imports(self, *, prefix: str) -> Set[str]: ) return imports - def get_lazy_imports(self, *, prefix: str) -> Set[str]: + def get_lazy_imports(self, *, prefix: str) -> set[str]: """Get a set of lazy import strings that should be included when this property is used somewhere Args: @@ -71,7 +70,7 @@ def get_lazy_imports(self, *, prefix: str) -> Set[str]: """ return {f"from {prefix}{self.self_import}"} - def set_relative_imports(self, relative_imports: Set[str]) -> None: + def set_relative_imports(self, relative_imports: set[str]) -> None: """Set the relative imports set for this ModelProperty, filtering out self imports Args: @@ -79,7 +78,7 @@ def set_relative_imports(self, relative_imports: Set[str]) -> None: """ object.__setattr__(self, "relative_imports", {ri for ri in relative_imports if self.self_import not in ri}) - def set_lazy_imports(self, lazy_imports: Set[str]) -> None: + def set_lazy_imports(self, lazy_imports: set[str]) -> None: """Set the lazy imports set for this ModelProperty, filtering out self imports Args: @@ -134,24 +133,24 @@ def _types_are_subset(first: EnumProperty, second: Property) -> bool: return False -def _enum_subset(first: Property, second: Property) -> Optional[EnumProperty]: +def _enum_subset(first: Property, second: Property) -> EnumProperty | None: """Return the EnumProperty that is the subset of the other, if possible.""" if isinstance(first, EnumProperty): if isinstance(second, EnumProperty): if _values_are_subset(first, second): return first - if _values_are_subset(second, first): # pylint: disable=arguments-out-of-order + if _values_are_subset(second, first): return second return None return first if _types_are_subset(first, second) else None - # pylint: disable=arguments-out-of-order + if isinstance(second, EnumProperty) and _types_are_subset(second, first): return second return None -def _merge_properties(first: Property, second: Property) -> Union[Property, PropertyError]: +def _merge_properties(first: Property, second: Property) -> Property | PropertyError: nullable = first.nullable and second.nullable required = first.required or second.required @@ -175,30 +174,29 @@ def _merge_properties(first: Property, second: Property) -> Union[Property, Prop class _PropertyData(NamedTuple): - optional_props: List[Property] - required_props: List[Property] - relative_imports: Set[str] - lazy_imports: Set[str] + optional_props: list[Property] + required_props: list[Property] + relative_imports: set[str] + lazy_imports: set[str] schemas: Schemas -# pylint: disable=too-many-locals,too-many-branches,too-many-return-statements -def _process_properties( +def _process_properties( # noqa: PLR0912, PLR0911 *, data: oai.Schema, schemas: Schemas, class_name: utils.ClassName, config: Config, - roots: Set[Union[ReferencePath, utils.ClassName]], -) -> Union[_PropertyData, PropertyError]: + roots: set[ReferencePath | utils.ClassName], +) -> _PropertyData | PropertyError: from . import property_from_data - properties: Dict[str, Property] = {} - relative_imports: Set[str] = set() - lazy_imports: Set[str] = set() + properties: dict[str, Property] = {} + relative_imports: set[str] = set() + lazy_imports: set[str] = set() required_set = set(data.required or []) - def _add_if_no_conflict(new_prop: Property) -> Optional[PropertyError]: + def _add_if_no_conflict(new_prop: Property) -> PropertyError | None: nonlocal properties existing = properties.get(new_prop.name) @@ -238,7 +236,7 @@ def _add_if_no_conflict(new_prop: Property) -> Optional[PropertyError]: for key, value in unprocessed_props.items(): prop_required = key in required_set - prop_or_error: Union[Property, PropertyError, None] + prop_or_error: Property | (PropertyError | None) prop_or_error, schemas = property_from_data( name=key, required=prop_required, @@ -275,12 +273,12 @@ def _add_if_no_conflict(new_prop: Property) -> Optional[PropertyError]: def _get_additional_properties( *, - schema_additional: Union[None, bool, oai.Reference, oai.Schema], + schema_additional: None | (bool | (oai.Reference | oai.Schema)), schemas: Schemas, class_name: utils.ClassName, config: Config, - roots: Set[Union[ReferencePath, utils.ClassName]], -) -> Tuple[Union[bool, Property, PropertyError], Schemas]: + roots: set[ReferencePath | utils.ClassName], +) -> tuple[bool | (Property | PropertyError), Schemas]: from . import property_from_data if schema_additional is None: @@ -311,8 +309,8 @@ def _process_property_data( schemas: Schemas, class_info: Class, config: Config, - roots: Set[Union[ReferencePath, utils.ClassName]], -) -> Tuple[Union[Tuple[_PropertyData, Union[bool, Property]], PropertyError], Schemas]: + roots: set[ReferencePath | utils.ClassName], +) -> tuple[tuple[_PropertyData, bool | Property] | PropertyError, Schemas]: property_data = _process_properties( data=data, schemas=schemas, class_name=class_info.name, config=config, roots=roots ) @@ -336,7 +334,7 @@ def _process_property_data( return (property_data, additional_properties), schemas -def process_model(model_prop: ModelProperty, *, schemas: Schemas, config: Config) -> Union[Schemas, PropertyError]: +def process_model(model_prop: ModelProperty, *, schemas: Schemas, config: Config) -> Schemas | PropertyError: """Populate a ModelProperty instance's property data Args: model_prop: The ModelProperty to build property data for @@ -365,18 +363,17 @@ def process_model(model_prop: ModelProperty, *, schemas: Schemas, config: Config return schemas -# pylint: disable=too-many-locals def build_model_property( *, data: oai.Schema, name: str, schemas: Schemas, required: bool, - parent_name: Optional[str], + parent_name: str | None, config: Config, process_properties: bool, - roots: Set[Union[ReferencePath, utils.ClassName]], -) -> Tuple[Union[ModelProperty, PropertyError], Schemas]: + roots: set[ReferencePath | utils.ClassName], +) -> tuple[ModelProperty | PropertyError, Schemas]: """ A single ModelProperty from its OAI data @@ -401,11 +398,11 @@ def build_model_property( class_string = title class_info = Class.from_string(string=class_string, config=config) model_roots = {*roots, class_info.name} - required_properties: Optional[List[Property]] = None - optional_properties: Optional[List[Property]] = None - relative_imports: Optional[Set[str]] = None - lazy_imports: Optional[Set[str]] = None - additional_properties: Optional[Union[bool, Property]] = None + required_properties: list[Property] | None = None + optional_properties: list[Property] | None = None + relative_imports: set[str] | None = None + lazy_imports: set[str] | None = None + additional_properties: bool | Property | None = None if process_properties: data_or_err, schemas = _process_property_data( data=data, schemas=schemas, class_info=class_info, config=config, roots=model_roots diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index a7e4c1ae7..d00826b73 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: # pragma: no cover from .model_property import ModelProperty else: - ModelProperty = "ModelProperty" # pylint: disable=invalid-name + ModelProperty = "ModelProperty" @define @@ -122,7 +122,6 @@ def get_imports(self, *, prefix: str) -> Set[str]: imports.add(f"from {prefix}types import UNSET, Unset") return imports - # pylint: disable=unused-argument def get_lazy_imports(self, *, prefix: str) -> Set[str]: """Get a set of lazy import strings that should be included when this property is used somewhere diff --git a/openapi_python_client/parser/properties/schemas.py b/openapi_python_client/parser/properties/schemas.py index 9a774b6d7..046c0ca48 100644 --- a/openapi_python_client/parser/properties/schemas.py +++ b/openapi_python_client/parser/properties/schemas.py @@ -23,7 +23,7 @@ if TYPE_CHECKING: # pragma: no cover from .property import Property else: - Property = "Property" # pylint: disable=invalid-name + Property = "Property" ReferencePath = NewType("ReferencePath", str) diff --git a/openapi_python_client/schema/openapi_schema_pydantic/callback.py b/openapi_python_client/schema/openapi_schema_pydantic/callback.py index 7535cdab8..22426d925 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/callback.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/callback.py @@ -3,7 +3,7 @@ if TYPE_CHECKING: # pragma: no cover from .path_item import PathItem else: - PathItem = "PathItem" # pylint: disable=invalid-name + PathItem = "PathItem" Callback = Dict[str, PathItem] """ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py index 6f4f2a9f6..b7434c50c 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py @@ -7,7 +7,7 @@ if TYPE_CHECKING: # pragma: no cover from .header import Header else: - Header = "Header" # pylint: disable=invalid-name + Header = "Header" class Encoding(BaseModel): 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 ba54ec095..822c42626 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py @@ -1,4 +1,3 @@ -# pylint: disable=W0611 from typing import List, Literal, Optional, Union from pydantic import BaseModel, ConfigDict @@ -8,7 +7,7 @@ from .info import Info # Required to update forward ref after object creation -from .path_item import PathItem +from .path_item import PathItem # noqa: F401 from .paths import Paths from .security_requirement import SecurityRequirement from .server import Server diff --git a/openapi_python_client/schema/openapi_schema_pydantic/operation.py b/openapi_python_client/schema/openapi_schema_pydantic/operation.py index f8633da02..7dd7f8f15 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/operation.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/operation.py @@ -4,11 +4,11 @@ from .callback import Callback from .external_documentation import ExternalDocumentation -from .header import Header # pylint: disable=unused-import +from .header import Header # noqa: F401 from .parameter import Parameter # Required to update forward ref after object creation, as this is not imported yet -from .path_item import PathItem # pylint: disable=unused-import +from .path_item import PathItem # noqa: F401 from .reference import Reference from .request_body import RequestBody from .responses import Responses 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 58c1eda82..36edee0e3 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py @@ -72,6 +72,6 @@ class PathItem(BaseModel): # Operation uses PathItem via Callback, so we need late import and to update forward refs due to circular dependency -from .operation import Operation # pylint: disable=wrong-import-position unused-import +from .operation import Operation # noqa: E402 PathItem.model_rebuild() diff --git a/openapi_python_client/templates/pyproject_no_poetry.toml.jinja b/openapi_python_client/templates/pyproject_no_poetry.toml.jinja index ee959227d..26dc328d8 100644 --- a/openapi_python_client/templates/pyproject_no_poetry.toml.jinja +++ b/openapi_python_client/templates/pyproject_no_poetry.toml.jinja @@ -11,6 +11,6 @@ exclude = ''' ) ''' -[tool.isort] -line_length = 120 -profile = "black" +[tool.ruff] +select = ["F", "I"] +line-length = 120 diff --git a/poetry.lock b/poetry.lock index abaabe6c7..f98a4e5ac 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "annotated-types" @@ -35,25 +35,6 @@ doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)"] test = ["anyio[trio]", "coverage[toml] (>=7)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] trio = ["trio (>=0.22)"] -[[package]] -name = "astroid" -version = "2.15.8" -description = "An abstract syntax tree for Python with inference support." -optional = false -python-versions = ">=3.7.2" -files = [ - {file = "astroid-2.15.8-py3-none-any.whl", hash = "sha256:1aa149fc5c6589e3d0ece885b4491acd80af4f087baafa3fb5203b113e68cd3c"}, - {file = "astroid-2.15.8.tar.gz", hash = "sha256:6c107453dffee9055899705de3c9ead36e74119cee151e5a9aaf7f0b0e020a6a"}, -] - -[package.dependencies] -lazy-object-proxy = ">=1.4.0" -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} -wrapt = [ - {version = ">=1.11,<2", markers = "python_version < \"3.11\""}, - {version = ">=1.14,<2", markers = "python_version >= \"3.11\""}, -] - [[package]] name = "attrs" version = "23.1.0" @@ -72,21 +53,6 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -[[package]] -name = "autoflake" -version = "2.2.1" -description = "Removes unused imports and unused variables" -optional = false -python-versions = ">=3.8" -files = [ - {file = "autoflake-2.2.1-py3-none-any.whl", hash = "sha256:265cde0a43c1f44ecfb4f30d95b0437796759d07be7706a2f70e4719234c0f79"}, - {file = "autoflake-2.2.1.tar.gz", hash = "sha256:62b7b6449a692c3c9b0c916919bbc21648da7281e8506bcf8d3f8280e431ebc1"}, -] - -[package.dependencies] -pyflakes = ">=3.0.0" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} - [[package]] name = "black" version = "23.9.1" @@ -335,20 +301,6 @@ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.1 [package.extras] toml = ["tomli"] -[[package]] -name = "dill" -version = "0.3.7" -description = "serialize all of Python" -optional = false -python-versions = ">=3.7" -files = [ - {file = "dill-0.3.7-py3-none-any.whl", hash = "sha256:76b122c08ef4ce2eedcd4d1abd8e641114bfc6c2867f49f3c41facf65bf19f5e"}, - {file = "dill-0.3.7.tar.gz", hash = "sha256:cc1c8b182eb3013e24bd475ff2e9295af86c1a38eb1aff128dac8962a9ce3c03"}, -] - -[package.extras] -graph = ["objgraph (>=1.7.2)"] - [[package]] name = "dparse" version = "0.6.3" @@ -459,23 +411,6 @@ files = [ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] -[[package]] -name = "isort" -version = "5.12.0" -description = "A Python utility / library to sort Python imports." -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, -] - -[package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] - [[package]] name = "jinja2" version = "3.1.2" @@ -493,51 +428,6 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] -[[package]] -name = "lazy-object-proxy" -version = "1.9.0" -description = "A fast and thorough lazy object proxy." -optional = false -python-versions = ">=3.7" -files = [ - {file = "lazy-object-proxy-1.9.0.tar.gz", hash = "sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win32.whl", hash = "sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win32.whl", hash = "sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win32.whl", hash = "sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win_amd64.whl", hash = "sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win32.whl", hash = "sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win_amd64.whl", hash = "sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win32.whl", hash = "sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f"}, -] - [[package]] name = "markupsafe" version = "2.1.3" @@ -565,16 +455,6 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -607,17 +487,6 @@ files = [ {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] -[[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" -optional = false -python-versions = ">=3.6" -files = [ - {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, - {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, -] - [[package]] name = "mslex" version = "0.3.0" @@ -901,46 +770,6 @@ files = [ [package.dependencies] typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" -[[package]] -name = "pyflakes" -version = "3.1.0" -description = "passive checker of Python programs" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pyflakes-3.1.0-py2.py3-none-any.whl", hash = "sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774"}, - {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, -] - -[[package]] -name = "pylint" -version = "2.17.7" -description = "python code static checker" -optional = false -python-versions = ">=3.7.2" -files = [ - {file = "pylint-2.17.7-py3-none-any.whl", hash = "sha256:27a8d4c7ddc8c2f8c18aa0050148f89ffc09838142193fdbe98f172781a3ff87"}, - {file = "pylint-2.17.7.tar.gz", hash = "sha256:f4fcac7ae74cfe36bc8451e931d8438e4a476c20314b1101c458ad0f05191fad"}, -] - -[package.dependencies] -astroid = ">=2.15.8,<=2.17.0-dev0" -colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -dill = [ - {version = ">=0.2", markers = "python_version < \"3.11\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\""}, -] -isort = ">=4.2.5,<6" -mccabe = ">=0.6,<0.8" -platformdirs = ">=2.2.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -tomlkit = ">=0.10.1" -typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""} - -[package.extras] -spelling = ["pyenchant (>=3.2,<4.0)"] -testutils = ["gitpython (>3)"] - [[package]] name = "pytest" version = "7.4.2" @@ -1038,7 +867,6 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, - {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -1046,15 +874,8 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, - {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, - {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, - {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, - {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -1071,7 +892,6 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, - {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -1079,7 +899,6 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -1170,6 +989,32 @@ files = [ {file = "ruamel.yaml.clib-0.2.7.tar.gz", hash = "sha256:1f08fd5a2bea9c4180db71678e850b995d2a5f4537be0e94557668cf0f5f9497"}, ] +[[package]] +name = "ruff" +version = "0.0.292" +description = "An extremely fast Python linter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.0.292-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:02f29db018c9d474270c704e6c6b13b18ed0ecac82761e4fcf0faa3728430c96"}, + {file = "ruff-0.0.292-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:69654e564342f507edfa09ee6897883ca76e331d4bbc3676d8a8403838e9fade"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c3c91859a9b845c33778f11902e7b26440d64b9d5110edd4e4fa1726c41e0a4"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f4476f1243af2d8c29da5f235c13dca52177117935e1f9393f9d90f9833f69e4"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be8eb50eaf8648070b8e58ece8e69c9322d34afe367eec4210fdee9a555e4ca7"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9889bac18a0c07018aac75ef6c1e6511d8411724d67cb879103b01758e110a81"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bdfabd4334684a4418b99b3118793f2c13bb67bf1540a769d7816410402a205"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aa7c77c53bfcd75dbcd4d1f42d6cabf2485d2e1ee0678da850f08e1ab13081a8"}, + {file = "ruff-0.0.292-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e087b24d0d849c5c81516ec740bf4fd48bf363cfb104545464e0fca749b6af9"}, + {file = "ruff-0.0.292-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f160b5ec26be32362d0774964e218f3fcf0a7da299f7e220ef45ae9e3e67101a"}, + {file = "ruff-0.0.292-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ac153eee6dd4444501c4bb92bff866491d4bfb01ce26dd2fff7ca472c8df9ad0"}, + {file = "ruff-0.0.292-py3-none-musllinux_1_2_i686.whl", hash = "sha256:87616771e72820800b8faea82edd858324b29bb99a920d6aa3d3949dd3f88fb0"}, + {file = "ruff-0.0.292-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b76deb3bdbea2ef97db286cf953488745dd6424c122d275f05836c53f62d4016"}, + {file = "ruff-0.0.292-py3-none-win32.whl", hash = "sha256:e854b05408f7a8033a027e4b1c7f9889563dd2aca545d13d06711e5c39c3d003"}, + {file = "ruff-0.0.292-py3-none-win_amd64.whl", hash = "sha256:f27282bedfd04d4c3492e5c3398360c9d86a295be00eccc63914438b4ac8a83c"}, + {file = "ruff-0.0.292-py3-none-win_arm64.whl", hash = "sha256:7f67a69c8f12fbc8daf6ae6d36705037bde315abf8b82b6e1f4c9e74eb750f68"}, + {file = "ruff-0.0.292.tar.gz", hash = "sha256:1093449e37dd1e9b813798f6ad70932b57cf614e5c2b5c51005bf67d55db33ac"}, +] + [[package]] name = "safety" version = "2.3.4" @@ -1270,17 +1115,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tomlkit" -version = "0.12.1" -description = "Style preserving TOML library" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomlkit-0.12.1-py3-none-any.whl", hash = "sha256:712cbd236609acc6a3e2e97253dfc52d4c2082982a88f61b640ecf0817eab899"}, - {file = "tomlkit-0.12.1.tar.gz", hash = "sha256:38e1ff8edb991273ec9f6181244a6a391ac30e9f5098e7535640ea6be97a7c86"}, -] - [[package]] name = "typer" version = "0.9.0" @@ -1363,91 +1197,7 @@ secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17. socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] -[[package]] -name = "wrapt" -version = "1.15.0" -description = "Module for decorators, wrappers and monkey patching." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -files = [ - {file = "wrapt-1.15.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ca1cccf838cd28d5a0883b342474c630ac48cac5df0ee6eacc9c7290f76b11c1"}, - {file = "wrapt-1.15.0-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e826aadda3cae59295b95343db8f3d965fb31059da7de01ee8d1c40a60398b29"}, - {file = "wrapt-1.15.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5fc8e02f5984a55d2c653f5fea93531e9836abbd84342c1d1e17abc4a15084c2"}, - {file = "wrapt-1.15.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:96e25c8603a155559231c19c0349245eeb4ac0096fe3c1d0be5c47e075bd4f46"}, - {file = "wrapt-1.15.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:40737a081d7497efea35ab9304b829b857f21558acfc7b3272f908d33b0d9d4c"}, - {file = "wrapt-1.15.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:f87ec75864c37c4c6cb908d282e1969e79763e0d9becdfe9fe5473b7bb1e5f09"}, - {file = "wrapt-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:1286eb30261894e4c70d124d44b7fd07825340869945c79d05bda53a40caa079"}, - {file = "wrapt-1.15.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:493d389a2b63c88ad56cdc35d0fa5752daac56ca755805b1b0c530f785767d5e"}, - {file = "wrapt-1.15.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:58d7a75d731e8c63614222bcb21dd992b4ab01a399f1f09dd82af17bbfc2368a"}, - {file = "wrapt-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:21f6d9a0d5b3a207cdf7acf8e58d7d13d463e639f0c7e01d82cdb671e6cb7923"}, - {file = "wrapt-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ce42618f67741d4697684e501ef02f29e758a123aa2d669e2d964ff734ee00ee"}, - {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41d07d029dd4157ae27beab04d22b8e261eddfc6ecd64ff7000b10dc8b3a5727"}, - {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54accd4b8bc202966bafafd16e69da9d5640ff92389d33d28555c5fd4f25ccb7"}, - {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fbfbca668dd15b744418265a9607baa970c347eefd0db6a518aaf0cfbd153c0"}, - {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:76e9c727a874b4856d11a32fb0b389afc61ce8aaf281ada613713ddeadd1cfec"}, - {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e20076a211cd6f9b44a6be58f7eeafa7ab5720eb796975d0c03f05b47d89eb90"}, - {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a74d56552ddbde46c246b5b89199cb3fd182f9c346c784e1a93e4dc3f5ec9975"}, - {file = "wrapt-1.15.0-cp310-cp310-win32.whl", hash = "sha256:26458da5653aa5b3d8dc8b24192f574a58984c749401f98fff994d41d3f08da1"}, - {file = "wrapt-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:75760a47c06b5974aa5e01949bf7e66d2af4d08cb8c1d6516af5e39595397f5e"}, - {file = "wrapt-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ba1711cda2d30634a7e452fc79eabcadaffedf241ff206db2ee93dd2c89a60e7"}, - {file = "wrapt-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:56374914b132c702aa9aa9959c550004b8847148f95e1b824772d453ac204a72"}, - {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a89ce3fd220ff144bd9d54da333ec0de0399b52c9ac3d2ce34b569cf1a5748fb"}, - {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bbe623731d03b186b3d6b0d6f51865bf598587c38d6f7b0be2e27414f7f214e"}, - {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3abbe948c3cbde2689370a262a8d04e32ec2dd4f27103669a45c6929bcdbfe7c"}, - {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b67b819628e3b748fd3c2192c15fb951f549d0f47c0449af0764d7647302fda3"}, - {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:7eebcdbe3677e58dd4c0e03b4f2cfa346ed4049687d839adad68cc38bb559c92"}, - {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:74934ebd71950e3db69960a7da29204f89624dde411afbfb3b4858c1409b1e98"}, - {file = "wrapt-1.15.0-cp311-cp311-win32.whl", hash = "sha256:bd84395aab8e4d36263cd1b9308cd504f6cf713b7d6d3ce25ea55670baec5416"}, - {file = "wrapt-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:a487f72a25904e2b4bbc0817ce7a8de94363bd7e79890510174da9d901c38705"}, - {file = "wrapt-1.15.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:4ff0d20f2e670800d3ed2b220d40984162089a6e2c9646fdb09b85e6f9a8fc29"}, - {file = "wrapt-1.15.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:9ed6aa0726b9b60911f4aed8ec5b8dd7bf3491476015819f56473ffaef8959bd"}, - {file = "wrapt-1.15.0-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:896689fddba4f23ef7c718279e42f8834041a21342d95e56922e1c10c0cc7afb"}, - {file = "wrapt-1.15.0-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:75669d77bb2c071333417617a235324a1618dba66f82a750362eccbe5b61d248"}, - {file = "wrapt-1.15.0-cp35-cp35m-win32.whl", hash = "sha256:fbec11614dba0424ca72f4e8ba3c420dba07b4a7c206c8c8e4e73f2e98f4c559"}, - {file = "wrapt-1.15.0-cp35-cp35m-win_amd64.whl", hash = "sha256:fd69666217b62fa5d7c6aa88e507493a34dec4fa20c5bd925e4bc12fce586639"}, - {file = "wrapt-1.15.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:b0724f05c396b0a4c36a3226c31648385deb6a65d8992644c12a4963c70326ba"}, - {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bbeccb1aa40ab88cd29e6c7d8585582c99548f55f9b2581dfc5ba68c59a85752"}, - {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:38adf7198f8f154502883242f9fe7333ab05a5b02de7d83aa2d88ea621f13364"}, - {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:578383d740457fa790fdf85e6d346fda1416a40549fe8db08e5e9bd281c6a475"}, - {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:a4cbb9ff5795cd66f0066bdf5947f170f5d63a9274f99bdbca02fd973adcf2a8"}, - {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:af5bd9ccb188f6a5fdda9f1f09d9f4c86cc8a539bd48a0bfdc97723970348418"}, - {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:b56d5519e470d3f2fe4aa7585f0632b060d532d0696c5bdfb5e8319e1d0f69a2"}, - {file = "wrapt-1.15.0-cp36-cp36m-win32.whl", hash = "sha256:77d4c1b881076c3ba173484dfa53d3582c1c8ff1f914c6461ab70c8428b796c1"}, - {file = "wrapt-1.15.0-cp36-cp36m-win_amd64.whl", hash = "sha256:077ff0d1f9d9e4ce6476c1a924a3332452c1406e59d90a2cf24aeb29eeac9420"}, - {file = "wrapt-1.15.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5c5aa28df055697d7c37d2099a7bc09f559d5053c3349b1ad0c39000e611d317"}, - {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a8564f283394634a7a7054b7983e47dbf39c07712d7b177b37e03f2467a024e"}, - {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780c82a41dc493b62fc5884fb1d3a3b81106642c5c5c78d6a0d4cbe96d62ba7e"}, - {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e169e957c33576f47e21864cf3fc9ff47c223a4ebca8960079b8bd36cb014fd0"}, - {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b02f21c1e2074943312d03d243ac4388319f2456576b2c6023041c4d57cd7019"}, - {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f2e69b3ed24544b0d3dbe2c5c0ba5153ce50dcebb576fdc4696d52aa22db6034"}, - {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d787272ed958a05b2c86311d3a4135d3c2aeea4fc655705f074130aa57d71653"}, - {file = "wrapt-1.15.0-cp37-cp37m-win32.whl", hash = "sha256:02fce1852f755f44f95af51f69d22e45080102e9d00258053b79367d07af39c0"}, - {file = "wrapt-1.15.0-cp37-cp37m-win_amd64.whl", hash = "sha256:abd52a09d03adf9c763d706df707c343293d5d106aea53483e0ec8d9e310ad5e"}, - {file = "wrapt-1.15.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cdb4f085756c96a3af04e6eca7f08b1345e94b53af8921b25c72f096e704e145"}, - {file = "wrapt-1.15.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:230ae493696a371f1dbffaad3dafbb742a4d27a0afd2b1aecebe52b740167e7f"}, - {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63424c681923b9f3bfbc5e3205aafe790904053d42ddcc08542181a30a7a51bd"}, - {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d6bcbfc99f55655c3d93feb7ef3800bd5bbe963a755687cbf1f490a71fb7794b"}, - {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c99f4309f5145b93eca6e35ac1a988f0dc0a7ccf9ccdcd78d3c0adf57224e62f"}, - {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b130fe77361d6771ecf5a219d8e0817d61b236b7d8b37cc045172e574ed219e6"}, - {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:96177eb5645b1c6985f5c11d03fc2dbda9ad24ec0f3a46dcce91445747e15094"}, - {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5fe3e099cf07d0fb5a1e23d399e5d4d1ca3e6dfcbe5c8570ccff3e9208274f7"}, - {file = "wrapt-1.15.0-cp38-cp38-win32.whl", hash = "sha256:abd8f36c99512755b8456047b7be10372fca271bf1467a1caa88db991e7c421b"}, - {file = "wrapt-1.15.0-cp38-cp38-win_amd64.whl", hash = "sha256:b06fa97478a5f478fb05e1980980a7cdf2712015493b44d0c87606c1513ed5b1"}, - {file = "wrapt-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2e51de54d4fb8fb50d6ee8327f9828306a959ae394d3e01a1ba8b2f937747d86"}, - {file = "wrapt-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0970ddb69bba00670e58955f8019bec4a42d1785db3faa043c33d81de2bf843c"}, - {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76407ab327158c510f44ded207e2f76b657303e17cb7a572ffe2f5a8a48aa04d"}, - {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cd525e0e52a5ff16653a3fc9e3dd827981917d34996600bbc34c05d048ca35cc"}, - {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d37ac69edc5614b90516807de32d08cb8e7b12260a285ee330955604ed9dd29"}, - {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:078e2a1a86544e644a68422f881c48b84fef6d18f8c7a957ffd3f2e0a74a0d4a"}, - {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:2cf56d0e237280baed46f0b5316661da892565ff58309d4d2ed7dba763d984b8"}, - {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:7dc0713bf81287a00516ef43137273b23ee414fe41a3c14be10dd95ed98a2df9"}, - {file = "wrapt-1.15.0-cp39-cp39-win32.whl", hash = "sha256:46ed616d5fb42f98630ed70c3529541408166c22cdfd4540b88d5f21006b0eff"}, - {file = "wrapt-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:eef4d64c650f33347c1f9266fa5ae001440b232ad9b98f1f43dfe7a79435c0a6"}, - {file = "wrapt-1.15.0-py3-none-any.whl", hash = "sha256:64b1df0f83706b4ef4cfb4fb0e4c2669100fd7ecacfb59e091fad300d4e04640"}, - {file = "wrapt-1.15.0.tar.gz", hash = "sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a"}, -] - [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "ee9ba2fcfeff5b870604f742359b92c7b9acd49576962b894732519f074caa46" +content-hash = "e83e054ccd9694375375e97a4ef57f684920681af5b69c6f80b8dfde967241c9" diff --git a/pyproject.toml b/pyproject.toml index 2e6cf09d4..2413ae48a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,13 +25,13 @@ typer = ">0.6, <0.10" colorama = {version = "^0.4.3", markers = "sys_platform == 'win32'"} shellingham = "^1.3.2" black = ">=23" -isort = "^5.0.5" pydantic = "^2.1.1" attrs = ">=21.3.0" python-dateutil = "^2.8.1" httpx = ">=0.20.0,<0.26.0" -autoflake = "^1.4 || ^2.0.0" PyYAML = "^6.0" +ruff = "^0.0.292" +typing-extensions = "^4.8.0" [tool.poetry.scripts] openapi-python-client = "openapi_python_client.cli:app" @@ -47,15 +47,13 @@ python-multipart = "*" types-PyYAML = "^6.0.3" types-certifi = "^2020.0.0" types-python-dateutil = "^2.0.0" -pylint = ">=2.15.5" [tool.taskipy.tasks] check = """ -isort .\ +ruff check --fix . \ && black .\ && poetry export -f requirements.txt | poetry run safety check --bare --stdin\ && mypy openapi_python_client\ - && pylint openapi_python_client\ && TASKIPY=true pytest --cov openapi_python_client tests --cov-report=term-missing --basetemp=tests/tmp\ && rm -r tests/tmp\ """ @@ -92,35 +90,18 @@ exclude = ''' ) ''' -[tool.isort] -line_length = 120 -profile = "black" -skip = [".venv", "tests/test_templates", "integration-tests", "env"] +[tool.ruff] +select = ["E", "F", "I", "UP", "B", "PL", "RUF"] +line-length = 120 +exclude = ["tests/test_templates/test_property_templates/test_date_property/*", "end_to_end_tests/*"] +ignore = ["E501", "PLR0913"] + +[tool.ruff.per-file-ignores] +"openapi_python_client/cli.py" = ["B008"] [tool.coverage.run] omit = ["openapi_python_client/templates/*"] -[tool.pylint.format] -max-line-length = 120 - -[tool.pylint.messages_control] -disable = [ - # DRY < MOIST - "duplicate-code", - # Sometimes necessary to prevent cycles - "import-outside-toplevel", - # Modules are mostly used for organization here, there is no lib API - "missing-module-docstring", - # Organization is important, even when just separating classes - "too-few-public-methods", - # Disable any type-checking, that's what mypy is for - "no-member", - "no-name-in-module", - "import-error", - # False positives - "cyclic-import", -] - [tool.mypy] plugins = ["pydantic.mypy"] disallow_any_generics = true diff --git a/tests/test___init__.py b/tests/test___init__.py index f7e59a96c..0fa243611 100644 --- a/tests/test___init__.py +++ b/tests/test___init__.py @@ -235,7 +235,7 @@ def test__get_document_bad_yaml(self, mocker, tmp_path): def test__get_document_json(self, mocker): class FakeResponse: content = b'{\n\t"foo": "bar"}' - headers = {"content-type": "application/json; encoding=utf8"} + headers = {"content-type": "application/json; encoding=utf8"} # noqa: RUF012 get = mocker.patch("httpx.get", return_value=FakeResponse()) yaml_loads = mocker.patch("yaml.safe_load") @@ -255,7 +255,7 @@ class FakeResponse: def test__get_document_bad_json(self, mocker): class FakeResponse: content = b'{"foo"}' - headers = {"content-type": "application/json; encoding=utf8"} + headers = {"content-type": "application/json; encoding=utf8"} # noqa: RUF012 get = mocker.patch("httpx.get", return_value=FakeResponse()) @@ -625,6 +625,6 @@ def test_custom_templates(mocker): config=Config(), ) assert isinstance(project.env.loader, jinja2.ChoiceLoader) - assert len(project.env.loader.loaders) == 2 + assert len(project.env.loader.loaders) == 2 # noqa: PLR2004 assert isinstance(project.env.loader.loaders[0], jinja2.FileSystemLoader) assert isinstance(project.env.loader.loaders[1], jinja2.PackageLoader) diff --git a/tests/test___main__.py b/tests/test___main__.py index 79ef06e0a..0673c2062 100644 --- a/tests/test___main__.py +++ b/tests/test___main__.py @@ -1,7 +1,6 @@ def test_main(mocker): app = mocker.patch("openapi_python_client.cli.app") - # noinspection PyUnresolvedReferences - from openapi_python_client import __main__ + from openapi_python_client import __main__ # noqa: F401 app.assert_called_once() diff --git a/tests/test_cli.py b/tests/test_cli.py index 1a8752915..d13042e87 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,7 +4,6 @@ import pytest from typer.testing import CliRunner -from openapi_python_client import Config from openapi_python_client.parser.errors import GeneratorError, ParseError runner = CliRunner() @@ -63,7 +62,7 @@ def test_bad_config(mocker, _create_new_client): result = runner.invoke(app, ["generate", f"--config={config_path}", f"--path={path}"]) - assert result.exit_code == 2 + assert result.exit_code == 2 # noqa: PLR2004 assert "Unable to parse config" in result.stdout load_config.assert_called_once_with(path=Path(config_path)) _create_new_client.assert_not_called() @@ -149,12 +148,12 @@ def test_generate_encoding(self, _create_new_client): def test_generate_encoding_errors(self, _create_new_client): path = "cool/path" file_encoding = "error-file-encoding" - from openapi_python_client.cli import MetaType, app + 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 - assert result.output == "Unknown encoding : {}\n".format(file_encoding) + assert result.output == f"Unknown encoding : {file_encoding}\n" def test_generate_handle_errors(self, _create_new_client): _create_new_client.return_value = [GeneratorError(detail="this is a message")] @@ -286,9 +285,9 @@ def test_update_encoding(self, _update_existing_client): def test_update_encoding_errors(self, _update_existing_client): path = "cool/path" file_encoding = "error-file-encoding" - from openapi_python_client.cli import MetaType, app + from openapi_python_client.cli import app result = runner.invoke(app, ["update", f"--path={path}", f"--file-encoding={file_encoding}"]) assert result.exit_code == 1 - assert result.output == "Unknown encoding : {}\n".format(file_encoding) + assert result.output == f"Unknown encoding : {file_encoding}\n" diff --git a/tests/test_parser/test_openapi.py b/tests/test_parser/test_openapi.py index 79fe33567..4a8594f73 100644 --- a/tests/test_parser/test_openapi.py +++ b/tests/test_parser/test_openapi.py @@ -8,7 +8,6 @@ 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.schema import ParameterLocation MODULE_NAME = "openapi_python_client.parser.openapi" @@ -449,7 +448,8 @@ def test__add_responses_status_code_error(self, response_status_code, mocker): assert response.errors == [ ParseError( - detail=f"Invalid response status code {response_status_code} (not a valid HTTP status code), response will be ommitted from generated client" + detail=f"Invalid response status code {response_status_code} (not a valid HTTP status code), " + "response will be ommitted from generated client" ) ] response_from_data.assert_not_called() @@ -479,12 +479,12 @@ def test__add_responses_error(self, mocker): ) assert response.errors == [ ParseError( - detail=f"Cannot parse response for status code 200 (some problem), " + detail="Cannot parse response for status code 200 (some problem), " "response will be ommitted from generated client", data=parse_error.data, ), ParseError( - detail=f"Cannot parse response for status code 404 (some problem), " + detail="Cannot parse response for status code 404 (some problem), " "response will be ommitted from generated client", data=parse_error.data, ), @@ -704,7 +704,7 @@ def test__add_parameters_with_location_postfix_conflict2(self, mocker, property_ schemas_1 = mocker.MagicMock() schemas_2 = mocker.MagicMock() schemas_3 = mocker.MagicMock() - property_from_data = mocker.patch( + mocker.patch( f"{MODULE_NAME}.property_from_data", side_effect=[ (path_prop_conflicted, schemas_1), @@ -866,7 +866,7 @@ def test__add_parameters_query_optionality(self): endpoint=endpoint, data=data, schemas=Schemas(), parameters=Parameters(), config=Config() ) - assert len(endpoint.query_parameters) == 4, "Not all query params were added" + assert len(endpoint.query_parameters) == 4, "Not all query params were added" # noqa: PLR2004 for param in endpoint.query_parameters.values(): if param.name == "not_null_required": assert not param.nullable @@ -978,9 +978,7 @@ def test_from_data_bad_params(self, mocker): parse_error = ParseError(data=mocker.MagicMock()) return_schemas = mocker.MagicMock() return_parameters = mocker.MagicMock() - add_parameters = mocker.patch.object( - Endpoint, "add_parameters", return_value=(parse_error, return_schemas, return_parameters) - ) + mocker.patch.object(Endpoint, "add_parameters", return_value=(parse_error, return_schemas, return_parameters)) data = oai.Operation.model_construct( description=mocker.MagicMock(), operationId=mocker.MagicMock(), @@ -1011,7 +1009,7 @@ def test_from_data_bad_responses(self, mocker): parse_error = ParseError(data=mocker.MagicMock()) param_schemas = mocker.MagicMock() return_parameters = mocker.MagicMock() - add_parameters = mocker.patch.object( + mocker.patch.object( Endpoint, "add_parameters", return_value=(mocker.MagicMock(), param_schemas, return_parameters) ) response_schemas = mocker.MagicMock() diff --git a/tests/test_parser/test_properties/test_init.py b/tests/test_parser/test_properties/test_init.py index 90d65554c..ac1d65f91 100644 --- a/tests/test_parser/test_properties/test_init.py +++ b/tests/test_parser/test_properties/test_init.py @@ -464,7 +464,7 @@ def test_property_from_data_str_enum_with_null(self, enum_property_factory): } def test_property_from_data_null_enum(self, enum_property_factory, none_property_factory): - from openapi_python_client.parser.properties import Class, Schemas, property_from_data + from openapi_python_client.parser.properties import Schemas, property_from_data from openapi_python_client.schema import Schema data = Schema(title="AnEnumWithOnlyNull", enum=[None], nullable=False, default=None) @@ -589,7 +589,7 @@ def test_property_from_data_ref_enum_with_invalid_default(self, enum_property_fa assert prop == PropertyError(data=data, detail="x is an invalid default for enum MyEnum") def test_property_from_data_ref_model(self, model_property_factory): - from openapi_python_client.parser.properties import Class, ModelProperty, Schemas, property_from_data + from openapi_python_client.parser.properties import Class, Schemas, property_from_data name = "new_name" required = False @@ -831,7 +831,7 @@ def test_property_from_data_union(self, mocker): ) def test_property_from_data_union_of_one_element(self, mocker, model_property_factory): - from openapi_python_client.parser.properties import Class, ModelProperty, Schemas, property_from_data + from openapi_python_client.parser.properties import Schemas, property_from_data name = "new_name" required = False @@ -1202,7 +1202,7 @@ def test_retries_failing_properties_while_making_progress(self, mocker): call("#/components/schemas/first"), ] ) - assert update_schemas_with_data.call_count == 3 + assert update_schemas_with_data.call_count == 3 # noqa: PLR2004 assert result.errors == [PropertyError()] @@ -1443,7 +1443,7 @@ def test_retries_failing_parameters_while_making_progress(self, mocker): call("#/components/parameters/first"), ] ) - assert update_parameters_with_data.call_count == 3 + assert update_parameters_with_data.call_count == 3 # noqa: PLR2004 assert result.errors == [ParameterError()] @@ -1456,11 +1456,17 @@ def test_build_enum_property_conflict(): _, schemas = build_enum_property( data=data, name="Existing", required=True, schemas=schemas, enum=["a"], parent_name=None, config=Config() ) - err, schemas = build_enum_property( - data=data, name="Existing", required=True, schemas=schemas, enum=["a", "b"], parent_name=None, config=Config() + err, new_schemas = build_enum_property( + data=data, + name="Existing", + required=True, + schemas=schemas, + enum=["a", "b"], + parent_name=None, + config=Config(), ) - assert schemas == schemas + assert schemas == new_schemas assert err == PropertyError(detail="Found conflicting enums named Existing with incompatible values.", data=data) @@ -1470,11 +1476,11 @@ def test_build_enum_property_no_values(): data = oai.Schema() schemas = Schemas() - err, schemas = build_enum_property( + err, new_schemas = build_enum_property( data=data, name="Existing", required=True, schemas=schemas, enum=[], parent_name=None, config=Config() ) - assert schemas == schemas + assert schemas == new_schemas assert err == PropertyError(detail="No values provided for Enum", data=data) @@ -1484,11 +1490,11 @@ def test_build_enum_property_bad_default(): data = oai.Schema(default="B") schemas = Schemas() - err, schemas = build_enum_property( + err, new_schemas = build_enum_property( data=data, name="Existing", required=True, schemas=schemas, enum=["A"], parent_name=None, config=Config() ) - assert schemas == schemas + assert schemas == new_schemas assert err == PropertyError(detail="B is an invalid default for enum Existing", data=data) diff --git a/tests/test_parser/test_properties/test_model_property.py b/tests/test_parser/test_properties/test_model_property.py index d22204a46..7d3a431d9 100644 --- a/tests/test_parser/test_properties/test_model_property.py +++ b/tests/test_parser/test_properties/test_model_property.py @@ -764,7 +764,6 @@ def test_process_model(self, mocker, model_property_factory): def test_set_relative_imports(model_property_factory): from openapi_python_client.parser.properties import Class - from openapi_python_client.parser.properties.model_property import ModelProperty class_info = Class("ClassName", module_name="module_name") relative_imports = {"from typing import List", f"from ..models.{class_info.module_name} import {class_info.name}"} diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index 28fd29a72..11a7ebd66 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -2,7 +2,7 @@ import openapi_python_client.schema as oai from openapi_python_client.parser.errors import ParseError, PropertyError -from openapi_python_client.parser.properties import AnyProperty, Schemas, StringProperty +from openapi_python_client.parser.properties import Schemas MODULE_NAME = "openapi_python_client.parser.responses" From 9a9f54f6046c9dea3346e5806e378edf478a976b Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 12:36:39 -0600 Subject: [PATCH 5/5] test: Ignore `.ruff_cache` in golden records --- end_to_end_tests/test_end_to_end.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/end_to_end_tests/test_end_to_end.py b/end_to_end_tests/test_end_to_end.py index 3b76c9b5c..b6d614cf0 100644 --- a/end_to_end_tests/test_end_to_end.py +++ b/end_to_end_tests/test_end_to_end.py @@ -26,7 +26,7 @@ def _compare_directories( """ first_printable = record.relative_to(Path.cwd()) second_printable = test_subject.relative_to(Path.cwd()) - dc = dircmp(record, test_subject) + dc = dircmp(record, test_subject, ignore=[".ruff_cache"]) missing_files = dc.left_only + dc.right_only if missing_files: pytest.fail(f"{first_printable} or {second_printable} was missing: {missing_files}", pytrace=False)