OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self) |
def | add_distribution (self, distribution) |
def | add_edge (self, x, y, label=None) |
def | add_missing (self, distribution, requirement) |
def | repr_node (self, dist, level=1) |
def | to_dot (self, f, skip_disconnected=True) |
def | topological_sort (self) |
def | __repr__ (self) |
Data Fields | |
adjacency_list | |
reverse_list | |
missing | |
Represents a dependency graph between distributions. The dependency relationships are stored in an ``adjacency_list`` that maps distributions to a list of ``(other, label)`` tuples where ``other`` is a distribution and the edge is labeled with ``label`` (i.e. the version specifier, if such was provided). Also, for more efficient traversal, for every distribution ``x``, a list of predecessors is kept in ``reverse_list[x]``. An edge from distribution ``a`` to distribution ``b`` means that ``a`` depends on ``b``. If any missing dependencies are found, they are stored in ``missing``, which is a dictionary that maps distributions to a list of requirements that were not provided by any other distributions.
def __init__ | ( | self | ) |
def __repr__ | ( | self | ) |
Representation of the graph
def add_distribution | ( | self, | |
distribution | |||
) |
Add the *distribution* to the graph. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution`
def add_edge | ( | self, | |
x, | |||
y, | |||
label = None |
|||
) |
Add an edge from distribution *x* to distribution *y* with the given *label*. :type x: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type y: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type label: ``str`` or ``None``
def add_missing | ( | self, | |
distribution, | |||
requirement | |||
) |
Add a missing *requirement* for the given *distribution*. :type distribution: :class:`distutils2.database.InstalledDistribution` or :class:`distutils2.database.EggInfoDistribution` :type requirement: ``str``
def repr_node | ( | self, | |
dist, | |||
level = 1 |
|||
) |
Prints only a subgraph
def to_dot | ( | self, | |
f, | |||
skip_disconnected = True |
|||
) |
Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool``
def topological_sort | ( | self | ) |
Perform a topological sort of the graph. :return: A tuple, the first element of which is a topologically sorted list of distributions, and the second element of which is a list of distributions that cannot be sorted because they have circular dependencies and so form a cycle.
adjacency_list |
missing |
reverse_list |