From 3ad50f2d9bcdeeed3162f6a4746c801d8ad89616 Mon Sep 17 00:00:00 2001 From: Chris Tsou Date: Fri, 28 Jun 2024 08:58:18 +0300 Subject: [PATCH] fix: Ruff check command typo breaks generator (#1061) * fix: Typo in ruff check command * fix: Ruff check command typo breaks generator --- .pre-commit-config.yaml | 4 ++-- CHANGES.md | 7 +++++++ README.md | 7 +++++++ tests/formats/dataclass/test_typing.py | 2 +- xsdata/__init__.py | 2 +- xsdata/codegen/handlers/disambiguate_choices.py | 5 +---- .../codegen/handlers/flatten_class_extensions.py | 16 ++++++++-------- xsdata/formats/dataclass/generator.py | 2 +- 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d6d655db..d435aca1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,13 +13,13 @@ repos: - id: typos exclude: ^tests/|.xsd|xsdata/models/datatype.py$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.10 + rev: v0.5.0 hooks: - id: ruff args: [ --fix, --show-fixes] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.10.1 hooks: - id: mypy files: ^(xsdata/) diff --git a/CHANGES.md b/CHANGES.md index 8ae66e6f..7d58ae65 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +## 24.6.1 (2024-06-28) + +**Fixes** + +- Ruff check command typo breaks generator with v0.5.0 + ([#1061](https://github.com/tefra/xsdata/pull/1061)) + ## 24.6 (2024-06-24) **Features** diff --git a/README.md b/README.md index b3aeb8f0..399ce170 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,13 @@ Check the [documentation](https://xsdata.readthedocs.io) for more ✨✨✨ - Support xinclude statements and unknown properties - Customize behaviour through config +## Changelog: 24.6.1 (2024-06-28) + +**Fixes** + +- Ruff check command typo breaks generator with v0.5.0 + ([#1061](https://github.com/tefra/xsdata/pull/1061)) + ## Changelog: 24.6 (2024-06-24) **Features** diff --git a/tests/formats/dataclass/test_typing.py b/tests/formats/dataclass/test_typing.py index 73cde3ed..ea0d8fac 100644 --- a/tests/formats/dataclass/test_typing.py +++ b/tests/formats/dataclass/test_typing.py @@ -21,7 +21,7 @@ def test_evaluate_with_typevar(): result = evaluate(Type["str"], None) - assert str == result + assert result is str with pytest.raises(TypeError): evaluate(Type, None) diff --git a/xsdata/__init__.py b/xsdata/__init__.py index a859cbbc..71d0859f 100644 --- a/xsdata/__init__.py +++ b/xsdata/__init__.py @@ -1 +1 @@ -__version__ = "24.6" +__version__ = "24.6.1" diff --git a/xsdata/codegen/handlers/disambiguate_choices.py b/xsdata/codegen/handlers/disambiguate_choices.py index f94628a0..50018ebb 100644 --- a/xsdata/codegen/handlers/disambiguate_choices.py +++ b/xsdata/codegen/handlers/disambiguate_choices.py @@ -180,10 +180,7 @@ def is_simple_type(self, choice: Attr) -> bool: return True source = self.container.find(choice.types[0].qname) - if source and source.is_enumeration: - return True - - return False + return bool(source and source.is_enumeration) def create_ref_class(self, source: Class, choice: Attr, inner: bool) -> Class: """Create an intermediate class for the given choice. diff --git a/xsdata/codegen/handlers/flatten_class_extensions.py b/xsdata/codegen/handlers/flatten_class_extensions.py index 8be2c643..4b792f91 100644 --- a/xsdata/codegen/handlers/flatten_class_extensions.py +++ b/xsdata/codegen/handlers/flatten_class_extensions.py @@ -280,14 +280,14 @@ def should_flatten_extension(cls, source: Class, target: Class) -> bool: source: The source class instance target: The target class instance """ - if not source.extensions and ( - not source.is_complex_type - or target.has_suffix_attr - or (source.has_suffix_attr and target.attrs) - ): - return True - - return False + return bool( + not source.extensions + and ( + not source.is_complex_type + or target.has_suffix_attr + or (source.has_suffix_attr and target.attrs) + ) + ) @classmethod def have_unordered_sequences( diff --git a/xsdata/formats/dataclass/generator.py b/xsdata/formats/dataclass/generator.py index e814de7d..1c155836 100644 --- a/xsdata/formats/dataclass/generator.py +++ b/xsdata/formats/dataclass/generator.py @@ -248,7 +248,7 @@ def ruff_code(self, file_paths: List[str]): ], [ "ruff", - "checks", + "check", "--line-length", str(self.config.output.max_line_length), "--config",