Commit aaf88062 by Branch Vincent Committed by Bjorn Neergaard

chore: remove unused compatibility code

parent d4c2fe44
......@@ -660,7 +660,7 @@ class Executor:
cache_directory = self._chef.get_cache_directory_for_link(link)
cached_file = cache_directory.joinpath(link.filename)
# We can't use unlink(missing_ok=True) because it's not available
# in pathlib2 for Python 2.7
# prior to Python 3.8
if cached_file.exists():
cached_file.unlink()
......
......@@ -240,21 +240,3 @@ if WINDOWS:
_get_win_folder = _get_win_folder_with_ctypes
except ImportError:
_get_win_folder = _get_win_folder_from_registry
def _win_path_to_bytes(path: str) -> Union[str, bytes]:
"""Encode Windows paths to bytes. Only used on Python 2.
Motivation is to be consistent with other operating systems where paths
are also returned as bytes. This avoids problems mixing bytes and Unicode
elsewhere in the codebase. For more details and discussion see
<https://github.com/pypa/pip/issues/3463>.
If encoding using ASCII and MBCS fails, return the original Unicode path.
"""
for encoding in ("ASCII", "MBCS"):
try:
return path.encode(encoding)
except (UnicodeEncodeError, LookupError):
pass
return path
......@@ -4,6 +4,7 @@ import shutil
import stat
import tempfile
from collections.abc import Mapping
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING
......@@ -17,12 +18,6 @@ from typing import Optional
from poetry.config.config import Config
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
if TYPE_CHECKING:
from requests import Session
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment