mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-14 11:26:24 +08:00
get_default_args for callables respects non-class type annotations and Optionals
Summary: as subj Reviewed By: davnov134 Differential Revision: D35194863 fbshipit-source-id: c8e8f234083d4f0f93dca8d93e090ca0e1e1972d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b602edccc4
commit
a54ad2b912
@@ -629,6 +629,8 @@ class TestConfig(unittest.TestCase):
|
||||
class MockDataclass:
|
||||
field_no_default: int
|
||||
field_primitive_type: int = 42
|
||||
field_optional_none: Optional[int] = None
|
||||
field_optional_with_value: Optional[int] = 42
|
||||
field_list_type: List[int] = field(default_factory=lambda: [])
|
||||
|
||||
|
||||
@@ -645,12 +647,16 @@ class MockClassWithInit: # noqa: B903
|
||||
field_no_nothing,
|
||||
field_no_default: int,
|
||||
field_primitive_type: int = 42,
|
||||
field_optional_none: Optional[int] = None,
|
||||
field_optional_with_value: Optional[int] = 42,
|
||||
field_list_type: List[int] = [], # noqa: B006
|
||||
field_reference_type: RefObject = REF_OBJECT,
|
||||
):
|
||||
self.field_no_nothing = field_no_nothing
|
||||
self.field_no_default = field_no_default
|
||||
self.field_primitive_type = field_primitive_type
|
||||
self.field_optional_none = field_optional_none
|
||||
self.field_optional_with_value = field_optional_with_value
|
||||
self.field_list_type = field_list_type
|
||||
self.field_reference_type = field_reference_type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user