Skip to content

Commit

Permalink
fix: really drop python<=3.7 support (#142)
Browse files Browse the repository at this point in the history
* really drop python<=3.7 support

Filter all code over `pyupgracde --py38-plus`.

Signed-off-by: Tomasz Kłoczko <[email protected]>

* fix ruff pyproject.tom warnings

Latest `ruff` shows:
```
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
  - 'isort' -> 'lint.isort'
  - 'mccabe' -> 'lint.mccabe'
```

Signed-off-by: Tomasz Kłoczko <[email protected]>

---------

Signed-off-by: Tomasz Kłoczko <[email protected]>
  • Loading branch information
kloczek authored Aug 20, 2024
1 parent 52ea87a commit f54d517
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ extend-select = [
extend-ignore = ["B018", "B019"]
exclude = ["tests/fixtures"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["unearth"]

[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion src/unearth/fetchers/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def send(self, request: PreparedRequest, *args: Any, **kwargs: Any) -> Response:
# to return a better error message:
resp.status_code = 404
resp.reason = type(exc).__name__
resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode("utf8"))
resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode())
else:
modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
content_type = mimetypes.guess_type(path)[0] or "text/plain"
Expand Down
4 changes: 2 additions & 2 deletions src/unearth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def add_ssh_scheme_to_git_uri(uri: str) -> str:
parsed = parse.urlparse(uri)
if ":" in parsed.netloc:
netloc, _, path_start = parsed.netloc.rpartition(":")
path = "/{0}{1}".format(path_start, parsed.path)
path = f"/{path_start}{parsed.path}"
uri = parse.urlunparse(parsed._replace(netloc=netloc, path=path))
return uri

Expand Down Expand Up @@ -227,7 +227,7 @@ def __getitem__(self, index: int) -> T: # type: ignore[override]
_legacy_specifier_re = re.compile(r"(==|!=|<=|>=|<|>)(\s*)([^,;\s)]*)")


@functools.lru_cache()
@functools.lru_cache
def fix_legacy_specifier(specifier: str) -> str:
"""Since packaging 22.0, legacy specifiers like '>=4.*' are no longer
supported. We try to normalize them to the new format.
Expand Down
2 changes: 1 addition & 1 deletion src/unearth/vcs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def make_auth_args(

class VcsSupport:
def __init__(self) -> None:
self._registry: dict[str, Type[VersionControl]] = {}
self._registry: dict[str, type[VersionControl]] = {}

def register(self, vcs: _V) -> _V:
self._registry[vcs.name] = vcs
Expand Down

0 comments on commit f54d517

Please sign in to comment.