yieldplotlib.core#

Core module of yieldplotlib.

Submodules#

Classes#

DirectoryNode

Represents a directory containing multiple nodes (files or subdirectories).

CSVFile

Represents a CSV file and its associated data.

FileNode

A generic node for handling files.

JSONFile

Node for handling JSON files and their associated data.

PickleFile

Node for handling generic pickle files and their associated data.

Node

Abstract base class for all nodes (files and directories).

Package Contents#

class yieldplotlib.core.DirectoryNode(directory_path)[source]#

Bases: yieldplotlib.core.node.Node

Represents a directory containing multiple nodes (files or subdirectories).

Parameters:

directory_path (pathlib.Path)

directory_path#
directory_name#
_children = []#
load()[source]#

Recursively scan directories and load all child nodes.

add(node)[source]#

Add a child node to the directory.

Parameters:

node (yieldplotlib.core.node.Node)

get(key, **kwargs)[source]#

Recursively search for data associated with the given key.

Parameters:

key (str)

display_tree(level=0, max_children=5, prefix='')[source]#

Recursively display the tree structure.

Args:
level (int):

The current level of the tree.

max_children (int):

The maximum number of children to display.

prefix (str):

The prefix to display at the current level.

_create_directory_node(path)[source]#

Create a directory node for the given path.

Parameters:

path (pathlib.Path)

Return type:

yieldplotlib.core.node.Node

_create_file_node(path)[source]#

Create a file node for the given path.

Parameters:

path (pathlib.Path)

Return type:

yieldplotlib.core.node.Node

create_base_file(path)[source]#

Create a base file node for the given path.

Parameters:

path (pathlib.Path)

create_base_directory(path)[source]#

Create a directory node for the given path.

Parameters:

path (pathlib.Path)

class yieldplotlib.core.CSVFile(file_path)[source]#

Bases: FileNode

Represents a CSV file and its associated data.

Parameters:

file_path (pathlib.Path)

load()[source]#

Load the CSV file into memory.

_get(key, **kwargs)[source]#

Return the data associated with the key.

Parameters:

key (str)

class yieldplotlib.core.FileNode(file_path)[source]#

Bases: yieldplotlib.core.node.Node

A generic node for handling files.

Parameters:

file_path (pathlib.Path)

get_file_key_map()[source]#

Get a list of keys expected to be in this file based on the key map.

get(key, **kwargs)[source]#

Translate the key and delegate to the subclass-specific _get method.

Parameters:

key (str)

abstractmethod _get(translated_key, **kwargs)[source]#

Subclass-specific method to retrieve the data associated with the key.

Args:

translated_key: The key to look up in the data. **kwargs: Additional arguments that may be used by specific implementations.

Parameters:

translated_key (str)

transform_data(key, data, type_override=None, value_override=None, **kwargs)[source]#

Apply key-specific data transformations defined in the subclass.

Parameters:

key (str)

class yieldplotlib.core.JSONFile(file_path)[source]#

Bases: FileNode

Node for handling JSON files and their associated data.

Parameters:

file_path (pathlib.Path)

load()[source]#

Load the JSON file into memory.

_get(key, **kwargs)[source]#

Return the data associated with the key.

Parameters:

key (str)

class yieldplotlib.core.PickleFile(file_path)[source]#

Bases: FileNode

Node for handling generic pickle files and their associated data.

Parameters:

file_path (pathlib.Path)

load()[source]#

Load the pickle file into memory.

_get(key, **kwargs)[source]#

Return the data associated with the key.

Parameters:

key (str)

class yieldplotlib.core.Node(file_path)[source]#

Bases: abc.ABC

Abstract base class for all nodes (files and directories).

Parameters:

file_path (pathlib.Path)

data = None#
file_path#
file_name#
is_input = False#
abstractmethod load()[source]#

Load the file data or trigger recursive loading for directories.

abstractmethod get(key, **kwargs)[source]#

Abstract method to search for data associated with a key.

Parameters:

key (str)

has_key(key)[source]#

Abstract method to determine if the node contains the given key.

Parameters:

key (str)

Return type:

bool

__repr__()[source]#

Default representation for a DataNode.

display_tree(level=0, max_children=5, prefix='')[source]#

Default display method for a DataNode.