nomenclate.core.nomenclature module¶
- class nomenclate.core.nomenclature.Nomenclate(input_dict: Optional[dict] = None, format_string: str = '', *args, **kwargs)[source]
Bases:
nomenclate.core.tools.Serializable
This class deals with renaming of objects in an approved pattern
- CFG = <nomenclate.core.configurator.ConfigParse object>
- CONFIG_OPTIONS = {'anatomy_len': 3, 'date_format': '%Y-%m-%d', 'depth_len': 1, 'discipline_len': 4, 'height_len': 1, 'location_len': 2, 'purpose_len': 4, 'side_len': 1, 'type_len': 3, 'var_format': 'upper', 'version_padding': 3}
- CONFIG_ROOT = ['overall_config']
- DEFAULT_FORMAT_PATH = ['naming_formats', 'node', 'default']
- NAMING_FORMAT_PATH = ['naming_formats']
- OPTIONS_PATH = ['options']
- SERIALIZE_ATTRS = ['format_string_object', 'token_dict']
- SIDE_PATH = ['options', 'side']
- SUFFIXES_PATH = ['suffixes']
- anatomy_len = 3
- date_format = '%Y-%m-%d'
- depth_len = 1
- discipline_len = 4
- property empty_tokens
- property format
- property format_order
- from_json(json_blob)[source]
- get(**kwargs)[source]
Gets the string of the current name of the object Returns (string): the name of the object
- classmethod get_token_settings(token, default=None)[source]
Get the value for a specific token as a dictionary or replace with default
- Parameters
token – str, token to query the nomenclate for
default – object, substitution if the token is not found
- Returns
(dict, object, None), token setting dictionary or default
- height_len = 1
- initialize_format_options(format_target='')[source]
- First attempts to use format_target as a config path or gets the default format
if it’s invalid or is empty.
- Parameters
format_target – (str, list(str)), can be either a query path to a format or in format of a naming string the sections should be spaced around e.g. - this_is_a_naming_string
- Raises
IOError
- classmethod initialize_options()[source]
Stores options from the config file
- classmethod initialize_overall_config_settings(input_dict=None)[source]
- location_len = 2
- merge_dict(*args, **kwargs)[source]
Takes variable inputs, compiles them into a dictionary then merges it to the current nomenclate’s state
- Parameters
args – (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts
kwargs – str, any number of kwargs that represent token:value pairs
- merge_json(json_blob)[source]
- purpose_len = 4
- classmethod reset_from_config()[source]
- classmethod set_config(config_data: dict)[source]
Set the config file from a dictionary.
- side_len = 1
- property state
- to_json()[source]
- property tokens
- type_len = 3
- var_format = 'upper'
- version_padding = 3