renamed classes
This commit is contained in:
parent
c8bc9c1f23
commit
328a762b44
58
pep-0376.txt
58
pep-0376.txt
|
@ -301,11 +301,11 @@ The API is organized in five classes that work with directories and Zip files
|
||||||
- ``Distribution``: manages an `.egg-info` directory.
|
- ``Distribution``: manages an `.egg-info` directory.
|
||||||
- ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip
|
- ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip
|
||||||
file.
|
file.
|
||||||
- ``DistributionDirectory``: manages a directory that contains some `.egg-info`
|
- ``DistributionDir``: manages a directory that contains some `.egg-info`
|
||||||
directories.
|
directories.
|
||||||
- ``ZippedDistributionDirectory``: manages a zipped directory that contains
|
- ``ZippedDistributionDir``: manages a zipped directory that contains
|
||||||
some `.egg.info` directory.
|
some `.egg.info` directory.
|
||||||
- ``DistributionDirectories``: manages ``DistributionDirectory`` instances.
|
- ``DistributionDirMap``: manages ``DistributionDir`` instances.
|
||||||
|
|
||||||
Distribution class
|
Distribution class
|
||||||
------------------
|
------------------
|
||||||
|
@ -375,19 +375,19 @@ class so its methods work with an `.egg.info` directory located in a zip file.
|
||||||
|
|
||||||
Other public methods and attributes are similar to ``Distribution``.
|
Other public methods and attributes are similar to ``Distribution``.
|
||||||
|
|
||||||
DistributionDirectory class
|
DistributionDir class
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
A new class called ``DistributionDirectory`` is created with a path
|
A new class called ``DistributionDir`` is created with a path
|
||||||
corresponding to a directory. For each `.egg-info` directory founded in
|
corresponding to a directory. For each `.egg-info` directory founded in
|
||||||
`path`, the class creates a corresponding ``Distribution``.
|
`path`, the class creates a corresponding ``Distribution``.
|
||||||
|
|
||||||
The class is a ``set`` of ``Distribution`` instances. ``DistributionDirectory``
|
The class is a ``set`` of ``Distribution`` instances. ``DistributionDir``
|
||||||
provides a ``path`` attribute corresponding to the path is was created with.
|
provides a ``path`` attribute corresponding to the path is was created with.
|
||||||
|
|
||||||
``DistributionDirectory(path)`` -> instance
|
``DistributionDir(path)`` -> instance
|
||||||
|
|
||||||
Creates a ``DistributionDirectory`` instance for the given ``path``.
|
Creates a ``DistributionDir`` instance for the given ``path``.
|
||||||
|
|
||||||
It also provides one extra method besides the ones from ``set``:
|
It also provides one extra method besides the ones from ``set``:
|
||||||
|
|
||||||
|
@ -397,53 +397,53 @@ It also provides one extra method besides the ones from ``set``:
|
||||||
``Distribution.uses(path)`` on all ``Distribution`` instances.
|
``Distribution.uses(path)`` on all ``Distribution`` instances.
|
||||||
|
|
||||||
|
|
||||||
ZippedDistributionDirectory class
|
ZippedDistributionDir class
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
A ``ZippedDistributionDirectory`` is provided. It overrides the
|
A ``ZippedDistributionDir`` is provided. It overrides the
|
||||||
``DistributionDirectory`` class so its methods work with a Zip file.
|
``DistributionDir`` class so its methods work with a Zip file.
|
||||||
|
|
||||||
``ZippedDistributionDirectory(path)`` -> instance
|
``ZippedDistributionDir(path)`` -> instance
|
||||||
|
|
||||||
Creates a ``ZippedDistributionDirectory`` instance for the given ``path``.
|
Creates a ``ZippedDistributionDir`` instance for the given ``path``.
|
||||||
|
|
||||||
Other public methods and attributes are similar to ``DistributionDirectory``.
|
Other public methods and attributes are similar to ``DistributionDir``.
|
||||||
|
|
||||||
|
|
||||||
DistributionDirectories class
|
DistributionDirMap class
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
A new class called ``DistributionDirectories`` is created. It's a collection of
|
A new class called ``DistributionDirMap`` is created. It's a collection of
|
||||||
``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances.
|
``DistributionDir`` and ``ZippedDistributionDir`` instances.
|
||||||
|
|
||||||
``DistributionDirectories(paths=None, use_cache=True)`` -> instance
|
``DistributionDirMap(paths=None, use_cache=True)`` -> instance
|
||||||
|
|
||||||
If ``paths`` is not not, it's a sequence of paths the constructor loads
|
If ``paths`` is not not, it's a sequence of paths the constructor loads
|
||||||
in the instance.
|
in the instance.
|
||||||
|
|
||||||
The constructor also takes an optional ``use_cache`` argument.
|
The constructor also takes an optional ``use_cache`` argument.
|
||||||
When it's ``True``, ``DistributionDirectories`` will use a global
|
When it's ``True``, ``DistributionDirMap`` will use a global
|
||||||
cache to reduce the numbers of I/O accesses and speed up the lookups.
|
cache to reduce the numbers of I/O accesses and speed up the lookups.
|
||||||
|
|
||||||
The cache is a global mapping containing ``DistributionDirectory`` and
|
The cache is a global mapping containing ``DistributionDir`` and
|
||||||
``ZippedDistributionDirectory`` instances. When a
|
``ZippedDistributionDir`` instances. When a
|
||||||
``DistributionDirectories`` object is created, it will use the cache to
|
``DistributionDirMap`` object is created, it will use the cache to
|
||||||
add an entry for each path it visits, or reuse existing entries. The
|
add an entry for each path it visits, or reuse existing entries. The
|
||||||
cache usage can be disabled at any time with the ``use_cache`` attribute.
|
cache usage can be disabled at any time with the ``use_cache`` attribute.
|
||||||
|
|
||||||
The cache can also be emptied with the global ``purge_cache`` function.
|
The cache can also be emptied with the global ``purge_cache`` function.
|
||||||
|
|
||||||
The class is a ``dict`` where the values are ``DistributionDirectory``
|
The class is a ``dict`` where the values are ``DistributionDir``
|
||||||
and ``ZippedDistributionDirectory`` instances and the keys are their path
|
and ``ZippedDistributionDir`` instances and the keys are their path
|
||||||
attributes.
|
attributes.
|
||||||
|
|
||||||
``DistributionDirectories`` also provides the following methods besides the ones
|
``DistributionDirMap`` also provides the following methods besides the ones
|
||||||
from ``dict``:
|
from ``dict``:
|
||||||
|
|
||||||
- ``load(*paths)``
|
- ``load(*paths)``
|
||||||
|
|
||||||
Creates and adds ``DistributionDirectory`` (or
|
Creates and adds ``DistributionDir`` (or
|
||||||
``ZippedDistributionDirectory``) instances corresponding to ``paths``.
|
``ZippedDistributionDir``) instances corresponding to ``paths``.
|
||||||
|
|
||||||
- ``reload()``
|
- ``reload()``
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ from ``dict``:
|
||||||
``ZippedDistribution``) instances.
|
``ZippedDistribution``) instances.
|
||||||
|
|
||||||
Iterates over all ``Distribution`` and ``ZippedDistribution`` contained
|
Iterates over all ``Distribution`` and ``ZippedDistribution`` contained
|
||||||
in ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances.
|
in ``DistributionDir`` and ``ZippedDistributionDir`` instances.
|
||||||
|
|
||||||
- ``get_distribution(dist_name)`` -> ``Distribution`` (or
|
- ``get_distribution(dist_name)`` -> ``Distribution`` (or
|
||||||
``ZippedDistribution``) or None.
|
``ZippedDistribution``) or None.
|
||||||
|
@ -496,7 +496,7 @@ The new functions added in the ``pkgutil`` are :
|
||||||
Iterates over all distributions to find out which distributions uses ``path``.
|
Iterates over all distributions to find out which distributions uses ``path``.
|
||||||
``path`` can be a local absolute path or a relative '/'-separated path.
|
``path`` can be a local absolute path or a relative '/'-separated path.
|
||||||
|
|
||||||
All these functions use the same global instance of ``DistributionDirectories``
|
All these functions use the same global instance of ``DistributionDirMap``
|
||||||
to use the cache. Notice that the cache is never emptied explicitely.
|
to use the cache. Notice that the cache is never emptied explicitely.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
Loading…
Reference in New Issue