type_common
fastforward.type_common.IntOr2Tuple = ScalarOr2Tuple[int]
module-attribute
#
fastforward.type_common.IntOrTuple = ScalarOrTuple[int]
module-attribute
#
fastforward.type_common.ScalarOr2Tuple = T | tuple[T, T]
module-attribute
#
fastforward.type_common.ScalarOrTuple = T | tuple[T, ...]
module-attribute
#
fastforward.type_common.SizeT = torch.Size | tuple[int, ...]
module-attribute
#
fastforward.type_common.T = TypeVar('T')
module-attribute
#
fastforward.type_common.Tuple3 = tuple[T, T, T]
module-attribute
#
fastforward.type_common.MethodType
#
Bases: Enum
Enumeration representing different types of methods in a class.
Attributes:
Name | Type | Description |
---|---|---|
METHOD |
Regular instance method that takes self as first parameter. |
|
CLASS_METHOD |
Class method decorated with @classmethod that takes cls as first parameter. |
|
STATIC_METHOD |
Static method decorated with @staticmethod that doesn't take self or cls. |
|
NO_METHOD |
Indicates that the class does not have a method with the specified name. Can also be used to indicate that a function reference is not a method. |
fastforward.type_common.method_type(cls_or_module, method_name)
#
Determine the type of a method in a class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls_or_module
|
type | ModuleType
|
The class or module to inspect. |
required |
method_name
|
str
|
The name of the method to check. |
required |
Returns:
Type | Description |
---|---|
MethodType
|
A MethodType enum value indicating the type of the method: |
Source code in fastforward/type_common.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|