aside.resources module

Manages the package resource files.

root: importlib_resources.abc.Traversable

The root traversable resource location.

See importlib_resources and importlib.resources for more information.

str_replace_swap(string: str, this: str, that: str)str[source]

Replace all this and that tokens in the string, swapping them.

find_resource(name: str, interpolated: bool)importlib_resources.abc.Traversable[source]

Find the resource location given the resource name.

See get_resource for 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_resource for 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 .int file extension. After loading an interpolatable resource, all strings of the form {{config.something}} and {{theme.other}} are interpolated with the values from the current aside.config.config and aside.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.