inspectfilters
Class info¶
🛈 DocStrings¶
get_argspec
¶
Return a cleaned-up FullArgSpec for given callable.
ArgSpec is cleaned up by removing self
from method callables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Any
|
A callable python object |
required |
remove_self
|
bool
|
Whether to remove "self" argument from method argspecs |
True
|
Source code in src/jinjarope/inspectfilters.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
get_deprecated_message
¶
Return deprecated message (created by deprecated decorator).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Any
|
Object to check |
required |
Source code in src/jinjarope/inspectfilters.py
230 231 232 233 234 235 236 |
|
get_doc
cached
¶
get_doc(
obj: Any,
*,
escape: bool = False,
fallback: str = "",
from_base_classes: bool = False,
only_summary: bool = False,
only_description: bool = False
) -> str
Get doc for given object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Any
|
Object to get docstrings from |
required |
escape
|
bool
|
Whether docstrings should get escaped |
False
|
fallback
|
str
|
Fallback in case docstrings dont exist |
''
|
from_base_classes
|
bool
|
Use base class docstrings if docstrings dont exist |
False
|
only_summary
|
bool
|
Only return first line of docstrings |
False
|
only_description
|
bool
|
Only return block after first line |
False
|
Source code in src/jinjarope/inspectfilters.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
get_file
cached
¶
get_file(obj: HasCodeType) -> Path | None
Cached wrapper for inspect.getfile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
HasCodeType
|
Object to get file for |
required |
Source code in src/jinjarope/inspectfilters.py
280 281 282 283 284 285 286 287 288 289 |
|
get_members
cached
¶
Cached version of inspect.getmembers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
object
|
Object to get members for |
required |
predicate
|
Callable[[Any], bool] | None
|
Optional predicate for the members |
None
|
Source code in src/jinjarope/inspectfilters.py
269 270 271 272 273 274 275 276 277 |
|
get_signature
cached
¶
Cached wrapper for inspect.signature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Callable[..., Any]
|
Callable to get a signature for. |
required |
Source code in src/jinjarope/inspectfilters.py
259 260 261 262 263 264 265 266 |
|
get_source
cached
¶
get_source(obj: HasCodeType) -> str
Cached wrapper for inspect.getsource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
HasCodeType
|
Object to return source for. |
required |
Source code in src/jinjarope/inspectfilters.py
239 240 241 242 243 244 245 246 |
|
get_source_lines
cached
¶
Cached wrapper for inspect.getsourcelines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
HasCodeType
|
Object to return source lines for. |
required |
Source code in src/jinjarope/inspectfilters.py
249 250 251 252 253 254 255 256 |
|
iter_baseclasses
¶
iter_baseclasses(
klass: ClassType,
*,
recursive: bool = True,
filter_abstract: bool = False,
filter_generic: bool = True,
filter_locals: bool = True
) -> Iterator[ClassType]
(Recursively) iterate all baseclasses of given klass.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
klass
|
ClassType
|
class to get subclasses from |
required |
filter_abstract
|
bool
|
whether abstract base classes should be included. |
False
|
filter_generic
|
bool
|
whether generic base classes should be included. |
True
|
filter_locals
|
bool
|
whether local base classes should be included. |
True
|
recursive
|
bool
|
whether to also get baseclasses of baseclasses. |
True
|
Source code in src/jinjarope/inspectfilters.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
iter_subclasses
¶
iter_subclasses(
klass: ClassType,
*,
recursive: bool = True,
filter_abstract: bool = False,
filter_generic: bool = True,
filter_locals: bool = True
) -> Iterator[ClassType]
(Recursively) iterate all subclasses of given klass.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
klass
|
ClassType
|
class to get subclasses from |
required |
filter_abstract
|
bool
|
whether abstract base classes should be included. |
False
|
filter_generic
|
bool
|
whether generic base classes should be included. |
True
|
filter_locals
|
bool
|
whether local base classes should be included. |
True
|
recursive
|
bool
|
whether to also get subclasses of subclasses. |
True
|
Source code in src/jinjarope/inspectfilters.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
list_baseclasses
cached
¶
list_baseclasses(
klass: ClassType,
*,
recursive: bool = True,
filter_abstract: bool = False,
filter_generic: bool = True,
filter_locals: bool = True
) -> list[ClassType]
Return list of all baseclasses of given klass.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
klass
|
ClassType
|
class to get subclasses from |
required |
filter_abstract
|
bool
|
whether abstract base classes should be included. |
False
|
filter_generic
|
bool
|
whether generic base classes should be included. |
True
|
filter_locals
|
bool
|
whether local base classes should be included. |
True
|
recursive
|
bool
|
whether to also get baseclasses of baseclasses. |
True
|
Source code in src/jinjarope/inspectfilters.py
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 |
|
list_subclasses
cached
¶
list_subclasses(
klass: ClassType,
*,
recursive: bool = True,
filter_abstract: bool = False,
filter_generic: bool = True,
filter_locals: bool = True
) -> list[ClassType]
Return list of all subclasses of given klass.
Note: This call is cached. Consider iter_subclasses for uncached iterating.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
klass
|
ClassType
|
class to get subclasses from |
required |
filter_abstract
|
bool
|
whether abstract base classes should be included. |
False
|
filter_generic
|
bool
|
whether generic base classes should be included. |
True
|
filter_locals
|
bool
|
whether local base classes should be included. |
True
|
recursive
|
bool
|
whether to also get subclasses of subclasses. |
True
|
Source code in src/jinjarope/inspectfilters.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|