11import json
2- import yaml
3-
4- from collections import namedtuple
5-
62import logging
73
8- from .errors import InputError
94from paths_cli .utils import import_thing
105from paths_cli .plugin_management import OPSPlugin
6+ from paths_cli .compiling .errors import InputError
7+
118
129def listify (obj ):
1310 listified = False
@@ -16,16 +13,20 @@ def listify(obj):
1613 listified = True
1714 return obj , listified
1815
16+
1917def unlistify (obj , listified ):
2018 if listified :
2119 assert len (obj ) == 1
2220 obj = obj [0 ]
2321 return obj
2422
23+
2524REQUIRED_PARAMETER = object ()
2625
26+
2727class Parameter :
2828 SCHEMA = "http://openpathsampling.org/schemas/sim-setup/draft01.json"
29+
2930 def __init__ (self , name , loader , * , json_type = None , description = None ,
3031 default = REQUIRED_PARAMETER , aliases = None ):
3132 if isinstance (json_type , str ):
@@ -150,6 +151,7 @@ class InstanceCompilerPlugin(OPSPlugin):
150151 """
151152 SCHEMA = "http://openpathsampling.org/schemas/sim-setup/draft01.json"
152153 category = None
154+
153155 def __init__ (self , builder , parameters , name = None , aliases = None ,
154156 requires_ops = (1 , 0 ), requires_cli = (0 , 3 )):
155157 super ().__init__ (requires_ops , requires_cli )
@@ -239,7 +241,7 @@ def __call__(self, dct):
239241 ops_dct = self .compile_attrs (dct )
240242 self .logger .debug ("Building..." )
241243 self .logger .debug (ops_dct )
242- obj = self .builder (** ops_dct )
244+ obj = self .builder (** ops_dct )
243245 self .logger .debug (obj )
244246 return obj
245247
@@ -260,7 +262,7 @@ def _compile_str(self, name):
260262 self .logger .debug (f"Looking for '{ name } '" )
261263 try :
262264 return self .named_objs [name ]
263- except KeyError as e :
265+ except KeyError :
264266 raise InputError .unknown_name (self .label , name )
265267
266268 def _compile_dict (self , dct ):
0 commit comments