Skip to content

Commit 4298642

Browse files
committed
Update mypy
1 parent a1cf6da commit 4298642

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@ repos:
1616
- id: flake8
1717
additional_dependencies: ['flake8-bugbear==22.10.27']
1818
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v1.13.0
19+
rev: v1.14.1
2020
hooks:
2121
- id: mypy
2222
additional_dependencies: [typeguard,marshmallow]
2323
args: [--show-error-codes]
24-
# Too many errors. Delaying upgrade to 1.14
25-
# - repo: https://github.com/pre-commit/mirrors-mypy
26-
# rev: v1.14.1
27-
# hooks:
28-
# - id: mypy
29-
# additional_dependencies: [typeguard,marshmallow]
30-
# args: [--show-error-codes, --check-untyped-defs]
3124
- repo: https://github.com/asottile/blacken-docs
3225
rev: 1.19.1
3326
hooks:

marshmallow_dataclass2/union_field.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import copy
22
import inspect
3-
from typing import List, Tuple, Any, Optional
3+
import typing
4+
from typing import Any, List, Optional, Tuple
45

56
import typeguard
6-
from marshmallow import fields, Schema, ValidationError
7+
from marshmallow import Schema, ValidationError, fields
78

89
try:
910
from typeguard import TypeCheckError # type: ignore[attr-defined]
@@ -43,7 +44,9 @@ def __init__(self, union_fields: List[Tuple[type, fields.Field]], **kwargs):
4344
super().__init__(**kwargs)
4445
self.union_fields = union_fields
4546

46-
def _bind_to_schema(self, field_name: str, schema: Schema) -> None:
47+
def _bind_to_schema(
48+
self, field_name: str, schema: typing.Union[Schema, fields.Field]
49+
) -> None:
4750
super()._bind_to_schema(field_name, schema)
4851
new_union_fields = []
4952
for typ, field in self.union_fields:

0 commit comments

Comments
 (0)