From 66576b10d46bfafddb5016a7d605dd24469f6902 Mon Sep 17 00:00:00 2001 From: Pol Febrer Date: Wed, 8 Mar 2023 12:37:10 +0100 Subject: [PATCH] mnt: renamed main nodes context --- sisl/nodes/__init__.py | 2 +- sisl/nodes/context.py | 4 ++-- sisl/nodes/node.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sisl/nodes/__init__.py b/sisl/nodes/__init__.py index 1a81a4e0b0..ef7382c0e5 100644 --- a/sisl/nodes/__init__.py +++ b/sisl/nodes/__init__.py @@ -1,3 +1,3 @@ from .node import Node from .workflow import Workflow -from .context import NodeContext, MAIN_CONTEXT, temporal_context \ No newline at end of file +from .context import NodeContext, SISL_NODES_CONTEXT, temporal_context \ No newline at end of file diff --git a/sisl/nodes/context.py b/sisl/nodes/context.py index 5e1fa729ec..ac0295b3e5 100644 --- a/sisl/nodes/context.py +++ b/sisl/nodes/context.py @@ -3,7 +3,7 @@ from typing import Any, Union # The main sisl nodes context that all nodes will use by default as their base. -MAIN_CONTEXT = dict( +SISL_NODES_CONTEXT = dict( # Whether the nodes should compute lazily or immediately when inputs are updated. lazy=True, # On initialization, should the node compute? If None, defaults to `lazy`. @@ -52,7 +52,7 @@ def temporal_context(context: Union[dict, ChainMap, None] = None, **context_keys ---------- context: dict or ChainMap, optional The context that should be updated temporarily. This could for example be - sisl's MAIN_CONTEXT or the context of a specific node class. + sisl's main context or the context of a specific node class. If None, the keys and values are forced on all nodes. **context_keys: Any diff --git a/sisl/nodes/node.py b/sisl/nodes/node.py index a8da82cea7..3d585ea098 100644 --- a/sisl/nodes/node.py +++ b/sisl/nodes/node.py @@ -7,7 +7,7 @@ from numpy.lib.mixins import NDArrayOperatorsMixin from sisl.messages import SislError, info -from .context import NodeContext, MAIN_CONTEXT +from .context import NodeContext, SISL_NODES_CONTEXT class NodeError(SislError): def __init__(self, node, error): @@ -59,7 +59,7 @@ class Node(NDArrayOperatorsMixin): # Variable containing settings regarding how the node must behave. # As an example, the context contains whether a node should be lazily computed or not. _cls_context: Dict[str, Any] - context: NodeContext = NodeContext({}, MAIN_CONTEXT) + context: NodeContext = NodeContext({}, SISL_NODES_CONTEXT) # Keys for variadic arguments, if present. _args_inputs_key: Optional[str] = None @@ -132,7 +132,7 @@ def __init_subclass__(cls): if not hasattr(cls, "_cls_context") or cls._cls_context is None: cls._cls_context = {} - cls.context = NodeContext(cls._cls_context, *base_contexts, MAIN_CONTEXT) + cls.context = NodeContext(cls._cls_context, *base_contexts, SISL_NODES_CONTEXT) # Initialize the dictionary that stores the functions that have been converted to this kind of node cls._known_function_nodes = {}