Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
pip._vendor.pkg_resources.NullProvider Class Reference
Inheritance diagram for pip._vendor.pkg_resources.NullProvider:
Inheritance graph
[legend]

Public Member Functions

 __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)
 

Public Attributes

 module_path
 

Static Public Attributes

 egg_name = None
 
 egg_info = None
 
 loader = None
 

Protected Member Functions

 _get_metadata_path (self, name)
 
 _has (self, path)
 
 _isdir (self, path)
 
 _listdir (self, path)
 
 _fn (self, base, resource_name)
 
 _get (self, path)
 

Static Protected Member Functions

 _validate_resource_path (path)
 

Detailed Description

Try to implement resources and metadata for arbitrary PEP 302 loaders

Constructor & Destructor Documentation

◆ __init__()

pip._vendor.pkg_resources.NullProvider.__init__ (   self,
  module 
)

Member Function Documentation

◆ _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: