yieldplotlib.core
=================

.. py:module:: yieldplotlib.core

.. autoapi-nested-parse::

   Core module of yieldplotlib.



Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/yieldplotlib/core/directory_node/index
   /autoapi/yieldplotlib/core/file_nodes/index
   /autoapi/yieldplotlib/core/node/index
   /autoapi/yieldplotlib/core/single_inputs/index


Classes
-------

.. autoapisummary::

   yieldplotlib.core.DirectoryNode
   yieldplotlib.core.CSVFile
   yieldplotlib.core.FileNode
   yieldplotlib.core.JSONFile
   yieldplotlib.core.PickleFile
   yieldplotlib.core.Node


Package Contents
----------------

.. py:class:: DirectoryNode(directory_path)

   Bases: :py:obj:`yieldplotlib.core.node.Node`


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


   .. py:attribute:: directory_path


   .. py:attribute:: directory_name


   .. py:attribute:: _children
      :value: []



   .. py:method:: load()

      Recursively scan directories and load all child nodes.



   .. py:method:: add(node)

      Add a child node to the directory.



   .. py:method:: get(key, **kwargs)

      Recursively search for data associated with the given key.



   .. py:method:: display_tree(level=0, max_children=5, prefix='')

      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.



   .. py:method:: _create_directory_node(path)

      Create a directory node for the given path.



   .. py:method:: _create_file_node(path)

      Create a file node for the given path.



   .. py:method:: create_base_file(path)

      Create a base file node for the given path.



   .. py:method:: create_base_directory(path)

      Create a directory node for the given path.



.. py:class:: CSVFile(file_path)

   Bases: :py:obj:`FileNode`


   Represents a CSV file and its associated data.


   .. py:method:: load()

      Load the CSV file into memory.



   .. py:method:: _get(key, **kwargs)

      Return the data associated with the key.



.. py:class:: FileNode(file_path)

   Bases: :py:obj:`yieldplotlib.core.node.Node`


   A generic node for handling files.


   .. py:method:: get_file_key_map()

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



   .. py:method:: get(key, **kwargs)

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



   .. py:method:: _get(translated_key, **kwargs)
      :abstractmethod:


      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.



   .. py:method:: transform_data(key, data, type_override=None, value_override=None, **kwargs)

      Apply key-specific data transformations defined in the subclass.



.. py:class:: JSONFile(file_path)

   Bases: :py:obj:`FileNode`


   Node for handling JSON files and their associated data.


   .. py:method:: load()

      Load the JSON file into memory.



   .. py:method:: _get(key, **kwargs)

      Return the data associated with the key.



.. py:class:: PickleFile(file_path)

   Bases: :py:obj:`FileNode`


   Node for handling generic pickle files and their associated data.


   .. py:method:: load()

      Load the pickle file into memory.



   .. py:method:: _get(key, **kwargs)

      Return the data associated with the key.



.. py:class:: Node(file_path)

   Bases: :py:obj:`abc.ABC`


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


   .. py:attribute:: data
      :value: None



   .. py:attribute:: file_path


   .. py:attribute:: file_name


   .. py:attribute:: is_input
      :value: False



   .. py:method:: load()
      :abstractmethod:


      Load the file data or trigger recursive loading for directories.



   .. py:method:: get(key, **kwargs)
      :abstractmethod:


      Abstract method to search for data associated with a key.



   .. py:method:: has_key(key)

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



   .. py:method:: __repr__()

      Default representation for a DataNode.



   .. py:method:: display_tree(level=0, max_children=5, prefix='')

      Default display method for a DataNode.



