Skip to content

Commit

Permalink
mnt: renamed main nodes context
Browse files Browse the repository at this point in the history
  • Loading branch information
pfebrer committed Mar 8, 2023
1 parent 6667362 commit 66576b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sisl/nodes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .node import Node
from .workflow import Workflow
from .context import NodeContext, MAIN_CONTEXT, temporal_context
from .context import NodeContext, SISL_NODES_CONTEXT, temporal_context
4 changes: 2 additions & 2 deletions sisl/nodes/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sisl/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 66576b1

Please sign in to comment.