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

Public Member Functions

def __init__ (self, cache)
 
def set_done (self)
 
def add (self, sha, mode, name, force=False)
 
def add_unchecked (self, binsha, mode, name)
 
def __delitem__ (self, name)
 

Detailed Description

A utility class providing methods to alter the underlying cache in a list-like fashion.

Once all adjustments are complete, the _cache, which really is a reference to
the cache of a tree, will be sorted. Assuring it will be in a serializable state

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  cache 
)

Member Function Documentation

◆ __delitem__()

def __delitem__ (   self,
  name 
)
Deletes an item with the given name if it exists

◆ add()

def add (   self,
  sha,
  mode,
  name,
  force = False 
)
Add the given item to the tree. If an item with the given name already
exists, nothing will be done, but a ValueError will be raised if the
sha and mode of the existing item do not match the one you add, unless
force is True

:param sha: The 20 or 40 byte sha of the item to add
:param mode: int representing the stat compatible mode of the item
:param force: If True, an item with your name and information will overwrite
    any existing item with the same name, no matter which information it has
:return: self

◆ add_unchecked()

def add_unchecked (   self,
  binsha,
  mode,
  name 
)
Add the given item to the tree, its correctness is assumed, which
puts the caller into responsibility to assure the input is correct.
For more information on the parameters, see ``add``
:param binsha: 20 byte binary sha

◆ set_done()

def set_done (   self)
Call this method once you are done modifying the tree information.
It may be called several times, but be aware that each call will cause
a sort operation
:return self:

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