Naming Module¶
-
vfxnaming.naming.
get_repo
() Get repository location from either global environment variable or local user, giving priority to environment variable.
Environment varialble name: NAMING_REPO
- Returns:
- str: Naming repository location
-
vfxnaming.naming.
load_session
(repo=None) Load rules, tokens and config from a repository, and create Python objects in memory to work with them.
- Args:
- repo (str, optional): Absolute path to a repository. Defaults to None.
- Returns:
- bool: True if loading session operation was successful.
-
vfxnaming.naming.
parse
(name) Get metadata from a name string recognized by the currently active rule.
-For rules with repeated tokens:
If your rule uses the same token more than once, the returned dictionary keys will have the token name and an incremental digit next to them so they can be differentiated.
- Args:
- name (str): Name string e.g.: C_helmet_001_MSH
- Returns:
- dict: A dictionary with keys as tokens and values as given name parts. e.g.: {‘side’:’C’, ‘part’:’helmet’, ‘number’: 1, ‘type’:’MSH’}
-
vfxnaming.naming.
save_session
(repo=None) Save rules, tokens and config files to the repository.
- Raises:
- IOError, OSError: Repository directory could not be created.
- Args:
- repo (str, optional): Absolue path to a repository. Defaults to None.
- Returns:
- bool: True if saving session operation was successful.
-
vfxnaming.naming.
solve
(*args, **kwargs) Given arguments are used to build a name following currently active rule.
-For rules with repeated tokens:
If your rule uses the same token more than once, pass arguments with the token name and add an incremental digit
i.e.: side1=’C’, side2=’R’
If your rule uses the same token more than once, you can also pass a single instance of the argument and it’ll be applied to all repetitions.
i.e.: side=’C’
If your rule uses the same token more than once, you can ignore one of the repetitions, and the solver will use the default value for that token.
i.e.: side1=’C’, side4=’L’
- Raises:
- SolvingError: A required token was passed as None to keyword arguments. SolvingError: Missing argument for one field in currently active rule.
- Returns:
- str: A string with the resulting name.