tags

Module Contents

Classes

Tags

This class allows to tag PDBFiles with user defined tags sorted by custom categories.

Data

logger

API

tags.logger = 'getLogger(...)'
class tags.Tags(tags: dict[str, list[str]])

This class allows to tag PDBFiles with user defined tags sorted by custom categories.

Warning:

Directly creating an instance without using Tags.validate could lead to unwanted tags.

Parameters:

tags – tags sorted by category

Initialization

TAGS: ClassVar[tags.Tags] = None
classmethod validate(list_of_tags: str) Self

Converts a string of comma separated words into a valid Tags instance.

The string is split after each comma. If the words in the resulting list are valid tags, they will be sorted by category.

Parameters:

list_of_tags – string of comma separated words

Returns:

a Tags instance with only valid tags

classmethod load() None

Load the static variable Tags.TAGS from the file config.TAGS_PATH that contains all valid tags. If the file does not exist, it will be recreated by calling Tags.reset_all_tags()

classmethod save() None
classmethod reset_all_tags() None

Read all “.json” metadata files to extract all tags and save the result in config.TAGS_PATH so that it can be easily reloaded by calling Tags.load()

classmethod create_new_tag(category: str, tag: str) None
list_tags() None
with_overlap(other: Self) bool

Returns False for the first category where there isn’t any shared tag between this instance and the other instance, otherwise, returns True

Warning:

Returns False if, for a given category, either set or the two sets are empty (this should not happen)

without_overlap(other: Self) bool

Returns False for the first category where there is at least one shared tag between this instance and the other instance, otherwise, returns True

Warning:

Doesn’t necessarily return True if, for a given category, either set or the two sets are empty (this should not happen).