File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 4545 _use_attr = False
4646 attr = None
4747 Attribute : TypeAlias = TypeVar ("Attribute" , bound = object ) # type: ignore[misc, no-redef] # noqa: E501
48+
49+ # define empty placeholders for getting attr fields as a tuple or dict. They will never be
50+ # called because the import failed; but they're here to ensure that the function is defined in
51+ # sections of code that don't know if the import was successful or not.
52+
4853 def get_attr_fields (cls : type ) -> Tuple [dataclasses .Field , ...]: # type: ignore[misc]
4954 """Get tuple of fields for attr class. attrs isn't imported so return empty tuple."""
5055 return ()
56+
5157 def get_attr_fields_dict (cls : type ) -> Dict [str , dataclasses .Field ]: # type: ignore[misc]
5258 """Get dict of name->field for attr class. attrs isn't imported so return empty dict."""
5359 return {}
60+
5461 # for consistency with successful import of attr, create a set for missing values
5562 MISSING = frozenset ({DATACLASSES_MISSING })
5663
You can’t perform that action at this time.
0 commit comments