FileLoc#
- pydantic model tollan.utils.fileloc.FileLoc[source]#
A model to hold file location info.
This is a simple wrapper around
FileLocData.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Show JSON schema
{ "title": "FileLoc", "description": "A model to hold file location info.\n\nThis is a simple wrapper around ``FileLocData``.", "$defs": { "FileLocData": { "description": "A helper model for storing file loc data.", "properties": { "url": { "anyOf": [ { "format": "uri", "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "title": "Url" }, "path": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "title": "Path" }, "netloc": { "default": "", "title": "Netloc", "type": "string" }, "local_parent_path": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "title": "Local Parent Path" }, "remote_parent_path": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "title": "Remote Parent Path" } }, "title": "FileLocData", "type": "object" } }, "$ref": "#/$defs/FileLocData" }
- Fields:
- as_rsync_arg() str[source]#
Return a string suitable to use as rsync argument.
- Returns:
Rsync-compatible path string (local path or ‘host:path’)
- Return type:
- exists() bool[source]#
Check if file is local and exists.
- Returns:
True if file is local and exists on filesystem
- Return type:
- is_local() bool[source]#
Return True if file is local.
- Returns:
True if file is on localhost
- Return type:
- is_remote() bool[source]#
Return True if file is remote.
- Returns:
True if file is on a remote host
- Return type:
- property path_orig: Path | None#
The original unresolved path.
- Returns:
Original path before resolution, or None if not set
- Return type:
Path | None