module documentation

Support for attrs, includes dataclasses as well.

Class AttrsLikeClass Undocumented
Class ClassOptions Dictionary that may contain the following keys:
Class ClassType No class docstring; 4/4 constants documented
Class ModuleVisitor No class docstring; 1/3 method documented
Function annotation_from_attrib Get the type of an attr.ib definition.
Function collect_fields Undocumented
Function collect_inherited_constructor_params Undocumented
Function default_from_attrib Undocumented
Function generated_constructor_docstring Get a docstring for the attrs or dataclass generated constructor method.
Function get_cls_decorator_options Undocumented
Function get_cls_type_decorator Undocumented
Function get_factory If this AST represent a call to attrs.Factory, returns the expression inside the factory call
Function is_attrs_field Does this expression return an attr.ib?
Function is_dataclass_field Undocumented
Function is_field Undocumented
Function postProcess Undocumented
Function setup_pydoctor_extension Undocumented
Variable builtin_types Undocumented
Function _annotation_from_converter Undocumented
Function _annotation_from_factory Undocumented
Function _attrs_class_sig_helper Undocumented
Function _callable_return_type Given a callable dotted name in a certain context, get it's return type as ast expression.
Function _dataclass_class_sig_helper Undocumented
Function _dataclass_field_sig_helperd Undocumented
Function _define_class_sig_helper Undocumented
Function _get_decorator_param_spec Undocumented
Variable _class_type_2_decorator_signature Undocumented
Variable _class_type_2_field_signature Undocumented
Variable _class_type_2_link Undocumented
Variable _fallback_call 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.BoundArgumentsThe inspect.BoundArguments of the attr.ib() call.
ctx:model.DocumentableThe context in which this expression is evaluated.
for_constructor:boolWhether we're trying to figure out the __init__ parameter annotations instead of the attribute annotations.
Returns
ast.expr | NoneA type annotation, or None if the expression is not an attr.ib definition or contains no type information.

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 get_factory(expr: ast.expr | None, ctx: model.Documentable) -> ast.expr | None: (source)

If this AST represent a call to attrs.Factory, returns the expression inside the factory call

def is_attrs_field(expr: ast.expr | None, ctx: model.Documentable) -> bool: (source)

Does this expression return an attr.ib?

def is_dataclass_field(expr: ast.expr | None, ctx: model.Documentable) -> bool: (source)

Undocumented

def is_field(expr: ast.expr | None, ctx: model.Documentable) -> bool: (source)

Undocumented

def postProcess(system: model.System): (source)

Undocumented

def setup_pydoctor_extension(r: extensions.ExtRegistrar): (source)

Undocumented

builtin_types = (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

def _callable_return_type(dname: list[str], ctx: model.Documentable) -> ast.expr | None: (source)

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

def _get_decorator_param_spec(cls_type: ClassType) -> dict[str, tuple[object, type | tuple[type, ...]]]: (source)

Undocumented

_class_type_2_decorator_signature = (source)

Undocumented

_class_type_2_field_signature = (source)

Undocumented

_class_type_2_link = (source)

Undocumented

_fallback_call = (source)

Undocumented

_nothing = (source)

Undocumented