Skip to content

Commit 51e5868

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5ab6dbf commit 51e5868

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

micropip/_cached_version.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
from ._vendored.packaging.src.packaging.version import Version, InvalidVersion
1+
from ._vendored.packaging.src.packaging.version import InvalidVersion, Version
22

33
__all__ = ["CachedVersion", "parse_cached_version", "InvalidVersion"]
44

55

66
class CachedVersion(Version):
7-
"""This class is a subclass of Version with cached hash and string representations for performance.
8-
"""
9-
10-
__slots__ = ('_cached_hash', '_cached_str')
11-
7+
"""This class is a subclass of Version with cached hash and string representations for performance."""
8+
9+
__slots__ = ("_cached_hash", "_cached_str")
10+
1211
def __init__(self, version: str) -> None:
1312
super().__init__(version)
14-
13+
1514
# Cache expensive computations
1615
self._cached_hash = hash(self._key)
1716
self._cached_str = super().__str__()
18-
17+
1918
def __hash__(self) -> int:
2019
return self._cached_hash
21-
20+
2221
def __str__(self) -> str:
2322
return self._cached_str
24-
23+
2524
def __repr__(self) -> str:
2625
"""A representation of the CachedVersion that shows all internal state.
2726

micropip/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
from sysconfig import get_config_var, get_platform
55

6+
from ._cached_version import CachedVersion
67
from ._vendored.packaging.src.packaging.requirements import (
78
InvalidRequirement,
89
Requirement,
@@ -18,7 +19,6 @@
1819
parse_wheel_filename as parse_wheel_filename_orig,
1920
)
2021
from ._vendored.packaging.src.packaging.version import InvalidVersion, Version
21-
from ._cached_version import CachedVersion
2222

2323

2424
def get_dist_info(dist: Distribution) -> Path:

0 commit comments

Comments
 (0)