Skip to content

Commit

Permalink
Merge pull request #731 from tefra/fix-build
Browse files Browse the repository at this point in the history
Fix build errors
  • Loading branch information
tefra authored Dec 17, 2022
2 parents db3b75a + 11ffc89 commit 4bc2973
Show file tree
Hide file tree
Showing 27 changed files with 21 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: tests/fixtures

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [ --py37-plus ]
Expand All @@ -11,7 +11,7 @@ repos:
hooks:
- id: reorder-python-imports
- repo: https://github.com/ambv/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/autoflake
Expand All @@ -36,7 +36,7 @@ repos:
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/myint/docformatter
rev: v1.5.0
rev: v1.5.1
hooks:
- id: docformatter
args: [ "--in-place", "--pre-summary-newline" ]
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
22.12 (2022-12-17)
------------------
- Added option to ignore xml pattern restrictions `#727 <https://github.com/tefra/xsdata/pull/727>`_
- Added globalns support via SerializerConfig `#724 <https://github.com/tefra/xsdata/pull/724>`_
- Pinned docformatter version to v1.5.0 `#729 <https://github.com/tefra/xsdata/pull/729>`_

22.11 (2022-11-06)
------------------
- Added list wrapper for elements and primitive nodes `#710 <https://github.com/tefra/xsdata/pull/710>`_
Expand Down
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Features



Changelog: 22.11 (2022-11-06)
Changelog: 22.12 (2022-12-17)
-----------------------------
- Added list wrapper for elements and primitive nodes `#710 <https://github.com/tefra/xsdata/pull/710>`_
- Added option to ignore xml pattern restrictions `#727 <https://github.com/tefra/xsdata/pull/727>`_
- Added globalns support via SerializerConfig `#724 <https://github.com/tefra/xsdata/pull/724>`_
- Pinned docformatter version to v1.5.0 `#729 <https://github.com/tefra/xsdata/pull/729>`_
2 changes: 0 additions & 2 deletions tests/codegen/mappers/test_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ def test_build_message_class(self, mock_create_message_attributes):
self.assertEqual(expected, actual)

def test_get_or_create_inner_class(self):

target = ClassFactory.create(
location="foo", package=None, ns_map={"foo": "bar"}
)
Expand Down Expand Up @@ -775,7 +774,6 @@ def test_map_port_type_message(self):
self.assertEqual([expected], list(actual))

def test_operation_namespace(self):

