Skip to content

Commit 8a031c3

Browse files
committed
chore: add back in line comments
1 parent 1c9b6b6 commit 8a031c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fgpyo/util/inspect.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@
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

0 commit comments

Comments
 (0)