Skip to content

Commit 19d5194

Browse files
committed
[ModelicaSystem*] fix pylint error - small cleanups
* exception handling - use from ex * remove not needed pass * remove brackets
1 parent 10f947b commit 19d5194

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class ModelicaSystemError(Exception):
5959
"""
6060
Exception used in ModelicaSystem and ModelicaSystemCmd classes.
6161
"""
62-
pass
6362

6463

6564
@dataclass
@@ -260,8 +259,8 @@ def run(self) -> int:
260259

261260
if stderr:
262261
raise ModelicaSystemError(f"Error running command {repr(cmdl)}: {stderr}")
263-
except subprocess.TimeoutExpired:
264-
raise ModelicaSystemError(f"Timeout running command {repr(cmdl)}")
262+
except subprocess.TimeoutExpired as ex:
263+
raise ModelicaSystemError(f"Timeout running command {repr(cmdl)}") from ex
265264
except subprocess.CalledProcessError as ex:
266265
raise ModelicaSystemError(f"Error running command {repr(cmdl)}") from ex
267266

@@ -301,7 +300,7 @@ def parse_simflags(simflags: str) -> dict[str, Optional[str | dict[str, str]]]:
301300
override_dict = {}
302301
for item in override.split(','):
303302
kv = item.split('=')
304-
if not (0 < len(kv) < 3):
303+
if not 0 < len(kv) < 3:
305304
raise ModelicaSystemError(f"Invalid value for '-override': {override}")
306305
if kv[0]:
307306
try:

0 commit comments

Comments
 (0)