module documentation

Support for attrs.

Class AttrsClass No class docstring; 1/1 instance variable, 0/1 method documented
Class ModuleVisitor No class docstring; 1/4 method documented
Function annotation_from_attrib Get the type of an attr.ib definition.
Function attrib_args Get the arguments passed to an attr.ib definition.
Function is_attrib Does this expression return an attr.ib?
Function setup_pydoctor_extension Undocumented
Function uses_auto_attribs Does the given attr.s() decoration contain auto_attribs=True?
Variable attrib_signature Signature of the attr.ib function for defining class attributes.
Variable attrs_decorator_signature Signature of the attr.s class decorator.
def annotation_from_attrib(self: astbuilder.ModuleVistor, expr: ast.expr, ctx: model.Documentable) -> ast.expr | None: (source)

Get the type of an attr.ib definition.

Parameters
self:astbuilder.ModuleVistorUndocumented
expr:ast.exprThe ast.Call expression's AST.
ctx:model.DocumentableThe context in which this expression is evaluated.
Returns
ast.expr | NoneA type annotation, or None if the expression is not an attr.ib definition or contains no type information.
def attrib_args(expr: ast.expr, ctx: model.Documentable) -> inspect.BoundArguments | None: (source)

Get the arguments passed to an attr.ib definition.

Returns
inspect.BoundArguments | NoneThe arguments, or None if expr does not look like an attr.ib definition or the arguments passed to it are invalid.
def is_attrib(expr: ast.expr | None, ctx: model.Documentable) -> bool: (source)

Does this expression return an attr.ib?

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

Undocumented

def uses_auto_attribs(call: ast.AST, module: model.Module) -> bool: (source)

Does the given attr.s() decoration contain auto_attribs=True?

Parameters
call:ast.ASTAST of the call to attr.s(). This function will assume that attr.s() is called without verifying that.
module:model.ModuleModule that contains the call, used for error reporting.
Returns
boolTrue if True is passed for auto_attribs, False in all other cases: if auto_attribs is not passed, if an explicit False is passed or if an error was reported.
attrib_signature = (source)

Signature of the attr.ib function for defining class attributes.

attrs_decorator_signature = (source)

Signature of the attr.s class decorator.