A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mkdocstrings.github.io/griffe/reference/api/models/alias/ below:

Alias - Griffe

This class represents an alias, or indirection, to an object declared in another module.

Aliases represent objects that are in the scope of a module or class, but were imported from another module.

  • alias_endlineno (int | None) –

    The ending line number of the alias.

  • alias_lineno (int | None) –

    The starting line number of the alias.

  • aliases (dict[str, Alias]) –

    The aliases pointing to this object.

  • all_members (dict[str, Object | Alias]) –

    All members (declared and inherited).

  • annotation (str | Expr | None) –

    The attribute type annotation.

  • attributes (dict[str, Attribute]) –

    The attribute members.

  • bases (list[Expr | str]) –

    The class bases.

  • canonical_path (str) –

    The full dotted path of this object.

  • classes (dict[str, Class]) –

    The class members.

  • decorators (list[Decorator]) –

    The class/function decorators.

  • deleter (Function | None) –

    The deleter linked to this function (property).

  • deprecated (str | bool | None) –

    Whether this alias is deprecated (boolean or deprecation message).

  • docstring (Docstring | None) –

    The target docstring.

  • endlineno (int | None) –

    The ending line number of the target object.

  • exports (list[str | ExprName] | None) –

    The names of the objects exported by this (module) object through the __all__ variable.

  • extra (dict) –

    Namespaced dictionaries storing extra metadata for this object, used by extensions.

  • filepath (Path | list[Path]) –

    The file path (or directory list for namespace packages) where this object was defined.

  • final_target (Object) –

    The final, resolved target, if possible.

  • functions (dict[str, Function]) –

    The function members.

  • has_docstring (bool) –

    Whether this alias' target has a non-empty docstring.

  • has_docstrings (bool) –

    Whether this alias' target or any of its members has a non-empty docstring.

  • imports (dict[str, str]) –

    The other objects imported by this alias' target.

  • imports_future_annotations (bool) –

    Whether this module import future annotations.

  • inherited (bool) –

    Whether this alias represents an inherited member.

  • inherited_members (dict[str, Alias]) –

    Members that are inherited from base classes.

  • is_alias (bool) –

    Always true for aliases.

  • is_attribute (bool) –

    Whether this object is an attribute.

  • is_class (bool) –

    Whether this object is a class.

  • is_class_private (bool) –

    Whether this object/alias is class-private (starts with __ and is a class member).

  • is_collection (bool) –

    Always false for aliases.

  • is_deprecated (bool) –

    Whether this object is deprecated.

  • is_exported (bool) –

    Whether this object/alias is exported (listed in __all__).

  • is_function (bool) –

    Whether this object is a function.

  • is_generic (bool) –

    Whether this object is generic.

  • is_imported (bool) –

    Whether this object/alias was imported from another module.

  • is_init_module (bool) –

    Whether this module is an __init__.py module.

  • is_module (bool) –

    Whether this object is a module.

  • is_namespace_package (bool) –

    Whether this module is a namespace package (top folder, no __init__.py).

  • is_namespace_subpackage (bool) –

    Whether this module is a namespace subpackage.

  • is_package (bool) –

    Whether this module is a package (top module).

  • is_private (bool) –

    Whether this object/alias is private (starts with _) but not special.

  • is_public (bool) –

    Whether this object is considered public.

  • is_special (bool) –

    Whether this object/alias is special ("dunder" attribute/method, starts and end with __).

  • is_subpackage (bool) –

    Whether this module is a subpackage.

  • is_type_alias (bool) –

    Whether this object is a type alias.

  • is_wildcard_exposed (bool) –

    Whether this object/alias is exposed to wildcard imports.

  • kind (Kind) –

    The target's kind, or Kind.ALIAS if the target cannot be resolved.

  • labels (set[str]) –

    The target labels (property, dataclass, etc.).

  • lineno (int | None) –

    The starting line number of the target object.

  • lines (list[str]) –

    The lines containing the source of this object.

  • lines_collection (LinesCollection) –

    The lines collection attached to this object or its parents.

  • members (dict[str, Object | Alias]) –

    The target's members (modules, classes, functions, attributes, type aliases).

  • module (Module) –

    The parent module of this object.

  • modules (dict[str, Module]) –

    The module members.

  • modules_collection (ModulesCollection) –

    The modules collection attached to the alias parents.

  • name (str) –

    The alias name.

  • overloads (dict[str, list[Function]] | list[Function] | None) –

    The overloaded signatures declared in this class/module or for this function.

  • package (Module) –

    The absolute top module (the package) of this object.

  • parameters (Parameters) –

    The parameters of the current function or __init__ method for classes.

  • parent (Module | Class | Alias | None) –

    The parent of this alias.

  • path (str) –

    The dotted path / import path of this object.

  • public (bool | None) –

    Whether this alias is public.

  • relative_filepath (Path) –

    The file path where this object was defined, relative to the current working directory.

  • relative_package_filepath (Path) –

    The file path where this object was defined, relative to the top module path.

  • resolved (bool) –

    Whether this alias' target is resolved.

  • resolved_bases (list[Object]) –

    Resolved class bases.

  • returns (str | Expr | None) –

    The function return type annotation.

  • runtime (bool) –

    Whether this alias is available at runtime.

  • setter (Function | None) –

    The setter linked to this function (property).

  • source (str) –

    The source code of this object.

  • target (Object | Alias) –

    The resolved target (actual object), if possible.

  • target_path (str) –

    The path of this alias' target.

  • type_aliases (dict[str, TypeAlias]) –

    The type alias members.

  • type_parameters (TypeParameters) –

    The target type parameters.

  • value (str | Expr | None) –

    The attribute or type alias value.

  • wildcard (str | None) –

    The module on which the wildcard import is performed (if any).

  • alias_endlineno instance-attribute ¤

    The ending line number of the alias.

    alias_lineno instance-attribute ¤

    The starting line number of the alias.

    aliases property ¤

    The aliases pointing to this object.

    all_members property ¤

    All members (declared and inherited).

    This method is part of the consumer API: do not use when producing Griffe trees!

    annotation property writable ¤

    The attribute type annotation.

    attributes property ¤

    The attribute members.

    This method is part of the consumer API: do not use when producing Griffe trees!

    canonical_path property ¤

    The full dotted path of this object.

    The canonical path is the path where the object was defined (not imported).

    See also: path.

    classes property ¤

    The class members.

    This method is part of the consumer API: do not use when producing Griffe trees!

    decorators property ¤

    The class/function decorators.

    See also: Function, Class.

    deleter property ¤

    The deleter linked to this function (property).

    deprecated instance-attribute ¤
    deprecated: str | bool | None = None
    

    Whether this alias is deprecated (boolean or deprecation message).

    endlineno property writable ¤

    The ending line number of the target object.

    See also: lineno.

    exports property ¤

    The names of the objects exported by this (module) object through the __all__ variable.

    Exports can contain string (object names) or resolvable names, like other lists of exports coming from submodules:

    from .submodule import __all__ as submodule_all
    
    __all__ = ["hello", *submodule_all]
    

    Exports get expanded by the loader before it expands wildcards and resolves aliases.

    See also: GriffeLoader.expand_exports.

    Namespaced dictionaries storing extra metadata for this object, used by extensions.

    final_target property ¤

    The final, resolved target, if possible.

    This will iterate through the targets until a non-alias object is found.

    See also: target, resolve_target, resolved.

    functions property ¤

    The function members.

    This method is part of the consumer API: do not use when producing Griffe trees!

    has_docstrings property ¤

    Whether this alias' target or any of its members has a non-empty docstring.

    See also: has_docstring, docstring.

    imports property ¤

    The other objects imported by this alias' target.

    Keys are the names within the object (from ... import ... as AS_NAME), while the values are the actual names of the objects (from ... import REAL_NAME as ...).

    See also: is_imported.

    imports_future_annotations property ¤
    imports_future_annotations: bool
    

    Whether this module import future annotations.

    inherited instance-attribute ¤

    Whether this alias represents an inherited member.

    inherited_members property ¤

    Members that are inherited from base classes.

    Each inherited member of the target will be wrapped in an alias, to preserve correct object access paths.

    This method is part of the consumer API: do not use when producing Griffe trees!

    See also: members.

    is_alias class-attribute instance-attribute ¤ is_class_private property ¤

    Whether this object/alias is class-private (starts with __ and is a class member).

    is_collection class-attribute instance-attribute ¤
    is_collection: bool = False
    

    Always false for aliases.

    See also: ModulesCollection.

    is_deprecated property ¤

    Whether this object is deprecated.

    is_exported property ¤

    Whether this object/alias is exported (listed in __all__).

    is_generic property ¤

    Whether this object is generic.

    is_imported property ¤

    Whether this object/alias was imported from another module.

    is_init_module property ¤

    Whether this module is an __init__.py module.

    See also: is_module.

    is_namespace_package property ¤
    is_namespace_package: bool
    

    Whether this module is a namespace package (top folder, no __init__.py).

    See also: is_namespace_subpackage.

    is_namespace_subpackage property ¤
    is_namespace_subpackage: bool
    

    Whether this module is a namespace subpackage.

    See also: is_namespace_package.

    is_package property ¤

    Whether this module is a package (top module).

    See also: is_subpackage.

    is_private property ¤

    Whether this object/alias is private (starts with _) but not special.

    is_public property ¤

    Whether this object is considered public.

    In modules, developers can mark objects as public thanks to the __all__ variable. In classes however, there is no convention or standard to do so.

    Therefore, to decide whether an object is public, we follow this algorithm:

    is_special property ¤

    Whether this object/alias is special ("dunder" attribute/method, starts and end with __).

    is_subpackage property ¤

    Whether this module is a subpackage.

    See also: is_package.

    is_wildcard_exposed property ¤
    is_wildcard_exposed: bool
    

    Whether this object/alias is exposed to wildcard imports.

    To be exposed to wildcard imports, an object/alias must:

    Special case for Griffe trees: a submodule is only exposed if its parent imports it.

    Returns:

    kind property ¤

    The target's kind, or Kind.ALIAS if the target cannot be resolved.

    See also: is_kind.

    labels property ¤

    The target labels (property, dataclass, etc.).

    See also: has_labels.

    lineno property writable ¤

    The starting line number of the target object.

    See also: endlineno.

    lines_collection property ¤

    The lines collection attached to this object or its parents.

    See also: lines, source.

    Raises:

    module property ¤

    The parent module of this object.

    See also: package.

    Raises:

    modules property ¤

    The module members.

    This method is part of the consumer API: do not use when producing Griffe trees!

    modules_collection property ¤

    The modules collection attached to the alias parents.

    name instance-attribute ¤

    The alias name.

    overloads property writable ¤

    The overloaded signatures declared in this class/module or for this function.

    package property ¤

    The absolute top module (the package) of this object.

    See also: module.

    parameters property ¤

    The parameters of the current function or __init__ method for classes.

    This property can fetch inherited members, and therefore is part of the consumer API: do not use when producing Griffe trees!

    parent property writable ¤

    The parent of this alias.

    path property ¤

    The dotted path / import path of this object.

    See also: canonical_path.

    public instance-attribute ¤
    public: bool | None = None
    

    Whether this alias is public.

    relative_filepath property ¤

    The file path where this object was defined, relative to the current working directory.

    If this object's file path is not relative to the current working directory, return its absolute path.

    See also: filepath, relative_package_filepath.

    Raises:

    relative_package_filepath property ¤
    relative_package_filepath: Path
    

    The file path where this object was defined, relative to the top module path.

    See also: filepath, relative_filepath.

    Raises:

    resolved property ¤

    Whether this alias' target is resolved.

    resolved_bases property ¤

    Resolved class bases.

    This method is part of the consumer API: do not use when producing Griffe trees!

    returns property writable ¤

    The function return type annotation.

    runtime instance-attribute ¤

    Whether this alias is available at runtime.

    setter property ¤

    The setter linked to this function (property).

    target property writable ¤

    The resolved target (actual object), if possible.

    Upon accessing this property, if the target is not already resolved, a lookup is done using the modules collection to find the target.

    See also: final_target, resolve_target, resolved.

    target_path instance-attribute ¤

    The path of this alias' target.

    type_aliases property ¤

    The type alias members.

    This method is part of the consumer API: do not use when producing Griffe trees!

    type_parameters property ¤

    The target type parameters.

    value property writable ¤

    The attribute or type alias value.

    __bool__ ¤

    An alias is always true-ish.

    __delitem__ ¤

    Delete a member with its name or path.

    This method is part of the consumer API: do not use when producing Griffe trees!

    Members will be looked up in both declared members and inherited ones, triggering computation of the latter.

    Parameters:

    Examples:

    >>> del griffe_object["foo"]
    >>> del griffe_object["path.to.bar"]
    >>> del griffe_object[("path", "to", "qux")]
    
    __getitem__ ¤

    Get a member with its name or path.

    This method is part of the consumer API: do not use when producing Griffe trees!

    Members will be looked up in both declared members and inherited ones, triggering computation of the latter.

    Parameters:

    Examples:

    >>> foo = griffe_object["foo"]
    >>> bar = griffe_object["path.to.bar"]
    >>> qux = griffe_object[("path", "to", "qux")]
    
    __len__ ¤

    The length of an alias is always 1.

    __setitem__ ¤

    Set a member with its name or path.

    This method is part of the consumer API: do not use when producing Griffe trees!

    Parameters:

    Examples:

    >>> griffe_object["foo"] = foo
    >>> griffe_object["path.to.bar"] = bar
    >>> griffe_object[("path", "to", "qux")] = qux
    
    as_dict ¤

    Return this alias' data as a dictionary.

    See also: as_json.

    Parameters:

    Returns:

    as_json ¤

    Return this target's data as a JSON string.

    See also: as_dict.

    Parameters:

    Returns:

    del_member ¤

    Delete a member with its name or path.

    This method is part of the producer API: you can use it safely while building Griffe trees (for example in Griffe extensions).

    Members will be looked up in declared members only, not inherited ones.

    Parameters:

    Examples:

    >>> griffe_object.del_member("foo")
    >>> griffe_object.del_member("path.to.bar")
    >>> griffe_object.del_member(("path", "to", "qux"))
    
    from_json classmethod ¤

    Create an instance of this class from a JSON string.

    Parameters:

    Returns:

    Raises:

    get_member ¤

    Get a member with its name or path.

    This method is part of the producer API: you can use it safely while building Griffe trees (for example in Griffe extensions).

    Members will be looked up in declared members only, not inherited ones.

    Parameters:

    Examples:

    >>> foo = griffe_object["foo"]
    >>> bar = griffe_object["path.to.bar"]
    >>> bar = griffe_object[("path", "to", "bar")]
    
    has_labels ¤

    Tell if this object has all the given labels.

    See also: labels.

    Parameters:

    Returns:

    mro ¤

    Return a list of classes in order corresponding to Python's MRO.

    resolve ¤

    Resolve a name within this object's and parents' scope.

    Parameters:

    Raises:

    Returns:

    resolve_target ¤

    Resolve the target.

    See also: target, final_target, resolved.

    Raises:

    set_member ¤

    Set a member with its name or path.

    This method is part of the producer API: you can use it safely while building Griffe trees (for example in Griffe extensions).

    Parameters:

    Examples:

    >>> griffe_object.set_member("foo", foo)
    >>> griffe_object.set_member("path.to.bar", bar)
    >>> griffe_object.set_member(("path", "to", "qux"), qux)
    
    signature ¤

    Construct the class/function signature.

    Parameters:

    Returns:


    RetroSearch is an open source project built by @garambo | Open a GitHub Issue

    Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

    HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4