Tag Interface

class pytools.tag.Taggable(tags=frozenset({}))[source]

Parent class for objects with a tags attribute.

tags

A frozenset of Tag instances

copy()[source]
tagged()[source]
without_tags()[source]

New in version 2021.1.

class pytools.tag.Tag[source]

Generic metadata, applied to, among other things, pytato Arrays.

tag_name

A fully qualified DottedName that reflects the class name of the tag.

Instances of this type must be immutable, hashable, picklable, and have a reasonably concise __repr__() of the form dotted.name(attr1=value1, attr2=value2). Positional arguments are not allowed.

__repr__()

Return repr(self).

class pytools.tag.UniqueTag[source]

A superclass for tags that are unique on each Taggable.

Each instance of Taggable may have no more than one instance of each subclass of UniqueTag in its set of tags. Multiple UniqueTag instances of different (immediate) subclasses are allowed.

Supporting Functionality

class pytools.tag.DottedName(name_parts)[source]
name_parts

A tuple of strings, each of which is a valid Python identifier. No name part may start with a double underscore.

The name (at least morally) exists in the name space defined by the Python module system. It need not necessarily identify an importable object.

classmethod from_class(argcls)[source]
Parameters

argcls (Any) –

Return type

pytools.tag.DottedName

class pytools.tag.NonUniqueTagError[source]

Raised when a Taggable object is instantiated with more than one UniqueTag instances of the same subclass in its set of tags.