FileLocData#
- class tollan.utils.fileloc.FileLocData(url: None | FileLocUrl = None, path: None | Path = None, netloc: str = '', local_parent_path: None | Path = None, remote_parent_path: None | Path = None)[source]#
Bases:
objectA helper model for storing file loc data.
Attributes Summary
The unresolved data.
The resolved netloc.
The resolved path.
Ensure one of URL and path is given, and compute resolved URL.
Methods Summary
validate_arg(values, info)Return file loc data from any compatible input.
validate_netloc(v, info)Normalize netloc to string.
validate_path(v, info)Ensure path is Path instance.
Attributes Documentation
- data_unresolved#
The unresolved data.
- netloc_resolved[source]#
The resolved netloc.
- Returns:
Resolved network location (empty for localhost)
- Return type:
- url: None | Annotated[AnyUrl, UrlConstraints(max_length=None, allowed_schemes=['file', 'http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None, preserve_empty_path=None), BeforeValidator(func=_url_unquote, json_schema_input_type=PydanticUndefined)] = None#
- url_resolved[source]#
Ensure one of URL and path is given, and compute resolved URL.
- Returns:
Fully resolved file location URL
- Return type:
FileLocUrl
Methods Documentation
- classmethod validate_arg(values: ArgsKwargs | dict[str, Any], info: ValidationInfo) ArgsKwargs[source]#
Return file loc data from any compatible input.
Valid forms of inputs are: * dict contains keys
url,path,netloc; * tuple consists of(netloc, path); * str orPathinstance.