phystool.tags
Module Contents
Classes
This class allows to tag |
Data
API
- phystool.tags.logger
“getLogger(…)”
- class phystool.tags.Tags(tags: dict[str, list[str]])
This class allows to tag
PDBFileswith user defined tags sorted by custom categories.- Warning:
Directly creating an instance without using Tags.validate could lead to unwanted tags.
- Paramètres:
tags – tags sorted by category
Initialization
- TAGS: ClassVar[phystool.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.
- Paramètres:
list_of_tags – string of comma separated words
- Renvoie:
a Tags instance with only valid tags
- classmethod load() → None
Load the static variable
Tags.TAGSfrom the fileconfig.TAGS_PATHthat contains all valid tags. If the file does not exist, it will be recreated by callingTags.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_PATHso that it can be easily reloaded by callingTags.load()
- classmethod create_new_tag(category: str, tag: str) → None
Create a new tag and add it to
Tags.TAGS- Paramètres:
category – the category of the tag
tag – name of the tag
- list_tags() → None
Prints each tag on a different line.
- with_overlap(other: Self) → bool
Returns
Falsefor the first category where there isn’t any shared tag between this instance and the other instance, otherwise, returnsTrue- Warning:
Returns
Falseif, for any category, either set or the two sets are empty (should not happen).
- without_overlap(other: Self) → bool
Returns
Falsefor the first category where there is at least one shared tag between this instance and the other instance, otherwise, returnsTrue- Warning:
Doesn’t necessarily return
Trueif, for a given category, either set or the two sets are empty (should not happen).