OpenQuizz
Une application de gestion des contenus pédagogiques
ErrorTree Class Reference
Inheritance diagram for ErrorTree:
Collaboration diagram for ErrorTree:

Public Member Functions

def __init__ (self, errors=())
 
def __contains__ (self, index)
 
def __getitem__ (self, index)
 
def __setitem__ (self, index, value)
 
def __iter__ (self)
 
def __len__ (self)
 
def __repr__ (self)
 
def total_errors (self)
 

Data Fields

 errors
 

Detailed Description

ErrorTrees make it easier to check which validations failed.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  errors = () 
)

Member Function Documentation

◆ __contains__()

def __contains__ (   self,
  index 
)
Check whether ``instance[index]`` has any errors.

◆ __getitem__()

def __getitem__ (   self,
  index 
)
Retrieve the child tree one level down at the given ``index``.

If the index is not in the instance that this tree corresponds to and
is not known by this tree, whatever error would be raised by
``instance.__getitem__`` will be propagated (usually this is some
subclass of `exceptions.LookupError`.

◆ __iter__()

def __iter__ (   self)
Iterate (non-recursively) over the indices in the instance with errors.

◆ __len__()

def __len__ (   self)
Return the `total_errors`.

◆ __repr__()

def __repr__ (   self)

◆ __setitem__()

def __setitem__ (   self,
  index,
  value 
)
Add an error to the tree at the given ``index``.

◆ total_errors()

def total_errors (   self)
The total number of errors in the entire tree, including children.

Field Documentation

◆ errors

errors

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