OpenQuizz
Une application de gestion des contenus pédagogiques
attr._next_gen Namespace Reference

Functions

def define (maybe_cls=None, *these=None, repr=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)
 
def field (*default=NOTHING, validator=None, repr=True, hash=None, init=True, metadata=None, converter=None, factory=None, kw_only=False, eq=None, order=None, on_setattr=None)
 

Variables

def mutable = define
 
 frozen = partial(define, frozen=True, on_setattr=None)
 

Detailed Description

These are Python 3.6+-only and keyword-only APIs that call `attr.s` and
`attr.ib` with different default values.

Function Documentation

◆ define()

def attr._next_gen.define (   maybe_cls = None,
these = None,
  repr = 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 
)
The only behavioral differences are the handling of the *auto_attribs*
option:

:param Optional[bool] auto_attribs: If set to `True` or `False`, it behaves
   exactly like `attr.s`. If left `None`, `attr.s` will try to guess:

   1. If any attributes are annotated and no unannotated `attr.ib`\ s
      are found, it assumes *auto_attribs=True*.
   2. Otherwise it assumes *auto_attribs=False* and tries to collect
      `attr.ib`\ s.

and that mutable classes (``frozen=False``) validate on ``__setattr__``.

.. versionadded:: 20.1.0

◆ field()

def attr._next_gen.field ( default = NOTHING,
  validator = None,
  repr = True,
  hash = None,
  init = True,
  metadata = None,
  converter = None,
  factory = None,
  kw_only = False,
  eq = None,
  order = None,
  on_setattr = None 
)
Identical to `attr.ib`, except keyword-only and with some arguments
removed.

.. versionadded:: 20.1.0

Variable Documentation

◆ frozen

frozen = partial(define, frozen=True, on_setattr=None)

◆ mutable

def mutable = define