Skip to content

PackageName#

PackageName #

normalized: str property #

Returns the normalized version of the package name. The normalized string is guaranteed to be a valid conda package name.

Examples#
>>> p = PackageName("test-xyz")
>>> p.normalized
'test-xyz'
>>>

source: str property #

Returns the source representation of the package name. This is the string from which this instance was created.

Examples#
>>> p = PackageName("test-xyz")
>>> p.source
'test-xyz'
>>>

__eq__(other) #

Returns True if this instance represents the same PackageName as other.

Examples#
>>> PackageName("test-abc") == PackageName("abc-test")
False
>>> PackageName("test-abc") == PackageName("test-abc")
True
>>> PackageName("test-abc") == PackageName("test-ABC")
True
>>> PackageName("test-abc") == "test-abc"
True
>>> PackageName("test-abc") == "not-test-abc"
False
>>>

__hash__() #

Computes the hash of this instance.

Examples#
>>> hash(PackageName("test-abc")) == hash(PackageName("test-abc"))
True
>>> hash(PackageName("test-abc")) == hash(PackageName("test-ABC"))
True
>>> hash(PackageName("test-abc")) == hash(PackageName("abc-test"))
False
>>>

__ne__(other) #

Returns True if this instance does not represents the same PackageName as other.

Examples#
>>> PackageName("test-abc") != PackageName("test-abc")
False
>>> PackageName("test-abc") != PackageName("test-ABC")
False
>>> PackageName("test-abc") != PackageName("abc-test")
True
>>> PackageName("test-abc") != "test-abc"
False
>>> PackageName("test-abc") != "not-test-abc"
True
>>>

__repr__() #

Returns a representation of the PackageName.

Examples#
>>> p = PackageName("test-xyz")
>>> p
PackageName("test-xyz")
>>>

unchecked(normalized) staticmethod #

Constructs a new PackageName from a string without checking if the string is actually a valid or normalized conda package name. This should only be used if you are sure that the input string is valid.

Examples#
>>> p = PackageName.unchecked("test_xyz")
>>>