aside.resources module¶
Manages the package resource files.
- root: importlib_resources.abc.Traversable¶
The root traversable resource location.
See
importlib_resourcesandimportlib.resourcesfor more information.
- str_replace_swap(string: str, this: str, that: str) → str[source]¶
Replace all
thisandthattokens in thestring, swapping them.
- find_resource(name: str, interpolated: bool) → importlib_resources.abc.Traversable[source]¶
Find the resource location given the resource name.
See
get_resourcefor more info.
- load_resource(path: importlib_resources.abc.Traversable, do_interpolate: bool) → str[source]¶
Load the resource contents given the traversable resource path.
See
get_resourcefor more info.
- get_resource(name: str, interpolated: bool = True) → str[source]¶
Find and load the resource given its name.
This function also takes into account interpolatable resource overrides.
Interpolatable resources are resource files which have an extra
.intfile extension. After loading an interpolatable resource, all strings of the form{{config.something}}and{{theme.other}}are interpolated with the values from the currentaside.config.configandaside.theme.theme.- Parameters
name – The name of the resource to load.
interpolated – Whether to search for interpolatable resources.
- Returns
The loaded resource contents.
- get_svg(name: str) → bytes[source]¶
Find and load an svg resource specified by
name.- Parameters
name – The name of the svg resource without the file extension.
- Returns
The contents of the resource, suitable to be loaded with
loadFromData.