Skip to content

Commit 78e4304

Browse files
committed
Merge branch 'dev'
2 parents abd0581 + d03fc10 commit 78e4304

31 files changed

+735
-481
lines changed

ngcsimlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from . import controller
33
from . import commands
44

5+
56
import argparse, os, json
67
from types import SimpleNamespace
78
from importlib import import_module

ngcsimlib/compartment.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
class Compartment:
88
"""
99
Compartments in ngcsimlib are container objects for storing the stateful
10-
values of components. Compartments are
11-
tracked globaly and are automatically linked to components and methods
12-
during compiling to allow for stateful
13-
mechanics to be run without the need for the class object. Compartments
14-
also provide an entry and exit point for
15-
values inside of components allowing for cables to be connected for
16-
sending and receiving values.
10+
values of components. Compartments are tracked globally and are
11+
automatically linked to components and methods during compiling to allow
12+
for stateful mechanics to be run without the need for the class object.
13+
Compartments also provide an entry and exit point for values inside of
14+
components allowing for cables to be connected for sending and receiving
15+
values.
1716
"""
1817

1918
@classmethod
@@ -31,19 +30,18 @@ def is_compartment(cls, obj):
3130
"""
3231
return hasattr(obj, "_is_compartment")
3332

34-
def __init__(self, initial_value=None, static=False, is_input=False, display_name=None, units=None):
33+
def __init__(self, initial_value=None, static=False, is_input=False,
34+
display_name=None, units=None):
3535
"""
3636
Builds a compartment to be used inside a component. It is important
37-
to note that building compartments
38-
outside of components may cause unexpected behavior as components
39-
interact with their compartments during
40-
construction to finish initializing them.
37+
to note that building compartments outside of components may cause
38+
unexpected behavior as components interact with their compartments
39+
during construction to finish initializing them.
4140
Args:
4241
initial_value: The initial value of the compartment. As a general
43-
practice it is a good idea to
44-
provide a value that is similar to the values that will
45-
normally be stored here, such as an array of
46-
zeros of the correct length. (default: None)
42+
practice it is a good idea to provide a value that is similar to
43+
the values that will normally be stored here, such as an array of
44+
zeros of the correct length. (default: None)
4745
4846
static: a flag to lock a compartment to be static (default: False)
4947
"""
@@ -105,10 +103,9 @@ def __str__(self):
105103
def __lshift__(self, other) -> None:
106104
"""
107105
Overrides the left shift operation to be used for wiring compartments
108-
into one another
109-
if other is not an Operation it will create an overwrite operation
110-
with other as the argument,
111-
otherwise it will use the provided operation
106+
into one another if other is not an Operation it will create an
107+
overwrite operation with other as the argument, otherwise it will use
108+
the provided operation
112109
113110
Args:
114111
other: Either another component or an instance of BaseOp
@@ -136,9 +133,9 @@ def is_wired(self):
136133

137134
@property
138135
def display_name(self):
139-
return self._display_name if self._display_name is not None else self.name
136+
return self._display_name if self._display_name is not None else (
137+
self.name)
140138

141139
@property
142140
def units(self):
143141
return self._units if self._units is not None else "dimensionless"
144-

ngcsimlib/compilers/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
from .command_compiler import compile_command, dynamic_compile, wrap_command
2-
from .component_compiler import compile as compile_component
3-
from .op_compiler import compile as compile_op
1+
from .legacy_compiler.command_compiler import compile_command, dynamic_compile
2+
from .utils import wrap_command, compose

ngcsimlib/compilers/command_compiler.py

Lines changed: 0 additions & 157 deletions
This file was deleted.

ngcsimlib/compilers/legacy_compiler/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)