module documentation
Support for attrs, includes dataclasses as well.
| Class | |
Undocumented |
| Class | |
Dictionary that may contain the following keys: |
| Class | |
No class docstring; 4/4 constants documented |
| Class | |
No class docstring; 1/3 method documented |
| Function | annotation |
Get the type of an attr.ib definition. |
| Function | collect |
Undocumented |
| Function | collect |
Undocumented |
| Function | default |
Undocumented |
| Function | generated |
Get a docstring for the attrs or dataclass generated constructor method. |
| Function | get |
Undocumented |
| Function | get |
Undocumented |
| Function | get |
If this AST represent a call to attrs.Factory, returns the expression inside the factory call |
| Function | is |
Does this expression return an attr.ib? |
| Function | is |
Undocumented |
| Function | is |
Undocumented |
| Function | post |
Undocumented |
| Function | setup |
Undocumented |
| Variable | builtin |
Undocumented |
| Function | _annotation |
Undocumented |
| Function | _annotation |
Undocumented |
| Function | _attrs |
Undocumented |
| Function | _callable |
Given a callable dotted name in a certain context, get it's return type as ast expression. |
| Function | _dataclass |
Undocumented |
| Function | _dataclass |
Undocumented |
| Function | _define |
Undocumented |
| Function | _get |
Undocumented |
| Variable | _class |
Undocumented |
| Variable | _class |
Undocumented |
| Variable | _class |
Undocumented |
| Variable | _fallback |
Undocumented |
| Variable | _nothing |
Undocumented |
def annotation_from_attrib(args:
inspect.BoundArguments, ctx: model.Documentable, for_constructor: bool = False) -> ast.expr | None:
(source)
¶
Get the type of an attr.ib definition.
| Parameters | |
args:inspect.BoundArguments | The inspect.BoundArguments of the attr.ib() call. |
ctx:model.Documentable | The context in which this expression is evaluated. |
forbool | Whether we're trying to figure out the __init__ parameter annotations instead of the attribute annotations. |
| Returns | |
ast.expr | None | A type annotation, or None if the expression is not an attr.ib definition or contains no type information. |
def collect_fields(node:
ast.ClassDef, ctx: model.Documentable) -> Sequence[ ast.Assign | ast.AnnAssign]:
(source)
¶
Undocumented
def collect_inherited_constructor_params(cls:
AttrsLikeClass) -> tuple[ list[ inspect.Parameter], dict[ str, ast.expr | None]]:
(source)
¶
Undocumented
def default_from_attrib(args:
inspect.BoundArguments, ctx: model.Documentable) -> ast.expr | None:
(source)
¶
Undocumented
def generated_constructor_docstring(cls:
AttrsLikeClass, constructor_signature: inspect.Signature) -> ParsedDocstring:
(source)
¶
Get a docstring for the attrs or dataclass generated constructor method.
def get_cls_decorator_options(cls_type:
ClassType, deco: ast.expr, classdef: ast.ClassDef, ctx: model.Documentable) -> ClassOptions:
(source)
¶
Undocumented
def get_cls_type_decorator(decorators:
list[ ast.expr], ctx: model.Documentable) -> tuple[ ClassType, ast.expr | None]:
(source)
¶
Undocumented
def _annotation_from_converter(converter:
ast.expr, ctx: model.Documentable) -> ast.expr | None:
(source)
¶
Undocumented
def _annotation_from_factory(factory:
ast.expr, ctx: model.Documentable) -> ast.expr | None:
(source)
¶
Undocumented
def _attrs_class_sig_helper(maybe_cls=None, these=None, repr_ns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, eq=None, order=None, auto_detect=False, collect_by_mro=False, getstate_setstate=None, on_setattr=None, field_transformer=None, match_args=True, unsafe_hash=None):
(source)
¶
Undocumented
Given a callable dotted name in a certain context, get it's return type as ast expression.
Note that the expression might not be fully resolvable in the new context since it can come from other modules.
This is not type inference, we're simply looking up the name and.
def _dataclass_class_sig_helper(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False):
(source)
¶
Undocumented
def _dataclass_field_sig_helperd(*, default=..., default_factory=..., init=True, repr=True, hash=None, compare=True, metadata=None, kw_only=...):
(source)
¶
Undocumented
def _define_class_sig_helper(maybe_cls=None, *, these=None, repr=None, unsafe_hash=None, hash=None, init=None, slots=True, frozen=False, weakref_slot=True, str=False, auto_attribs=None, kw_only=False, cache_hash=False, auto_exc=True, eq=None, order=False, auto_detect=True, getstate_setstate=None, on_setattr=None, field_transformer=None, match_args=True):
(source)
¶
Undocumented