File node.py
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""The ZnTrack Node class."""
from __future__ import annotations
import contextlib
Function save
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def save(
self, parameter: bool = True, results: bool = True, meta_only: bool = False
) -> None:
"""Save the node's output to disk."""
if meta_only:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_dvc_cmd
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_dvc_cmd(
Function from_rev
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_rev(
Function magic_patch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def magic_patch(self) -> typing.ContextManager:
"""Patch the open function to use the Node's file system.
Opening a relative path will use the Node's file system.
Opening an absolute path will use the local file system.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load(self, lazy: bool = None, results: bool = True) -> None:
"""Load the node's output from disk.
Attributes
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __set__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __set__(self, instance, value):
if value is None:
return
if isinstance(value, NodeName):
if not instance._external_:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"