dantro
v0.13.1
  • Usage Examples
  • Philosophy and Design Concepts
  • Specializing dantro Classes
  • Integrating dantro into your Project

Data Handling and Transformation

  • The DataManager
  • Data Processing
  • Data Transformation Framework
  • Handling Large Amounts of Data
  • Multidimensional Data
  • DAG Syntax Operation Hooks
  • Data Transformation Examples
  • Data Handling FAQs

Data Structures

  • Groups

Plotting

  • The PlotManager
  • Plot Creators
  • Automated Plot Data Selection
  • Plot Functions
  • Plot Configuration Reference
  • Plot Creator Auto Detection
  • Plotting FAQs

API Reference

  • dantro API Reference
    • Subpackages
      • dantro.containers package
      • dantro.data_loaders package
      • dantro.groups package
      • dantro.mixins package
      • dantro.plot_creators package
      • dantro.proxy package
      • dantro.utils package
        • Submodules
    • Submodules
dantro
  • Docs »
  • dantro package »
  • dantro.utils package »
  • dantro.utils.link module
  • View page source

dantro.utils.link module¶

Implements the Link class

class dantro.utils.link.Link(*, anchor: TGroupOrContainer, rel_path: str)[source]¶

Bases: dantro.mixins.general.ForwardAttrsMixin

A link is a connection between two objects in the data tree, i.e. a data group and a data container.

It has a source object that it is coupled to and a relative path from that object to the target object.

Whenever attribute access occurs, an object of this class will resolve the linked object (if not already cached) and then forward the attribute call to that object.

FORWARD_ATTR_TO = 'target_object'¶
__init__(*, anchor: TGroupOrContainer, rel_path: str)[source]¶

Initialize a link from an anchor and a relative path to a target

property target_weakref¶

Resolve the target and return the weak reference to it

property target_object¶

Return a (non-weak) reference to the actual target object

property anchor_weakref¶

Resolve the weak reference to the anchor and return it, i.e.: return a reference to the actual object.

property anchor_object¶

Return a (non-weak) reference to the anchor object

property target_rel_path¶

Returns the relative path to the target

_forward_attr_get_forwarding_target()[source]¶

Get the object that the attribute call is to be forwarded to, i.e. the resolved target object. This invokes resolution of the target and caching of the corresponding weakref, but the returned (strong) ref will not be cached.

FORWARD_ATTR_EXCLUDE = ()¶
FORWARD_ATTR_ONLY = None¶
_Link__resolve_target_ref() → None¶

Resolves the weak reference to the target object and caches it

__getattr__(attr_name: str)¶

Forward attributes that were not available in this class to some other attribute of the group or container.

Parameters

attr_name (str) – The name of the attribute that was tried to be accessed but was not available in self.

Returns

The attribute attr_name of getattr(self, self.FORWARD_ATTR_TO)

_forward_attr_post_hook(attr)¶

Invoked before attribute forwarding occurs

_forward_attr_pre_hook(attr_name: str = None)¶

Invoked before attribute forwarding occurs

Next Previous

© Copyright 2020, Utopia Developers Revision 720291e2.

Built with Sphinx using a theme provided by Read the Docs.