Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
attr._make.Attribute Class Reference

Public Member Functions

 __init__ (self, name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kw_only=False, eq=None, eq_key=None, order=None, order_key=None, on_setattr=None, alias=None)
 
 __setattr__ (self, name, value)
 
 from_counting_attr (cls, str name, _CountingAttr ca, bool kw_only, type=None)
 
 evolve (self, **changes)
 
 __getstate__ (self)
 
 __setstate__ (self, state)
 

Protected Member Functions

 _setattrs (self, name_values_pairs)
 

Detailed Description

*Read-only* representation of an attribute.

.. warning::

   You should never instantiate this class yourself.

The class has *all* arguments of `attr.ib` (except for ``factory`` which is
only syntactic sugar for ``default=Factory(...)`` plus the following:

- ``name`` (`str`): The name of the attribute.
- ``alias`` (`str`): The __init__ parameter name of the attribute, after
  any explicit overrides and default private-attribute-name handling.
- ``inherited`` (`bool`): Whether or not that attribute has been inherited
  from a base class.
- ``eq_key`` and ``order_key`` (`typing.Callable` or `None`): The
  callables that are used for comparing and ordering objects by this
  attribute, respectively. These are set by passing a callable to
  `attr.ib`'s ``eq``, ``order``, or ``cmp`` arguments. See also
  :ref:`comparison customization <custom-comparison>`.

Instances of this class are frequently used for introspection purposes
like:

- `fields` returns a tuple of them.
- Validators get them passed as the first argument.
- The :ref:`field transformer <transform-fields>` hook receives a list of
  them.
- The ``alias`` property exposes the __init__ parameter name of the field,
  with any overrides and default private-attribute handling applied.


.. versionadded:: 20.1.0 *inherited*
.. versionadded:: 20.1.0 *on_setattr*
.. versionchanged:: 20.2.0 *inherited* is not taken into account for
    equality checks and hashing anymore.
.. versionadded:: 21.1.0 *eq_key* and *order_key*
.. versionadded:: 22.2.0 *alias*

For the full version history of the fields, see `attr.ib`.

Member Function Documentation

◆ __getstate__()

attr._make.Attribute.__getstate__ (   self)
Play nice with pickle.

◆ __setstate__()

attr._make.Attribute.__setstate__ (   self,
  state 
)
Play nice with pickle.

◆ evolve()

attr._make.Attribute.evolve (   self,
**  changes 
)
Copy *self* and apply *changes*.

This works similarly to `attrs.evolve` but that function does not work
with :class:`attrs.Attribute`.

It is mainly meant to be used for `transform-fields`.

.. versionadded:: 20.3.0

The documentation for this class was generated from the following file: