-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log level and command line options to simulation server (#953)
- Loading branch information
Showing
2 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
from OMSimulator import Model, Scope, Types | ||
|
||
|
||
def newModel(cref): | ||
def newModel(cref: str): | ||
status = Scope._capi.newModel(cref) | ||
if Types.Status(status) == Types.Status.OK: | ||
Scope._Scope.append(cref) | ||
else: | ||
raise Exception('error {}'.format(Types.Status(status))) | ||
return Model(cref) | ||
|
||
def importFile(file): | ||
def importFile(file: str): | ||
cref, status = Scope._capi.importFile(file) | ||
if Types.Status(status) == Types.Status.OK: | ||
Scope._Scope.append(cref) | ||
else: | ||
raise Exception('error {}'.format(Types.Status(status))) | ||
return Model(cref) | ||
|
||
def setTempDirectory(dir): | ||
def setTempDirectory(dir: str): | ||
status = Scope._capi.setTempDirectory(dir) | ||
if Types.Status(status) != Types.Status.OK: | ||
raise Exception('error {}'.format(Types.Status(status))) | ||
|
||
def setCommandLineOption(cmd: str): | ||
status = Scope._capi.setCommandLineOption(cmd) | ||
if Types.Status(status) != Types.Status.OK: | ||
raise Exception('error {}'.format(Types.Status(status))) | ||
|
||
def setLoggingLevel(level: int): | ||
if not isinstance(level, int): | ||
raise Exception('bad argument: {}'.format(level)) | ||
|
||
status = Scope._capi.setLoggingLevel(level) | ||
if Types.Status(status) != Types.Status.OK: | ||
raise Exception('error {}'.format(Types.Status(status))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters