bexchange.naming package¶
Submodules¶
bexchange.naming.namer module¶
- class bexchange.naming.namer.metadata_namer(tmpl)[source]¶
Bases:
object
Creates names from metadata
- get_attribute_value(name, meta)[source]¶
- Parameters:
name – the name of the attribute
meta – the meta data
- Returns:
the value if possible
- Throws LookupError:
if name not could be found
- get_property(name)[source]¶
Returns the property with specified name. :param name: the name of the property :return the property if found, otherwise an empty string
- name(meta)[source]¶
- Parameters:
meta – the metadata to create the name from
- Returns:
the created string
- register_operation(tag, operation)[source]¶
Registers a namer operation :param tag: the identifier used in the name template :param operation: a metadata_namer_operation instance
- class bexchange.naming.namer.metadata_namer_operation(tag, backend, arguments={})[source]¶
Bases:
object
Provides possibility to add custom namer operations
- create(placeholder, meta)[source]¶
Whenever a registered place holder is found, this method will be called with the current metadata. If it is possible to create the place holder string it is returned, otherwise the placeholder is returned. :param placeholder: the string that was found :param meta: the metadata :return: the string that the placeholder should be replaced with
- class bexchange.naming.namer.opera_filename_namer(tag, backend, arguments={})[source]¶
Bases:
metadata_namer_operation
filename operation that implements support for the OPERA naming convention
- create(placeholder, meta)[source]¶
Atempts to create a opera filename from the metadata. The created name will be in the format T_{T1}{T2}{A1}{A2}{ii}_C_{CCCC}_{yyyyMMddhhmmss}.h5 Where {T1}{T2} = PA {A1} G-Z depending on content of file {A2} A-Z depending on content of file {ii} the last 2 digits in the RAD identifier. {CCCC} - the CCCC {yyyyMMddhhmmss} - the date time from the file.
- Parameters:
placeholder – the placeholder
meta – the metadata
:return the string to replace the placeholder with if possible
- class bexchange.naming.namer.property_metadata_namer(tmpl)[source]¶
Bases:
metadata_namer
Creates names from metadata
- class bexchange.naming.namer.suboperation_helper(value, suboperations)[source]¶
Bases:
object
Used to simplify suboperation execution in a name pattern. Each suboperation is implemented as a method in this function and called by eval upon execution
- interval_l(interval)[source]¶
Assumes that the 2 last characters in eval value is a integer, (00, 01, 10…). Then this value is modified to lower part of that interval. For example assuming that it is minutes that are evaluated and interval = 15 and limit = 60. Then the following modification will be performed. 00-14 => 00 15-29 => 15 30-44 => 30 45-59 => 45. :param interval: Interval
- interval_u(interval, limit=60)[source]¶
Assumes that the 2 last characters in eval value is a integer, (00, 01, 10…). Then this value is modified to upper part of that interval. For example assuming that it is minutes that are evaluated and interval = 15 and limit = 60. Then the following modification will be performed. 00-14 => 15 15-29 => 30 30-44 => 45 45-59 => 00. Since limit is 60, the value will be put back to 0 :param interval: Interval :param limit: Limit for a wrap around
- replace(c1, c2)[source]¶
Replace one string with a different one :param c1: string to replace :param c2: string to replace with :return the string that has been modified
- substring(start, end=None)[source]¶
Returns a substring between start & end. :param start: The start position :param end: End position (if specified, otherwise rest of string) :return the substring
- tolower(start=None, end=None)[source]¶
Changes to lower case between start and end position. If start and end is given, then a subset is changed. :param start: Start position :param end: End position :return new value