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

Public Member Functions

def __init__ (self, path=None, include_egg=False)
 
def clear_cache (self)
 
def distinfo_dirname (cls, name, version)
 
def get_distributions (self)
 
def get_distribution (self, name)
 
def provides_distribution (self, name, version=None)
 
def get_file_path (self, name, relative_path)
 
def get_exported_entries (self, category, name=None)
 

Data Fields

 path
 

Properties

 cache_enabled = property(_get_cache_enabled, _set_cache_enabled)
 

Detailed Description

Represents a set of distributions installed on a path (typically sys.path).

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  path = None,
  include_egg = False 
)
Create an instance from a path, optionally including legacy (distutils/
setuptools/distribute) distributions.
:param path: The path to use, as a list of directories. If not specified,
     sys.path is used.
:param include_egg: If True, this instance will look for and return legacy
            distributions as well as those based on PEP 376.

Member Function Documentation

◆ clear_cache()

def clear_cache (   self)
Clears the internal cache.

◆ distinfo_dirname()

def distinfo_dirname (   cls,
  name,
  version 
)
The *name* and *version* parameters are converted into their
filename-escaped form, i.e. any ``'-'`` characters are replaced
with ``'_'`` other than the one in ``'dist-info'`` and the one
separating the name from the version number.

:parameter name: is converted to a standard distribution name by replacing
         any runs of non- alphanumeric characters with a single
         ``'-'``.
:type name: string
:parameter version: is converted to a standard version string. Spaces
            become dots, and all other non-alphanumeric characters
            (except dots) become dashes, with runs of multiple
            dashes condensed to a single dash.
:type version: string
:returns: directory name
:rtype: string

◆ get_distribution()

def get_distribution (   self,
  name 
)
Looks for a named distribution on the path.

This function only returns the first result found, as no more than one
value is expected. If nothing is found, ``None`` is returned.

:rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution`
or ``None``

◆ get_distributions()

def get_distributions (   self)
Provides an iterator that looks for distributions and returns
:class:`InstalledDistribution` or
:class:`EggInfoDistribution` instances for each one of them.

:rtype: iterator of :class:`InstalledDistribution` and
:class:`EggInfoDistribution` instances

◆ get_exported_entries()

def get_exported_entries (   self,
  category,
  name = None 
)
Return all of the exported entries in a particular category.

:param category: The category to search for entries.
:param name: If specified, only entries with that name are returned.

◆ get_file_path()

def get_file_path (   self,
  name,
  relative_path 
)
Return the path to a resource file.

◆ provides_distribution()

def provides_distribution (   self,
  name,
  version = None 
)
Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results.

This function only returns the first result found, since no more than
one values are expected. If the directory is not found, returns ``None``.

:parameter version: a version specifier that indicates the version
            required, conforming to the format in ``PEP-345``

:type name: string
:type version: string

Field Documentation

◆ path

path

Property Documentation

◆ cache_enabled

cache_enabled = property(_get_cache_enabled, _set_cache_enabled)
static

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