API Documentation¶
-
class
fptokens.
TokenError
(message)[source]¶ Exception indicating an error related to Tokens, inherits from
ValueError
.
-
class
fptokens.
Filename
(root, folders=[], base=[], separator='_', extension='jpg', escape='$')[source]¶ Filenames with support for tokens.
Parameters: - root (str) – Root location
- folders (list of str) – Folder names, attribute supports tokens
- base (list of str) – Basename of the file, attribute supports tokens
- separator (str) – Separator for basename elements
- extension (str) – Filename extension
- escape (str) – Escape character for tokens, default:
$
-
parse
()[source]¶ Parse the filename’s
folders
andbase
attributes, detect components that match the token pattern and replace these withToken
objects.
-
resolve
(**kwargs)[source]¶ Given a set of **kwargs, yield all possible permutations for the data set provided. Raise
TokenError
ifFilename
does not haven tokens or the data provided does not match the tokens.Params **kwargs: Permutation data