|
| | __init__ (self, module) |
| |
|
| get_resource_filename (self, manager, resource_name) |
| |
|
| get_resource_stream (self, manager, resource_name) |
| |
|
| get_resource_string (self, manager, resource_name) |
| |
|
| has_resource (self, resource_name) |
| |
|
| has_metadata (self, name) |
| |
|
| get_metadata (self, name) |
| |
|
| get_metadata_lines (self, name) |
| |
|
| resource_isdir (self, resource_name) |
| |
|
| metadata_isdir (self, name) |
| |
|
| resource_listdir (self, resource_name) |
| |
|
| metadata_listdir (self, name) |
| |
|
| run_script (self, script_name, namespace) |
| |
|
|
| egg_name = None |
| |
|
| egg_info = None |
| |
|
| loader = None |
| |
|
|
| _get_metadata_path (self, name) |
| |
|
| _has (self, path) |
| |
|
| _isdir (self, path) |
| |
|
| _listdir (self, path) |
| |
|
| _fn (self, base, resource_name) |
| |
|
| _get (self, path) |
| |
Try to implement resources and metadata for arbitrary PEP 302 loaders
◆ __init__()
| pip._vendor.pkg_resources.NullProvider.__init__ |
( |
|
self, |
|
|
|
module |
|
) |
| |
◆ _validate_resource_path()
| pip._vendor.pkg_resources.NullProvider._validate_resource_path |
( |
|
path | ) |
|
|
staticprotected |
Validate the resource paths according to the docs.
https://setuptools.pypa.io/en/latest/pkg_resources.html#basic-resource-access
>>> warned = getfixture('recwarn')
>>> warnings.simplefilter('always')
>>> vrp = NullProvider._validate_resource_path
>>> vrp('foo/bar.txt')
>>> bool(warned)
False
>>> vrp('../foo/bar.txt')
>>> bool(warned)
True
>>> warned.clear()
>>> vrp('/foo/bar.txt')
>>> bool(warned)
True
>>> vrp('foo/../../bar.txt')
>>> bool(warned)
True
>>> warned.clear()
>>> vrp('foo/f../bar.txt')
>>> bool(warned)
False
Windows path separators are straight-up disallowed.
>>> vrp(r'\\foo/bar.txt')
Traceback (most recent call last):
...
ValueError: Use of .. or absolute path in a resource path \
is not allowed.
>>> vrp(r'C:\\foo/bar.txt')
Traceback (most recent call last):
...
ValueError: Use of .. or absolute path in a resource path \
is not allowed.
Blank values are allowed
>>> vrp('')
>>> bool(warned)
False
Non-string values are not.
>>> vrp(None)
Traceback (most recent call last):
...
AttributeError: ...
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py