Skip to content

Commit cc78dc1

Browse files
committed
chore(jnml): format with black
1 parent 861198e commit cc78dc1

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

omv/engines/jneuroml.py

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,60 @@
99

1010

1111
class JNeuroMLEngine(OMVEngine):
12-
1312
name = "jNeuroML"
1413

1514
@staticmethod
1615
def get_environment():
17-
18-
if 'JNML_HOME' in os.environ:
19-
jnmlhome = os.environ['JNML_HOME']
16+
if "JNML_HOME" in os.environ:
17+
jnmlhome = os.environ["JNML_HOME"]
2018
elif shutil.which("jnml") is not None:
2119
jnmlhome = Path(shutil.which("jnml")).parent
2220
else:
2321
osname = platform.system()
2422
if osname == "Linux":
2523
try:
26-
jnmlhome = os.path.join(os.environ['XDG_DATA_HOME'],'jnml/jNeuroMLJar')
24+
jnmlhome = os.path.join(
25+
os.environ["XDG_DATA_HOME"], "jnml/jNeuroMLJar"
26+
)
2727
except KeyError as e:
28-
jnmlhome = os.path.join(os.environ['HOME'],'.local/share/jnml/jNeuroMLJar')
28+
jnmlhome = os.path.join(
29+
os.environ["HOME"], ".local/share/jnml/jNeuroMLJar"
30+
)
2931
elif osname == "Darwin":
30-
jnmlhome = os.path.join(os.environ['HOME'],'Library/jnml/jNeuroMLJar')
32+
jnmlhome = os.path.join(os.environ["HOME"], "Library/jnml/jNeuroMLJar")
3133
else:
32-
jnmlhome = os.path.join(os.environ['HOME'],'jnml/jNeuroMLJar')
34+
jnmlhome = os.path.join(os.environ["HOME"], "jnml/jNeuroMLJar")
3335

34-
environment_vars = {'JNML_HOME': jnmlhome}
36+
environment_vars = {"JNML_HOME": jnmlhome}
3537

3638
return environment_vars
3739

3840
@staticmethod
3941
def get_executable():
40-
4142
environment_vars = JNeuroMLEngine.get_environment()
42-
jnml = os.path.join(environment_vars['JNML_HOME'],'jnml' if os.name != 'nt' else 'jnml.bat')
43+
jnml = os.path.join(
44+
environment_vars["JNML_HOME"], "jnml" if os.name != "nt" else "jnml.bat"
45+
)
4346
return jnml
4447

4548
@staticmethod
4649
def is_installed():
4750
ret = True
4851
try:
4952
if is_verbose():
50-
inform("Checking whether %s is installed..." %
51-
JNeuroMLEngine.name, indent=1)
52-
FNULL = open(os.devnull, 'w')
53+
inform(
54+
"Checking whether %s is installed..." % JNeuroMLEngine.name,
55+
indent=1,
56+
)
57+
FNULL = open(os.devnull, "w")
5358
jnml = JNeuroMLEngine.get_executable()
54-
r = check_output([jnml, '-v'], verbosity=2,
55-
env=JNeuroMLEngine.get_environment())
56-
ret = '%s'%r.split()[1]
59+
r = check_output(
60+
[jnml, "-v"], verbosity=2, env=JNeuroMLEngine.get_environment()
61+
)
62+
ret = "%s" % r.split()[1]
5763

5864
if is_verbose():
59-
inform("%s %s is installed..." %
60-
(JNeuroMLEngine.name, ret), indent=2)
65+
inform("%s %s is installed..." % (JNeuroMLEngine.name, ret), indent=2)
6166
except OSError as err:
6267
if is_verbose():
6368
inform("Couldn't execute/import jNeuroML: ", err, indent=1)
@@ -68,18 +73,22 @@ def is_installed():
6873
def install(version):
6974
from omv.engines.getjnml import install_jnml
7075

71-
inform('Will fetch and install the latest jNeuroML jar', indent=2)
76+
inform("Will fetch and install the latest jNeuroML jar", indent=2)
7277
install_jnml()
7378

7479
def run(self):
7580
try:
76-
inform("Running file %s with %s" % (trim_path(self.modelpath), self.name),
77-
indent=1)
81+
inform(
82+
"Running file %s with %s" % (trim_path(self.modelpath), self.name),
83+
indent=1,
84+
)
7885

7986
jnml = JNeuroMLEngine.get_executable()
80-
self.stdout = sp.check_output([jnml, self.modelpath, '-nogui'],
81-
cwd=os.path.dirname(self.modelpath),
82-
env=JNeuroMLEngine.get_environment())
87+
self.stdout = sp.check_output(
88+
[jnml, self.modelpath, "-nogui"],
89+
cwd=os.path.dirname(self.modelpath),
90+
env=JNeuroMLEngine.get_environment(),
91+
)
8392
self.returncode = 0
8493
except sp.CalledProcessError as err:
8594
self.returncode = err.returncode

0 commit comments

Comments
 (0)