Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Nov 14, 2023
1 parent d2f10fc commit f4af825
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ exclude: tests/fixtures

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.12.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/ambv/black
rev: 23.7.0
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
rev: v2.2.1
hooks:
- id: autoflake
- repo: https://github.com/PyCQA/flake8
Expand All @@ -30,7 +30,7 @@ repos:
args: [ "--suppress-none-returning" ]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -41,7 +41,7 @@ repos:
- id: docformatter
args: [ "--in-place", "--pre-summary-newline" ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.7.0
hooks:
- id: mypy
files: ^(xsdata/)
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/compound/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Root:
class Meta:
name = "root"

alpha_or_bravo: List[Union[Bravo, Alpha]] = field(
alpha_or_bravo: List[Union[Alpha, Bravo]] = field(
default_factory=list,
metadata={
"type": "Elements",
Expand Down
26 changes: 14 additions & 12 deletions xsdata/formats/dataclass/serializers/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def end_tag(self, qname: str):
:param qname: Tag qualified name
"""
self.flush_start(True)
self.handler.endElementNS(split_qname(qname), None)
self.handler.endElementNS(split_qname(qname), "")

if self.tail:
self.handler.characters(self.tail)
Expand All @@ -239,20 +239,22 @@ def flush_start(self, is_nil: bool = True):
:param is_nil: If true add ``xsi:nil="true"`` to the element
attributes
"""
if self.pending_tag:
if not is_nil:
self.attrs.pop(XSI_NIL, None)
if not self.pending_tag:
return

for name in self.attrs.keys():
self.add_namespace(name[0])
if not is_nil:
self.attrs.pop(XSI_NIL, None)

self.reset_default_namespace()
self.start_namespaces()
for name in self.attrs.keys():
self.add_namespace(name[0])

self.handler.startElementNS(self.pending_tag, None, self.attrs)
self.attrs = {}
self.in_tail = False
self.pending_tag = None
self.reset_default_namespace()
self.start_namespaces()

self.handler.startElementNS(self.pending_tag, "", self.attrs) # type: ignore
self.attrs = {}
self.in_tail = False
self.pending_tag = None

def start_namespaces(self):
"""
Expand Down

0 comments on commit f4af825

Please sign in to comment.