esrf_pathlib._schemas.fields.path#
Classes
|
Class for matching, parsing, and rendering paths from segment templates. |
- class esrf_pathlib._schemas.fields.path.PathTemplate(name, schema_identifier, segments, concepts)[source]#
Bases:
FieldClass for matching, parsing, and rendering paths from segment templates.
- Parameters:
name (
str)schema_identifier (
SchemaIdentifier)segments (
List[SegmentTemplate])concepts (
Dict[str,PathConcept])
- contains_optionals(concept_values)[source]#
- Parameters:
concept_values (
Dict[str,Union[str,date,DataType,TomoResultType,None]])- Return type:
bool
- parse(path)[source]#
Match and convert a path to a dictionary of path concept values.
- Raises:
- Parameters:
path (
str)- Return type:
Dict[str,Union[str,date,DataType,TomoResultType,None]]
- parse_with_score(path)[source]#
Returns an empty tuple if it does not match. If it does match it returns the concept values and the match score.
- Parameters:
path (
str)- Return type:
Tuple[Optional[Dict[str,Union[str,date,DataType,TomoResultType,None]]],Tuple[int,...]]
- remove_optionals(concept_values)[source]#
- Parameters:
concept_values (
Dict[str,Union[str,date,DataType,TomoResultType,None]])- Return type:
Dict[str,Union[str,date,DataType,TomoResultType,None]]
- render(concept_values, raise_on_missing=True, raise_on_mismatch=True)[source]#
Convert a dictionary of path concept values to a path.
- Raises:
- Parameters:
concept_values (
Dict[str,Union[str,date,DataType,TomoResultType,None]])raise_on_missing (
bool)raise_on_mismatch (
bool)
- Return type:
str
- render_score(concept_values)[source]#
Returns an empty tuple if it does not match. If it does match it returns the match score.
- Parameters:
concept_values (
Dict[str,Union[str,date,DataType,TomoResultType,None]])- Return type:
Tuple[int,...]
- strip_mount_point(concept_values)[source]#
Strip all segments from the root concept before a specific marker segment.
- Parameters:
concept_values (
Dict[str,Union[str,date,DataType,TomoResultType,None]])- Return type:
Dict[str,Union[str,date,DataType,TomoResultType,None]]
- property docstring: str#
- property required_concept_names: List[str]#