The tag Module

class moments.tag.Tags(tags=[])[source]

tags are typically just stored as a list of strings strings can have alphanumeric characters in them and the underscore (‘_’)

individual tags should not have spaces

this class collects methods to help convert to and from different formats of expressing tag collections

from_tag_string(tag_string)[source]

a tag string is a string of tags separated by a ‘-‘ easy to split with python, but for a consistent interface using this

omit(tags=[])[source]

remove tags from current set of tags if they exist

to_tag_string()[source]

take a list of tags, and return the corresponding tag string tag1-tag2

union(tag_list)[source]

take the list of tags supplied and add any tags that we don’t have

moments.tag.from_tag(item)[source]

*doesn’t work well in practice*

take any tag and attempt to make it more human readable

should just keep them as tags usually

moments.tag.to_tag(item)[source]

take any string and convert it to an acceptable tag

tags should not contain spaces or special characters numbers, lowercase letters only underscores can be used, but they will be converted to spaces in some cases

This Page