Skip to content

Commit c62179d

Browse files
authored
Remove dead code and settings (#147)
* Reformat code according to project standards * Drop dead code
1 parent 5e88f1a commit c62179d

File tree

9 files changed

+12
-210
lines changed

9 files changed

+12
-210
lines changed

src/pythonfinder/_vendor/Makefile

-14
This file was deleted.

src/pythonfinder/_vendor/__init__.py

Whitespace-only changes.

src/pythonfinder/_vendor/vendor.txt

Whitespace-only changes.

src/pythonfinder/environment.py

-9
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
import sys
88

99

10-
def is_type_checking():
11-
try:
12-
from typing import TYPE_CHECKING
13-
except ImportError:
14-
return False
15-
return TYPE_CHECKING
16-
17-
1810
def possibly_convert_to_windows_style_path(path):
1911
if not isinstance(path, str):
2012
path = str(path)
@@ -53,7 +45,6 @@ def possibly_convert_to_windows_style_path(path):
5345

5446

5547
IGNORE_UNSUPPORTED = bool(os.environ.get("PYTHONFINDER_IGNORE_UNSUPPORTED", False))
56-
MYPY_RUNNING = os.environ.get("MYPY_RUNNING", is_type_checking())
5748
SUBPROCESS_TIMEOUT = os.environ.get("PYTHONFINDER_SUBPROCESS_TIMEOUT", 5)
5849
"""The default subprocess timeout for determining python versions
5950

src/pythonfinder/pythonfinder.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from __future__ import annotations
22

33
import operator
4+
from collections.abc import Iterable
45
from typing import Any, Optional
56

7+
from .environment import set_asdf_paths, set_pyenv_paths
68
from .exceptions import InvalidPythonVersion
79
from .models.common import FinderBaseModel
810
from .models.path import PathEntry, SystemPath
911
from .models.python import PythonVersion
10-
from .environment import set_asdf_paths, set_pyenv_paths
11-
from .utils import Iterable, version_re
12+
from .utils import version_re
1213

1314

1415
class Finder(FinderBaseModel):

src/pythonfinder/utils.py

-6
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,6 @@ def ensure_path(path: Path | str) -> Path:
241241
return path.absolute()
242242

243243

244-
def _filter_none(k, v) -> bool:
245-
if v:
246-
return True
247-
return False
248-
249-
250244
def normalize_path(path: str) -> str:
251245
return os.path.normpath(
252246
os.path.normcase(

tasks/release.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
from __future__ import annotations
33

44
import re
5+
import shutil
56
import sys
67
from pathlib import Path
78

89
import invoke
910
from parver import Version
1011

11-
from .vendoring import drop_dir
12-
1312
TASK_NAME = "RELEASE"
1413

1514

15+
def drop_dir(path):
16+
shutil.rmtree(str(path))
17+
18+
1619
def _get_git_root(ctx):
1720
return Path(ctx.run("git rev-parse --show-toplevel", hide=True).stdout.strip())
1821

tasks/vendoring/__init__.py

-173
This file was deleted.

tests/test_environment.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
from pythonfinder.environment import possibly_convert_to_windows_style_path
1010

1111

12-
@pytest.mark.skipif(os.name != 'nt', reason="Only run on Windows")
12+
@pytest.mark.skipif(os.name != "nt", reason="Only run on Windows")
1313
def test_possibly_convert_to_windows_style_path():
1414
# Create a temporary directory
1515
with tempfile.TemporaryDirectory() as tmpdirname:
1616
# Get an input path in the form "\path\to\tempdir"
1717
drive, tail = os.path.splitdrive(tmpdirname)
18-
input_path = tail.replace('/', '\\')
18+
input_path = tail.replace("/", "\\")
1919
assert re.match(r"(\\[^/\\]+)+", input_path)
2020
revised_path = possibly_convert_to_windows_style_path(input_path)
2121
assert input_path == revised_path
2222

2323
# Get an input path in the form "/c/path/to/tempdir"
24-
input_path = '/' + drive[0].lower() + tail.replace('\\', '/')
24+
input_path = "/" + drive[0].lower() + tail.replace("\\", "/")
2525
assert re.match(r"/[a-z](/[^/\\]+)+", input_path)
26-
expected = drive.upper() + tail.replace('/', '\\')
26+
expected = drive.upper() + tail.replace("/", "\\")
2727
revised_path = possibly_convert_to_windows_style_path(input_path)
2828
assert expected == revised_path

0 commit comments

Comments
 (0)