@@ -40,7 +40,8 @@ class Process(object):
4040 """
4141 def __init__ (self , name ):
4242 """
43- Creates and empty process using the provided name
43+ Creates an empty process using the provided name
44+
4445 Args:
4546 name: the name of the process (should be unique per context)
4647 """
@@ -57,15 +58,16 @@ def __init__(self, name):
5758 @staticmethod
5859 def make_process (process_spec , custom_process_klass = None ):
5960 """
60- Used the in the creation of a process from a json file. Under normal
61- circumstances this is not normally called by the user.
61+ Used in the creation of a process from a json file. Under normal
62+ circumstances this is not normally to be called by the user.
6263
6364 Args:
6465 process_spec: the parsed json object to create a process from
65- custom_process_klass: a custom subclass of a process to build
6666
67- Returns: the created process
67+ custom_process_klass: a custom subclass of a process to build
6868
69+ Returns:
70+ the created process
6971 """
7072 if custom_process_klass is None :
7173 custom_process_klass = Process
@@ -81,17 +83,20 @@ def make_process(process_spec, custom_process_klass=None):
8183 @property
8284 def pure (self ):
8385 """
84- Returns: The current compile method for the process as a pure method
86+ Returns:
87+ the current compile method for the process as a pure method
8588 """
8689 return self ._method
8790
8891 def __rshift__ (self , other ):
8992 """
90- Added wrapper for the transition method
93+ Added wrapper for the transition method.
94+
9195 Args:
9296 other: the transition call for the transition method
9397
94- Returns: the process for the use of chaining calls
98+ Returns:
99+ the process for the use of chaining calls
95100 """
96101 return self .transition (other )
97102
@@ -101,10 +106,10 @@ def transition(self, transition_call):
101106 decorated by the @transition decorator.
102107
103108 Args:
104- transition_call: Transition method to add to the process
105-
106- Returns: the process for the use of chaining calls
109+ transition_call: transition method to add to the process
107110
111+ Returns:
112+ the process for the use of chaining calls
108113 """
109114 self ._calls .append ({"path" : transition_call .__self__ .path , "key" : transition_call .resolver_key })
110115 self ._needed_contexts .add (infer_context (transition_call .__self__ .path ))
@@ -119,19 +124,19 @@ def execute(self, update_state=False, **kwargs):
119124 """
120125 Executes the process using the current state of the model to run. This
121126 method has checks to ensure that the process has transitions added to it
122- as well as that all the keyword arguments required by each of the
123- transition call are in the provided keyword arguments. By default, this
127+ as well as if all of the keyword arguments required by each of the
128+ transition calls are in the provided keyword arguments. By default, this
124129 does not update the final state of the model but that can be toggled
125130 with the flag "update_state".
126131
127132 Args:
128- update_state: Should this method update the final state of the model
129- **kwargs: The required keyword arguments to execute the process
133+ update_state: should this method update the final state of the model?
130134
131- Returns: the final state of the process regardless of the model is
132- updated to reflect this. Will return null if either of the above checks
133- fail
135+ **kwargs: the required keyword arguments to execute the process
134136
137+ Returns:
138+ The final state of the process regardless of the model is updated to
139+ reflect this. Will return null/None if either of the above checks fail
135140 """
136141 if self ._method is None :
137142 warn ("Attempting to execute a process with no transition steps" )
@@ -147,14 +152,15 @@ def execute(self, update_state=False, **kwargs):
147152
148153 def as_obj (self ):
149154 """
150- Returns: Returns this process as an object to be used with json files
155+ Returns:
156+ Returns this process as an object to be used with json files
151157 """
152158 return {"name" : self .name , "class" : self .__class__ .__name__ , "calls" : self ._calls }
153159
154160 def get_required_args (self ):
155161 """
156- Returns: The needed arguments for all the transition calls in this
157- process as a set
162+ Returns:
163+ The needed arguments for all the transition calls in this process as a set
158164 """
159165 return self ._needed_args
160166
@@ -164,14 +170,15 @@ def get_required_state(self, include_special_compartments=False):
164170 note that if this is going to be used as an argument to the pure method
165171 make sure that the "include_special_compartments" flag is set to True so
166172 that special compartments found in certain components are visible.
173+
167174 Args:
168175 include_special_compartments: A flag to show the compartments that
169- denoted as special compartments by ngcsimlib (this is any
170- compartment with * in their name, these are can only be created
171- dynamically)
172-
173- Returns: A subset of the model state based on the required compartments
176+ denoted as special compartments by ngcsimlib (this is any
177+ compartment with * in their name, these are can only be created
178+ dynamically)
174179
180+ Returns:
181+ A subset of the model state based on the required compartments
175182 """
176183 compound_state = {}
177184 for context in self ._needed_contexts :
@@ -181,38 +188,40 @@ def get_required_state(self, include_special_compartments=False):
181188 def updated_modified_state (self , state ):
182189 """
183190 Updates the model with the provided state. It is important to note that
184- only values that are rquired for the execution of this process will be
185- affected by this call. If all compartments need to be updated, view
186- other options found in ngcsimlib.utils.
191+ only values that are required for the execution of this process will be
192+ affected by this call. If all of the compartments need to be updated, view
193+ other options found in `ngcsimlib.utils`.
194+
187195 Args:
188- state: The state to update the model with
196+ state: the state to update the model with
189197 """
190198 Set_Compartment_Batch ({key : value for key , value in state .items () if key in self .get_required_state (include_special_compartments = True )})
191199
192200
193201def transition (output_compartments , builder = False ):
194202 """
195- The decorator to be paired with the Process call. This method does
203+ The decorator to be paired with the ` Process` call. This method does
196204 everything that the now outdated resolver did to ensure backward
197- compatability. This decorator expects to decorate a static method on a
198- class.
205+ compatability. This decorator expects the user/developer to decorate a
206+ static method on a class.
199207
200- Through normal patterns these decorated method will never be directly called
208+ Through normal patterns, these decorated method will never be directly called
201209 by the end user, but if they are for the purpose of debugging there are a
202- few things to keep in mind. While the process compiler will automatically
210+ few things to keep in mind. The process compiler will automatically
203211 link values in the component to the different values to be passed into the
204212 method that does not exist if they are directly called. In addition, if the
205213 method is going to be called at a class level the first value passed into
206214 the method must be None to not mess up the internal decoration.
207- Args:
208- output_compartments: The string name of the output compartments the
209- outputs of this method will be assigned to in the order they are output.
210- builder: A boolean flag for if this method is a builder method for the
211- compiler. A builder method is a method that returns the static method to
212- use in the transition.
213-
214- Returns: the wrapped method
215215
216+ Args:
217+ output_compartments: the string name of the output compartments the
218+ outputs of this method will be assigned to in the order they are output.
219+ builder: A boolean flag for if this method is a builder method for the
220+ compiler. A builder method is a method that returns the static method to
221+ use in the transition.
222+
223+ Returns:
224+ the wrapped method
216225 """
217226 def _wrapper (f ):
218227 @wraps (f )
@@ -238,4 +247,5 @@ def inner(self, *args, **kwargs):
238247 add_transition_meta (class_name , resolver_key ,([], [], [], True ))
239248
240249 return inner
241- return _wrapper
250+ return _wrapper
251+
0 commit comments