pycolorbar.utils package#

Submodules#

pycolorbar.utils.directories module#

Directory utility functions.

pycolorbar.utils.directories.list_files(dir_path, glob_pattern, recursive=False)[source]#

Return a list of filepaths (exclude directory paths).

pycolorbar.utils.directories.list_paths(dir_path, glob_pattern, recursive=False)[source]#

Return a list of filepaths and directory paths.

pycolorbar.utils.directories.remove_file_if_exists(filepath, force=False)[source]#

Remove a file if exists.

Raise an error if the filepath is an existing directory.

pycolorbar.utils.mpl module#

Matplotlib utility functions.

pycolorbar.utils.mpl.get_mpl_colormaps()[source]#

Get the list of available colormaps in matplotlib.

pycolorbar.utils.mpl.get_mpl_named_colors()[source]#

Retrieves the list of valid named colors available in matplotlib.

Returns

An array of valid named colors.

Return type

np.ndarray

Notes

This function combines colors from TABLEAU_COLORS, BASE_COLORS, CSS4_COLORS, and XKCD_COLORS in matplotlib.

pycolorbar.utils.yaml module#

YAML utility.

pycolorbar.utils.yaml.list_yaml_files(directory)[source]#

List all YAML files in a directory.

pycolorbar.utils.yaml.read_yaml(filepath: str) dict[source]#

Read a YAML file into a dictionary.

Parameters

filepath (str) – Input YAML file path.

Returns

Dictionary with the attributes read from the YAML file.

Return type

dict

pycolorbar.utils.yaml.write_yaml(dictionary, filepath, sort_keys=False)[source]#

Write a dictionary into a YAML file.

Parameters

dictionary (dict) – Dictionary to write into a YAML file.

Module contents#