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

Public Member Functions

def __init__ (self, repo, binsha, mode=tree_id<< 12, path=None)
 
def join (self, file)
 
def __div__ (self, file)
 
def __truediv__ (self, file)
 
def trees (self)
 
def blobs (self)
 
def cache (self)
 
def traverse (self, predicate=lambda i, True d, prune=lambda i, False d, depth=-1, branch_first=True, visit_once=False, ignore_self=1)
 
def __getslice__ (self, i, j)
 
def __iter__ (self)
 
def __len__ (self)
 
def __getitem__ (self, item)
 
def __contains__ (self, item)
 
def __reversed__ (self)
 
- Public Member Functions inherited from IndexObject
def __hash__ (self)
 
def name (self)
 
def abspath (self)
 
- Public Member Functions inherited from Object
def __init__ (self, repo, binsha)
 
def new (cls, repo, id)
 
def new_from_sha (cls, repo, sha1)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __str__ (self)
 
def __repr__ (self)
 
def hexsha (self)
 
def data_stream (self)
 
def stream_data (self, ostream)
 
- Public Member Functions inherited from Diffable
def diff (self, other=Index, paths=None, create_patch=False, **kwargs)
 
- Public Member Functions inherited from Traversable
def list_traverse (self, *args, **kwargs)
 
def traverse (self, predicate=lambda i, True d, prune=lambda i, False d, depth=-1, branch_first=True, visit_once=True, ignore_self=1, as_edge=False)
 

Static Public Attributes

 type
 
 commit_id
 
 blob_id
 
 symlink_id
 
 tree_id
 
- Static Public Attributes inherited from Object
 NULL_HEX_SHA
 
 NULL_BIN_SHA
 
 TYPES
 
 type
 

Additional Inherited Members

- Data Fields inherited from IndexObject
 mode
 
 path
 
- Data Fields inherited from Object
 repo
 
 binsha
 
 size
 

Detailed Description

Tree objects represent an ordered list of Blobs and other Trees.

``Tree as a list``::

    Access a specific blob using the
    tree['filename'] notation.

    You may as well access by index
    blob = tree[0]

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  repo,
  binsha,
  mode = tree_id << 12,
  path = None 
)
Initialize a newly instanced IndexObject

:param repo: is the Repo we are located in
:param binsha: 20 byte sha1
:param mode:
    is the stat compatible file mode as int, use the stat module
    to evaluate the information
:param path:
    is the path to the file in the file system, relative to the git repository root, i.e.
    file.ext or folder/other.ext
:note:
    Path may not be set of the index object has been created directly as it cannot
    be retrieved without knowing the parent tree.

Reimplemented from IndexObject.

Member Function Documentation

◆ __contains__()

def __contains__ (   self,
  item 
)

◆ __div__()

def __div__ (   self,
  file 
)
For PY2 only

◆ __getitem__()

def __getitem__ (   self,
  item 
)

◆ __getslice__()

def __getslice__ (   self,
  i,
  j 
)

◆ __iter__()

def __iter__ (   self)

◆ __len__()

def __len__ (   self)

◆ __reversed__()

def __reversed__ (   self)

◆ __truediv__()

def __truediv__ (   self,
  file 
)
For PY3 only

◆ blobs()

def blobs (   self)
:return: list(Blob, ...) list of blobs directly below this tree

◆ cache()

def cache (   self)
:return: An object allowing to modify the internal cache. This can be used
    to change the tree's contents. When done, make sure you call ``set_done``
    on the tree modifier, or serialization behaviour will be incorrect.
    See the ``TreeModifier`` for more information on how to alter the cache

◆ join()

def join (   self,
  file 
)
Find the named object in this tree's contents
:return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule``

:raise KeyError: if given file or tree does not exist in tree

◆ traverse()

def traverse (   self,
  predicate = lambda i,
True  d,
  prune = lambda i,
False  d,
  depth = -1,
  branch_first = True,
  visit_once = False,
  ignore_self = 1 
)
For documentation, see util.Traversable.traverse
Trees are set to visit_once = False to gain more performance in the traversal

◆ trees()

def trees (   self)
:return: list(Tree, ...) list of trees directly below this tree

Field Documentation

◆ blob_id

blob_id
static

◆ commit_id

commit_id
static

◆ symlink_id

symlink_id
static

◆ tree_id

tree_id
static

◆ type

type
static

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