ewokscore.persistence.json.JsonProxy#

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

Bases: FileProxy

Parameters:
  • uri (Optional[DataUri]) –

  • root_uri (Optional[str]) –

  • relative_uri (Optional[str]) –

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

ALLOW_PATH_IN_FILE = False#

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

EXTENSIONS = ['.json']#

Valid file extensions. Expected to be an iterable

SCHEME = 'json'#

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)#

Dump data to the uri

exists()#

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)#

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()#

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