self.assertIsNone(DefinitionsMapper.operation_namespace({}))
self.assertIsNone(DefinitionsMapper.operation_namespace({"transport": "foo"}))
self.assertEqual(
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/models/test_attr_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class AttrTypeTests(FactoryTestCase):
def test_property_is_dependency(self):

attr_type = AttrTypeFactory.create(forward=True, native=True, circular=True)
self.assertFalse(attr_type.is_dependency(False))

Expand Down
1 change: 0 additions & 1 deletion tests/codegen/models/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def test_property_references(self):
self.assertEqual(list(range(1, 7)), list(obj.references))

def test_property_target_module(self):

obj = ClassFactory.create(module=None, package=None)
with self.assertRaises(CodeGenerationError) as cm:
obj.target_module
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def test_clean_inner_classes(self, mock_is_orphan_inner):
self.assertEqual(survivor, target.inner[0])

def test_is_orphan_inner(self):

inner = ClassFactory.create(qname="thug")
target = ClassFactory.create(
attrs=[
Expand Down
1 change: 0 additions & 1 deletion tests/formats/dataclass/parsers/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ def test_bind_derived_value_with_choice_var(self):
)

def test_bind_wildcard_dataclass(self):

data = {"a": None, "wildcard": {"x": 1}}
expected = ExtendedType(wildcard=TypeA(x=1))
self.assertEqual(expected, self.parser.bind_dataclass(data, ExtendedType))
Expand Down
1 change: 0 additions & 1 deletion tests/formats/dataclass/parsers/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_parse(self):
self.assertEqual({"brk": "urn:books"}, self.parser.ns_map)

def test_parse_with_unhandled_event(self):

with self.assertRaises(XmlHandlerError) as cm:
self.parser.parse([("reverse", "")], Books)

Expand Down
1 change: 0 additions & 1 deletion tests/formats/dataclass/serializers/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class XmlWriterImpl(XmlWriter):

__slots__ = ()

def __init__(self, config: SerializerConfig, output: TextIO, ns_map: Dict):
Expand Down
1 change: 0 additions & 1 deletion tests/formats/dataclass/serializers/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ def test_next_attribute(self):
self.assertEqual(expected, list(actual))

def test_render_mixed_content(self):

obj = Paragraph()
obj.content.append(AnyElement(qname="b", text="Mr."))
obj.content.append(Span("chris"))
Expand Down
8 changes: 7 additions & 1 deletion tests/formats/test_converter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import warnings
from datetime import date
from datetime import datetime
Expand All @@ -8,6 +9,8 @@
from unittest import TestCase
from xml.etree.ElementTree import QName

import pytest

from tests.fixtures.datatypes import Telephone
from xsdata.exceptions import ConverterError
from xsdata.formats.converter import Converter
Expand Down Expand Up @@ -212,7 +215,6 @@ def test_serialize_with_base64_format(self):
self.assertEqual("MS0yLTM=", output)

def test_serialize_raises_exception(self):

with self.assertRaises(ConverterError) as cm:
self.converter.deserialize(1, format="foo")

Expand Down Expand Up @@ -359,6 +361,10 @@ class EnumConverterTests(TestCase):
def setUp(self):
self.converter = converter.type_converter(Enum)

@pytest.mark.skipif(
sys.version_info == (3, 11, 1, "final", 0),
reason="https://github.com/python/cpython/issues/100098",
)
def test_deserialize(self):
convert = self.converter.deserialize
self.assertEqual(EnumA.C, convert("2.1", data_type=EnumA))
Expand Down
1 change: 0 additions & 1 deletion tests/models/enums/test_datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def test_from_value_float(self):
self.assertEqual(DataType.DOUBLE, DataType.from_value(3.402823467e38))

def test_from_value_period(self):

g_day = XmlPeriod("---20-02:44")
self.assertEqual(DataType.G_DAY, DataType.from_value(g_day))

Expand Down
1 change: 0 additions & 1 deletion tests/models/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def test_read_with_wrong_value(self):
GeneratorConfig.read(file_path)

def test_format_with_invalid_state(self):

with self.assertRaises(GeneratorConfigError) as cm:
OutputFormat(eq=False, order=True)

Expand Down
2 changes: 0 additions & 2 deletions tests/models/test_datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def test_properties(self):
self.assertFalse(duration.negative)

def test_init_valid(self):

fixtures = {
"P2Y6M5DT12H35M30.5S": {
"days": 5,
Expand Down Expand Up @@ -497,7 +496,6 @@ def test_properties(self):
self.assertEqual(-164, period.offset)

def test_init_valid(self):

fixtures = {
"--05---05:00": {"month": 5, "offset": -300},
"---01 ": {"day": 1},
Expand Down
1 change: 0 additions & 1 deletion tests/utils/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class ObjectsTests(TestCase):
def test_update(self):

obj = SimpleNamespace()
obj.foo = SimpleNamespace()
obj.foo.bar = 2
Expand Down
2 changes: 1 addition & 1 deletion xsdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "22.11"
__version__ = "22.12"
1 change: 0 additions & 1 deletion xsdata/codegen/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Steps:


class ClassContainer(ContainerInterface):

__slots__ = ("data", "processors")

def __init__(self, config: GeneratorConfig):
Expand Down
1 change: 0 additions & 1 deletion xsdata/codegen/handlers/validate_attributes_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ValidateAttributesOverrides(RelativeHandlerInterface):
__slots__ = ()

def process(self, target: Class):

base_attrs_map = self.base_attrs_map(target)
for attr in list(target.attrs):
base_attrs = base_attrs_map.get(attr.slug)
Expand Down
1 change: 0 additions & 1 deletion xsdata/codegen/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class DependenciesResolver:

__slots__ = "packages", "aliases", "imports", "class_list", "class_map", "package"

def __init__(self, packages: Dict[str, str]):
Expand Down
1 change: 0 additions & 1 deletion xsdata/formats/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ def deserialize(self, value: Any, **kwargs: Any) -> datetime:


class ProxyConverter(Converter):

__slots__ = ("factory",)

def __init__(self, factory: Callable):
Expand Down
2 changes: 0 additions & 2 deletions xsdata/formats/dataclass/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class ClassType(abc.ABC):

__slots__ = ()

@property
Expand Down Expand Up @@ -106,7 +105,6 @@ def get_type(self, name: str) -> ClassType:


class Dataclasses(ClassType):

__slots__ = ()

@property
Expand Down
1 change: 0 additions & 1 deletion xsdata/formats/dataclass/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@


class Filters:

DEFAULT_KEY = "default"
FACTORY_KEY = "default_factory"
UNESCAPED_DBL_QUOTE_REGEX = re.compile(r"([^\\])\"")
Expand Down
1 change: 0 additions & 1 deletion xsdata/formats/dataclass/models/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ def default_xml_type(self, clazz: Type) -> str:


class XmlVarBuilder:

__slots__ = (
"class_type",
"default_xml_type",
Expand Down
1 change: 0 additions & 1 deletion xsdata/formats/dataclass/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Transport(abc.ABC):

__slots__ = ()

@abc.abstractmethod
Expand Down
1 change: 0 additions & 1 deletion xsdata/models/xsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ def real_name(self) -> str:

@property
def attr_types(self) -> Iterator[str]:

for simple_type in self.simple_types:
yield from simple_type.attr_types

Expand Down
1 change: 0 additions & 1 deletion xsdata/utils/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def parse_fixed_digits(self, max_digits: int) -> int:
return int(self.value[start : self.vidx].ljust(just, "0"))

def parse_offset(self) -> Optional[int]:

if not self.has_more():
return None

Expand Down

0 comments on commit 4bc2973

Please sign in to comment.