Skip to content

Commit 3234bd2

Browse files
committed
fix python 3.12 pylint compat, fix some linting issues
1 parent 29dbb2f commit 3234bd2

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

django_enum/fields.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ def _try_coerce(
141141
type(values(self.enum)[0])
142142
):
143143
raise ValueError(
144-
f"'{value}' is not a valid {self.enum.__name__} "
144+
f"'{value}' is not a valid "
145+
f"{self.enum.__name__} "
145146
f"required by field {self.name}."
146147
) from err
147148
return value

django_enum/forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class EnumChoiceField(TypedChoiceField):
6767
enum_: Optional[Type[Enum]] = None
6868
strict_: bool = True
6969
empty_value: Any = ''
70-
empty_values: List[Any]
70+
empty_values: List[Any] = TypedChoiceField.empty_values
7171
choices: Iterable[Tuple[Any, Any]]
7272

7373
@property
@@ -114,7 +114,7 @@ def __init__(
114114
*,
115115
empty_value: Any = _Unspecified,
116116
strict: bool = strict_,
117-
empty_values: List[Any] = TypedChoiceField.empty_values,
117+
empty_values: List[Any] = empty_values.copy(),
118118
choices: Iterable[Tuple[Any, str]] = (),
119119
**kwargs
120120
):

pyproject.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ isort = "^5.6.4"
5555
doc8 = "^0.11.0"
5656
darglint = "^1.5.7"
5757
pytest-cov = "^4.0.0"
58-
pylint = "^2.6.0"
58+
pylint = [
59+
{ version = "<3.0", markers = "python_version <= '3.7'" },
60+
{ version = "^3.0", markers = "python_version > '3.7'" },
61+
]
5962
sphinx-argparse = "^0.3.0"
6063
deepdiff = ">=5.2.3,<7.0.0"
6164
safety = "^2.0.0"

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ valid-metaclass-classmethod-first-arg = mcs
1111

1212
[pylint.DESIGN]
1313
max-branches=15
14+
max-args=6
1415

1516
[pylint.MASTER]
1617
ignore=tests

0 commit comments

Comments
 (0)