deprecation_utils
singledispatchmethod
Single-dispatch generic method descriptor.
Supports wrapping existing descriptors and handles non-descriptor callables as instance methods.
Source code in lineapy/utils/deprecation_utils.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
register(cls, method=None)
generic_method.register(cls, func) -> func
Registers a new implementation for the given cls on a generic_method.
Source code in lineapy/utils/deprecation_utils.py
24 25 26 27 28 29 30 |
|
get_source_segment(source, node, padded=False)
Get source code segment of the source that generated node.
This is a polyfill for the ast.get_source_segment function that was introduced in python 3.8.
If some location information (lineno
, end_lineno
, col_offset
,
or end_col_offset
) is missing, return None.
If padded is True
, the first line of a multi-line statement will
be padded with spaces to match its original position.
Source code in lineapy/utils/deprecation_utils.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|