From 9ccbbcaa5d8ca37d0568876f2555378a270588f3 Mon Sep 17 00:00:00 2001 From: Oz N Tiram Date: Thu, 8 Sep 2022 00:49:24 +0200 Subject: [PATCH] Bump vendored version of plette to v0.3.0 This version removes Python2 support. Partial fix for #5187. --- pipenv/vendor/plette/__init__.py | 2 +- pipenv/vendor/plette/lockfiles.py | 18 ++++++------------ pipenv/vendor/plette/models/packages.py | 6 ++---- pipenv/vendor/plette/models/scripts.py | 4 +--- pipenv/vendor/plette/pipfiles.py | 5 +---- pipenv/vendor/vendor.txt | 2 +- 6 files changed, 12 insertions(+), 25 deletions(-) diff --git a/pipenv/vendor/plette/__init__.py b/pipenv/vendor/plette/__init__.py index 3ca8aca3ef..288bbfdb58 100644 --- a/pipenv/vendor/plette/__init__.py +++ b/pipenv/vendor/plette/__init__.py @@ -3,7 +3,7 @@ "Lockfile", "Pipfile", ] -__version__ = '0.2.3' +__version__ = '0.3.0' from .lockfiles import Lockfile from .pipfiles import Pipfile diff --git a/pipenv/vendor/plette/lockfiles.py b/pipenv/vendor/plette/lockfiles.py index b6148510d4..001b360cda 100644 --- a/pipenv/vendor/plette/lockfiles.py +++ b/pipenv/vendor/plette/lockfiles.py @@ -1,14 +1,8 @@ -from __future__ import unicode_literals - import json import numbers -try: - import collections.abc as collections_abc -except ImportError: - import collections as collections_abc +import collections.abc as collections_abc -import pipenv.vendor.six as six from .models import DataView, Meta, PackageCollection @@ -28,14 +22,14 @@ def __init__(self): def encode(self, obj): content = super(_LockFileEncoder, self).encode(obj) - if not isinstance(content, six.text_type): + if not isinstance(content, str): content = content.decode("utf-8") content += "\n" return content def iterencode(self, obj): for chunk in super(_LockFileEncoder, self).iterencode(obj): - if not isinstance(chunk, six.text_type): + if not isinstance(chunk, str): chunk = chunk.decode("utf-8") yield chunk yield "\n" @@ -53,15 +47,15 @@ def iterencode(self, obj): def _copy_jsonsafe(value): """Deep-copy a value into JSON-safe types. """ - if isinstance(value, six.string_types + (numbers.Number,)): + if isinstance(value, (str, numbers.Number)): return value if isinstance(value, collections_abc.Mapping): - return {six.text_type(k): _copy_jsonsafe(v) for k, v in value.items()} + return {str(k): _copy_jsonsafe(v) for k, v in value.items()} if isinstance(value, collections_abc.Iterable): return [_copy_jsonsafe(v) for v in value] if value is None: # This doesn't happen often for us. return None - return six.text_type(value) + return str(value) class Lockfile(DataView): diff --git a/pipenv/vendor/plette/models/packages.py b/pipenv/vendor/plette/models/packages.py index 53ee29e91c..93b35c3adc 100644 --- a/pipenv/vendor/plette/models/packages.py +++ b/pipenv/vendor/plette/models/packages.py @@ -1,5 +1,3 @@ -import pipenv.vendor.six as six - from .base import DataView @@ -26,7 +24,7 @@ def validate(cls, data): return super(Package, cls).validate({"__package__": data}) def __getattr__(self, key): - if isinstance(self._data, six.string_types): + if isinstance(self._data, str): if key == "version": return self._data raise AttributeError(key) @@ -39,7 +37,7 @@ def __getattr__(self, key): def __setattr__(self, key, value): if key == "_data": super(Package, self).__setattr__(key, value) - elif key == "version" and isinstance(self._data, six.string_types): + elif key == "version" and isinstance(self._data, str): self._data = value else: self._data[key] = value diff --git a/pipenv/vendor/plette/models/scripts.py b/pipenv/vendor/plette/models/scripts.py index 3b2e81e4cf..69f1c9963c 100644 --- a/pipenv/vendor/plette/models/scripts.py +++ b/pipenv/vendor/plette/models/scripts.py @@ -1,8 +1,6 @@ import re import shlex -import pipenv.vendor.six as six - from .base import DataView @@ -23,7 +21,7 @@ class Script(DataView): def __init__(self, data): super(Script, self).__init__(data) - if isinstance(data, six.string_types): + if isinstance(data, str): data = shlex.split(data) self._parts = [data[0]] self._parts.extend(data[1:]) diff --git a/pipenv/vendor/plette/pipfiles.py b/pipenv/vendor/plette/pipfiles.py index f5f9ce2998..a887124c24 100644 --- a/pipenv/vendor/plette/pipfiles.py +++ b/pipenv/vendor/plette/pipfiles.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals - import hashlib import json -import pipenv.vendor.six as six import pipenv.vendor.tomlkit as tomlkit from .models import ( @@ -84,7 +81,7 @@ def get_hash(self): "develop": self._data.get("dev-packages", {}), } content = json.dumps(data, sort_keys=True, separators=(",", ":")) - if isinstance(content, six.text_type): + if isinstance(content, str): content = content.encode("utf-8") return Hash.from_hash(hashlib.sha256(content)) diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index 6bfa030f45..f338abf6de 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -13,7 +13,7 @@ parse==1.19.0 pexpect==4.8.0 pipdeptree==2.2.1 platformdirs==2.4.0 -plette[validation]==0.2.3 +plette[validation]==0.3.0 ptyprocess==0.7.0 pyparsing==3.0.9 python-dotenv==0.19.0