OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR) |
def | can_add (self, dist) |
def | remove (self, dist) |
def | scan (self, search_path=None) |
def | __getitem__ (self, project_name) |
def | add (self, dist) |
def | best_match (self, req, working_set, installer=None, replace_conflicting=False) |
def | obtain (self, requirement, installer=None) |
def | __iter__ (self) |
def | __iadd__ (self, other) |
def | __add__ (self, other) |
Data Fields | |
platform | |
python | |
Searchable snapshot of distributions on a search path
def __init__ | ( | self, | |
search_path = None , |
|||
platform = get_supported_platform() , |
|||
python = PY_MAJOR |
|||
) |
Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version.
def __add__ | ( | self, | |
other | |||
) |
Add an environment or distribution to an environment
def __getitem__ | ( | self, | |
project_name | |||
) |
Return a newest-to-oldest list of distributions for `project_name` Uses case-insensitive `project_name` comparison, assuming all the project's distributions use their project's name converted to all lowercase as their key.
def __iadd__ | ( | self, | |
other | |||
) |
In-place addition of a distribution or environment
def __iter__ | ( | self | ) |
Yield the unique project names of the available distributions
def add | ( | self, | |
dist | |||
) |
Add `dist` if we ``can_add()`` it and it has not already been added
def best_match | ( | self, | |
req, | |||
working_set, | |||
installer = None , |
|||
replace_conflicting = False |
|||
) |
Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified `working_set`.) If a suitable distribution isn't active, this method returns the newest distribution in the environment that meets the ``Requirement`` in `req`. If no suitable distribution is found, and `installer` is supplied, then the result of calling the environment's ``obtain(req, installer)`` method will be returned.
def can_add | ( | self, | |
dist | |||
) |
Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned.
def obtain | ( | self, | |
requirement, | |||
installer = None |
|||
) |
Obtain a distribution matching `requirement` (e.g. via download) Obtain a distro that matches requirement (e.g. via download). In the base ``Environment`` class, this routine just returns ``installer(requirement)``, unless `installer` is None, in which case None is returned instead. This method is a hook that allows subclasses to attempt other ways of obtaining a distribution before falling back to the `installer` argument.
def remove | ( | self, | |
dist | |||
) |
Remove `dist` from the environment
def scan | ( | self, | |
search_path = None |
|||
) |
Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added.
platform |
python |