Skip to content

Commit fbcb4a8

Browse files
authored
Factor out field_makers alongside dataclass_makers (#11584)
1 parent 8fe86d1 commit fbcb4a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: mypy/plugins/dataclasses.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
'dataclass',
2525
'dataclasses.dataclass',
2626
}
27+
# The set of functions that generate dataclass fields.
28+
field_makers: Final = {
29+
'dataclasses.field',
30+
}
31+
2732

2833
SELF_TVAR_NAME: Final = "_DT"
2934

@@ -490,7 +495,7 @@ def _collect_field_args(expr: Expression,
490495
if (
491496
isinstance(expr, CallExpr) and
492497
isinstance(expr.callee, RefExpr) and
493-
expr.callee.fullname == 'dataclasses.field'
498+
expr.callee.fullname in field_makers
494499
):
495500
# field() only takes keyword arguments.
496501
args = {}

0 commit comments

Comments
 (0)