Skip to content

Commit 2f2b37c

Browse files
committed
cleanup (remove comments; pep8/pylint)
1 parent 8637860 commit 2f2b37c

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎paths_cli/wizard/load_from_ops.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from paths_cli.parameters import INPUT_FILE
22
from paths_cli.wizard.core import get_object
3-
from paths_cli.wizard.standard_categories import CATEGORIES
4-
from paths_cli.wizard.helper import Helper
5-
from functools import partial
63

74
from paths_cli.wizard.errors import FILE_LOADING_ERROR_MSG
85
LABEL = "Load existing from OPS file"
96

7+
108
def named_objs_helper(storage, store_name):
119
def list_items(user_input, context=None):
1210
store = getattr(storage, store_name)
@@ -25,13 +23,13 @@ def _get_ops_storage(wizard):
2523
storage = INPUT_FILE.get(filename)
2624
except Exception as e:
2725
wizard.exception(FILE_LOADING_ERROR_MSG, e)
28-
return
26+
return None
2927

3028
return storage
3129

30+
3231
@get_object
3332
def _get_ops_object(wizard, storage, store_name, obj_name):
34-
# TODO: switch this to using wizard.ask_enumerate_dict, I think
3533
store = getattr(storage, store_name)
3634
options = {obj.name: obj for obj in store if obj.is_named}
3735
result = wizard.ask_enumerate_dict(
@@ -40,6 +38,7 @@ def _get_ops_object(wizard, storage, store_name, obj_name):
4038
)
4139
return result
4240

41+
4342
def load_from_ops(wizard, store_name, obj_name):
4443
wizard.say("Okay, we'll load it from an OPS file.")
4544
storage = _get_ops_storage(wizard)

‎paths_cli/wizard/volumes.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import operator
2+
from functools import partial
23
from paths_cli.wizard.parameters import ProxyParameter
34
from paths_cli.wizard.plugin_classes import (
45
LoadFromOPS, WizardParameterObjectPlugin, WizardObjectPlugin,
@@ -7,7 +8,7 @@
78
from paths_cli.wizard.helper import EvalHelperFunc, Helper
89
from paths_cli.wizard.core import interpret_req
910
import paths_cli.compiling.volumes
10-
from functools import partial
11+
1112

1213
def _binary_func_volume(wizard, context, op):
1314
wizard.say("Let's make the first constituent volume:")
@@ -28,6 +29,7 @@ def _binary_func_volume(wizard, context, op):
2829
_LAMBDA_STR = ("What is the {minmax} allowed value for "
2930
"'{{obj_dict[cv].name}}' in this volume?")
3031

32+
3133
CV_DEFINED_VOLUME_PLUGIN = WizardParameterObjectPlugin.from_proxies(
3234
name="CV-defined volume (allowed values of CV)",
3335
category="volume",
@@ -57,6 +59,7 @@ def _binary_func_volume(wizard, context, op):
5759
compiler_plugin=paths_cli.compiling.volumes.CV_VOLUME_PLUGIN,
5860
)
5961

62+
6063
INTERSECTION_VOLUME_PLUGIN = WizardObjectPlugin(
6164
name='Intersection of two volumes (must be in both)',
6265
category="volume",
@@ -69,6 +72,7 @@ def _binary_func_volume(wizard, context, op):
6972
"both of the volumes that define it."),
7073
)
7174

75+
7276
UNION_VOLUME_PLUGIN = WizardObjectPlugin(
7377
name='Union of two volumes (must be in at least one)',
7478
category="volume",
@@ -81,6 +85,7 @@ def _binary_func_volume(wizard, context, op):
8185
"that define this are also in this volume"),
8286
)
8387

88+
8489
NEGATED_VOLUME_PLUGIN = WizardObjectPlugin(
8590
name='Complement of a volume (not in given volume)',
8691
category='volume',
@@ -93,13 +98,15 @@ def _binary_func_volume(wizard, context, op):
9398
"in the existing volume."),
9499
)
95100

101+
96102
_FIRST_STATE = ("Now let's define state states for your system. "
97103
"You'll need to define {n_states_string} of them.")
98104
_ADDITIONAL_STATES = "Okay, let's define another stable state."
99105
_VOL_DESC = ("You can describe this as either a range of values for some "
100106
"CV, or as some combination of other such volumes "
101107
"(i.e., intersection or union).")
102108

109+
103110
def volume_intro(wizard, context):
104111
as_state = context.get('depth', 0) == 0
105112
n_states = len(wizard.states)
@@ -114,18 +121,21 @@ def volume_intro(wizard, context):
114121
intro += [_VOL_DESC]
115122
return intro
116123

124+
117125
def volume_set_context(wizard, context, selected):
118126
depth = context.get('depth', 0) + 1
119127
new_context = {
120128
'depth': depth,
121129
}
122130
return new_context
123131

132+
124133
def volume_ask(wizard, context):
125134
as_state = context.get('depth', 0) == 0
126135
obj = {True: 'state', False: 'volume'}[as_state]
127136
return f"What describes this {obj}?"
128137

138+
129139
VOLUME_FROM_FILE = LoadFromOPS('volume')
130140

131141
VOLUMES_PLUGIN = WrapCategory(

0 commit comments

Comments
 (0)