Tag class final
Tag
python docstring
A representation of the tag triple for a wheel.
Instances are considered immutable and thus are hashable. Equality checking is also supported.
python source
class Tag:
"""
A representation of the tag triple for a wheel.
Instances are considered immutable and thus are hashable. Equality checking
is also supported.
"""
__slots__ = ["_interpreter", "_abi", "_platform", "_hash"]
def __init__(self, interpreter: str, abi: str, platform: str) -> None:
self._interpreter = interpreter.lower()
self._abi = abi.lower()
self._platform = platform.lower()
# The __hash__ of every single element in a Set[Tag] will be evaluated each time
# that a set calls its `.disjoint()` method, which may be called hundreds of
# times when scanning a page of links for packages with tags matching that
# Set[Tag]. Pre-computing the value here produces significant speedups for
# downstream consumers.
self._hash = hash((self._interpreter, self._abi, self._platform))
@property
def interpreter(self) -> str:
return self._interpreter
@property
def abi(self) -> str:
return self._abi
@property
def platform(self) -> str:
return self._platform
def __eq__(self, other: object) -> bool:
if not isinstance(other, Tag):
return NotImplemented
return (
(self._hash == other._hash) # Short-circuit ASAP for perf reasons.
and (self._platform == other._platform)
and (self._abi == other._abi)
and (self._interpreter == other._interpreter)
)
def __hash__(self) -> int:
return self._hash
def __str__(self) -> str:
return f"{self._interpreter}-{self._abi}-{self._platform}"
def __repr__(self) -> str:
return f"<{self} @ {id(self)}>"
Constructors
Properties
- $platform ↔ Object?
-
platform (getter)
getter/setter pair
- abi ↔ Object?
-
abi (getter)
getter/setter pair
-
finalizer
→ Finalizer<
(PythonFfiDelegate< Object?> , Object?)> -
The finalizer for the python object.
Gets invoked when the object is no longer accessible to the program.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initializer
→ Initializer<
PythonFfiDelegate< Object?> , Object?> -
The initializer for the python object.
Gets invoked at the start of the constructor.
finalinherited
- interpreter ↔ Object?
-
interpreter (getter)
getter/setter pair
-
platform
→ PythonFfiDelegate<
Object?> -
Gets the platform that this object is associated with.
no setterinherited
- reference → Object?
-
Gets the reference to the python object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
debugDump(
) → void -
Dumps the python object to the console.
inherited
-
getAttribute<
T extends Object?> (String attributeName) → T -
Gets the attribute with the given name.
inherited
-
getAttributeOrNull<
T extends Object?> (String attributeName) → T? -
Gets the attribute with the given name or null if it does not exist.
inherited
-
getAttributeRaw<
T extends PythonObjectInterface< (PythonFfiDelegate< >Object?> , Object?>String attributeName) → T -
Gets the attribute with the given name.
inherited
-
getFunction(
String name) → PythonFunctionInterface< PythonFfiDelegate< Object?> , Object?> -
Gets the function with the given name.
inherited
-
getMethod(
String functionName) → PythonFunctionInterface< PythonFfiDelegate< Object?> , Object?> -
Gets a method from the class.
inherited
-
hasAttribute(
String attributeName) → bool -
Checks if the python object has the given attribute.
inherited
-
noSuchMethod(
Invocation invocation) → Object? -
Invoked when a nonexistent method or property is accessed.
inherited
-
setAttribute<
T extends Object?> (String attributeName, T value) → void -
Sets the attribute with the given name.
inherited
-
setAttributeRaw<
T extends PythonObjectInterface< (PythonFfiDelegate< >Object?> , Object?>String attributeName, T value) → void -
Sets the attribute with the given name.
inherited
-
toDartObject(
) → Object? -
Converts the python object to a Dart object.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited