Skip to content

Commit 7ff3beb

Browse files
authored
Bump dependencies (especially mypy) (#11)
1 parent 6c09d6c commit 7ff3beb

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

pyproject.toml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ python = "^3.7"
2323
lxml = "^4.6.3"
2424

2525
[tool.poetry.dev-dependencies]
26-
pytest = "^6.2.3"
27-
black = "^20.8b1"
28-
isort = "^5.8.0"
29-
pylint = "^2.7.4"
30-
pytest-cov = "^2.11.1"
31-
mypy = "^0.812"
32-
ipython = "^7.22.0"
33-
coverage = {extras = ["toml"], version = "^5.0.3"}
26+
pytest = "^7.0.0"
27+
black = "^22.1.0"
28+
isort = "^5.10.1"
29+
pylint = "^2.12.2"
30+
pytest-cov = "^3.0.0"
31+
mypy = "^0.931"
32+
ipython = "^7.31.1"
33+
coverage = {extras = ["toml"], version = "^6.3.1"}
3434
pytest-random-order = "^1.0.4"
35-
taskipy = "^1.7.0"
35+
taskipy = "^1.9.0"
3636

3737
[tool.isort]
3838
profile = "black"
@@ -76,6 +76,9 @@ good-names = "_,e,el,ex,f,tp,k,v,ns"
7676
[tool.pylint.format]
7777
indent-string = " "
7878

79+
[tool.mypy]
80+
show_error_codes = true
81+
7982
[tool.taskipy.tasks]
8083
isort = "isort ."
8184
black = "black ."

src/xml_dataclasses/modifiers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def rename(
2929
metadata["xml:name"] = name
3030
if ns:
3131
metadata["xml:ns"] = ns
32-
f.metadata = metadata
33-
return f # type: ignore
32+
f.metadata = metadata # type: ignore[assignment]
33+
return f # type: ignore[return-value]
3434

3535

3636
# NOTE: Actual return type is 'Field[_T]', but we want to help type checkers
@@ -43,12 +43,12 @@ def text(
4343
f = make_field(default=default)
4444
metadata = dict(f.metadata)
4545
metadata["xml:text"] = True
46-
f.metadata = metadata
47-
return f # type: ignore
46+
f.metadata = metadata # type: ignore[assignment]
47+
return f # type: ignore[return-value]
4848

4949

5050
# NOTE: Actual return type is 'Field[_T]', but we want to help type checkers
5151
# to understand the magic that happens at runtime.
5252
# see https://github.com/python/typeshed/blob/master/stdlib/3.7/dataclasses.pyi
5353
def ignored() -> _T:
54-
return field(init=False, compare=False) # type: ignore
54+
return field(init=False, compare=False) # type: ignore[no-any-return]

src/xml_dataclasses/resolve_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import annotations
33

44
from dataclasses import MISSING, Field, dataclass, fields, is_dataclass
5-
from typing import _GenericAlias # type: ignore
5+
from typing import _GenericAlias # type: ignore[attr-defined]
66
from typing import (
77
Any,
88
Collection,
@@ -71,16 +71,16 @@ class FieldInfo:
7171
@property
7272
def is_required(self) -> bool:
7373
# https://github.com/python/mypy/issues/6910
74-
factory = cast(object, self.field.default_factory) # type: ignore[misc]
74+
factory = cast(object, self.field.default_factory)
7575
return self.field.default is MISSING and factory is MISSING
7676

7777
def get_default(self) -> Any:
7878
# https://github.com/python/mypy/issues/6910
79-
factory = cast(object, self.field.default_factory) # type: ignore[misc]
79+
factory = cast(object, self.field.default_factory)
8080
if self.field.default is not MISSING:
8181
return self.field.default
8282
if factory is not MISSING:
83-
default_factory = self.field.default_factory # type: ignore[misc]
83+
default_factory = self.field.default_factory
8484
return default_factory()
8585
raise ValueError("Field is required")
8686

src/xml_dataclasses/serde.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from collections import defaultdict
44
from typing import Any, Dict, List, Mapping, Optional, Type, TypeVar, Union
55

6-
from lxml.builder import ElementMaker # type: ignore
7-
from lxml.etree import _Comment as Comment # type: ignore
6+
from lxml.builder import ElementMaker # type: ignore[import]
7+
from lxml.etree import _Comment as Comment # type: ignore[import]
88

99
from .lxml_utils import strip_ns
1010
from .options import Options
@@ -175,11 +175,11 @@ def load(
175175
else:
176176
text_values = {}
177177

178-
instance = cls(**attr_values, **text_values, **child_values) # type: ignore
178+
instance = cls(**attr_values, **text_values, **child_values)
179179
instance.__nsmap__ = el.nsmap
180180

181181
try:
182-
validate_fn = instance.xml_validate # type: ignore
182+
validate_fn = instance.xml_validate # type: ignore[attr-defined]
183183
except AttributeError:
184184
pass
185185
else:

0 commit comments

Comments
 (0)