File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
66class 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
Original file line number Diff line number Diff line change 33from pathlib import Path
44from sysconfig import get_config_var , get_platform
55
6+ from ._cached_version import CachedVersion
67from ._vendored .packaging .src .packaging .requirements import (
78 InvalidRequirement ,
89 Requirement ,
1819 parse_wheel_filename as parse_wheel_filename_orig ,
1920)
2021from ._vendored .packaging .src .packaging .version import InvalidVersion , Version
21- from ._cached_version import CachedVersion
2222
2323
2424def get_dist_info (dist : Distribution ) -> Path :
You can’t perform that action at this time.
0 commit comments