ewokscore.persistence.file.FileProxy#

class ewokscore.persistence.file.FileProxy(uri=None, root_uri=None, relative_uri=None, uhash_source=None)[source]#

Bases: DataProxy

Example root URI’s: * “file://path/to/directory” * “file://path/to/name.ext” * “file://path/to/name.ext?path=/path/in/file

Parameters:
ALLOW_PATH_IN_FILE = NotImplemented#

Does format allow path inside files. Expected to be a boolean

EXTENSIONS = NotImplemented#

Valid file extensions. Expected to be an iterable

SCHEME = NotImplemented#

name of the DataProxy scheme like json or nexus

SEP_IN_FILE = '/'#

Separator used inside files. Expected to be a string

classmethod class_registry_name()#
Return type:

Optional[str]

classmethod deserialize(data)#
Parameters:

data (Dict[str, str])

dump(data, **kw)[source]#

Dump data to the uri

exists()[source]#

return True if the data exists

Return type:

bool

classmethod get_subclass(registry_name, _second_attempt=False)#

Retrieving a derived class

classmethod get_subclass_names()#
Return type:

List[str]

classmethod get_subclasses()#
property identifier: str | None#

Return identifier DataProxy to be used as a string

classmethod instantiate(scheme=None, uri=None, uhash_source=None, root_uri=None, relative_uri=None)#
Parameters:
  • scheme (Optional[str])

  • uri (Optional[DataUri])

  • uhash_source (Union[UniversalHash, HasUhash, None])

  • root_uri (Optional[str])

  • relative_uri (Optional[str])

property is_fixed_uri: bool#
load(raise_error=True, **kw)[source]#

Load data from the uri

property parsed_root_uri: ParseResult | None#
property path: Path | None#

return ‘path’ from the following URI representation: URI = scheme “:” “//” path [“?” query] [“#” fragment]

property path_in_file: str | None#

return ‘data path query’ result for data at “file://path/to/name.ext?path=/path/in/file” return “path/in/file”

property path_in_file_name: str | None#

Return ‘data path query’ last part for data at “file://path/to/name.ext?path=/path/in/file” return “file”

property path_in_file_parent: str | None#

return ‘data path query’ result for data at “file://path/to/name.ext?path=/path/in/file” return “path/in”

path_in_file_parts()[source]#

Return list of ‘path’ query parts as a LIST WITHOUT the root

Return type:

Optional[List[str]]

property root_uri_query: dict#
serialize()#
Return type:

Dict[str, str]

property uhash: UniversalHash | None#
property uri: DataUri | None#

Return an Unified Resource Identifier. Defined as: URI = scheme “:” “//” path [“?” query] [“#” fragment]

see https://en.wikipedia.org/wiki/Uniform_Resource_Identifier

Warning

query can be ?path= which is different from path