diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2018-06-03 09:50:25 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-06-03 09:50:25 -0400 |
| commit | cca86c7f1d4040834c3265ccecdd9e21b4036df5 (patch) | |
| tree | 6952f93a45a95659d36a93072e915688ca253a85 /pkg_resources | |
| parent | 7068f1d4c86e6d8e705a2b77da6c5dcf6a8d7bcd (diff) | |
| download | external_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.tar.gz external_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.tar.bz2 external_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.zip | |
Use Python 3 syntax for new-style clasess
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 11 | ||||
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 8 | ||||
| -rw-r--r-- | pkg_resources/tests/test_working_set.py | 4 |
3 files changed, 15 insertions, 8 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 91d00483..67015408 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -78,6 +78,9 @@ __import__('pkg_resources.extern.packaging.requirements') __import__('pkg_resources.extern.packaging.markers') +__metaclass__ = type + + if (3, 0) < sys.version_info < (3, 4): raise RuntimeError("Python 3.4 or later is required") @@ -537,7 +540,7 @@ class IResourceProvider(IMetadataProvider): """List of resource names in the directory (like ``os.listdir()``)""" -class WorkingSet(object): +class WorkingSet: """A collection of active distributions on sys.path (or a similar list)""" def __init__(self, entries=None): @@ -944,7 +947,7 @@ class _ReqExtras(dict): return not req.marker or any(extra_evals) -class Environment(object): +class Environment: """Searchable snapshot of distributions on a search path""" def __init__( @@ -2279,7 +2282,7 @@ EGG_NAME = re.compile( ).match -class EntryPoint(object): +class EntryPoint: """Object representing an advertised importable object""" def __init__(self, name, module_name, attrs=(), extras=(), dist=None): @@ -2433,7 +2436,7 @@ def _version_from_file(lines): return safe_version(value.strip()) or None -class Distribution(object): +class Distribution: """Wrap an actual or potential sys.path entry w/metadata""" PKG_INFO = 'PKG-INFO' diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 7442b79f..079e83f8 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -23,6 +23,8 @@ try: except NameError: unicode = str +__metaclass__ = type + def timestamp(dt): """ @@ -43,7 +45,7 @@ class EggRemover(unicode): os.remove(self) -class TestZipProvider(object): +class TestZipProvider: finalizers = [] ref_time = datetime.datetime(2013, 5, 12, 13, 25, 0) @@ -132,7 +134,7 @@ class TestZipProvider(object): manager.cleanup_resources() -class TestResourceManager(object): +class TestResourceManager: def test_get_cache_path(self): mgr = pkg_resources.ResourceManager() path = mgr.get_cache_path('foo') @@ -163,7 +165,7 @@ class TestIndependence: subprocess.check_call(cmd) -class TestDeepVersionLookupDistutils(object): +class TestDeepVersionLookupDistutils: @pytest.fixture def env(self, tmpdir): """ diff --git a/pkg_resources/tests/test_working_set.py b/pkg_resources/tests/test_working_set.py index 42ddcc86..217edd8b 100644 --- a/pkg_resources/tests/test_working_set.py +++ b/pkg_resources/tests/test_working_set.py @@ -9,6 +9,8 @@ import pkg_resources from .test_resources import Metadata +__metaclass__ = type + def strip_comments(s): return '\n'.join( @@ -54,7 +56,7 @@ def parse_distributions(s): yield dist -class FakeInstaller(object): +class FakeInstaller: def __init__(self, installable_dists): self._installable_dists = installable_dists |
