@@ -322,8 +322,8 @@ def __init__(
322322 customBuildDirectory : Optional [str | os .PathLike | pathlib .Path ] = None ,
323323 omhome : Optional [str ] = None ,
324324 session : Optional [OMCSessionZMQ ] = None ,
325- build : Optional [bool ] = True
326- ) :
325+ build : Optional [bool ] = True ,
326+ ) -> None :
327327 """Initialize, load and build a model.
328328
329329 The constructor loads the model file and builds it, generating exe and
@@ -401,8 +401,8 @@ def __init__(
401401 self .inputFlag = False # for model with input quantity
402402 self .simulationFlag = False # if the model is simulated?
403403 self .outputFlag = False
404- self .csvFile = '' # for storing inputs condition
405- self .resultfile = None # for storing result file
404+ self .csvFile : Optional [ pathlib . Path ] = None # for storing inputs condition
405+ self .resultfile : Optional [ pathlib . Path ] = None # for storing result file
406406 self .variableFilter = variableFilter
407407
408408 if self .fileName is not None and not self .fileName .is_file (): # if file does not exist
@@ -427,7 +427,7 @@ def __init__(
427427 if build :
428428 self .buildModel (variableFilter )
429429
430- def setCommandLineOptions (self , commandLineOptions : str ):
430+ def setCommandLineOptions (self , commandLineOptions : Optional [ str ] = None ):
431431 # set commandLineOptions if provided by users
432432 if commandLineOptions is None :
433433 return
@@ -462,7 +462,7 @@ def loadLibrary(self, lmodel: list):
462462 '1)["Modelica"]\n '
463463 '2)[("Modelica","3.2.3"), "PowerSystems"]\n ' )
464464
465- def setTempDirectory (self , customBuildDirectory ) -> pathlib .Path :
465+ def setTempDirectory (self , customBuildDirectory : Optional [ str | os . PathLike | pathlib . Path ] = None ) -> pathlib .Path :
466466 # create a unique temp directory for each session and build the model in that directory
467467 if customBuildDirectory is not None :
468468 if not os .path .exists (customBuildDirectory ):
@@ -482,7 +482,7 @@ def setTempDirectory(self, customBuildDirectory) -> pathlib.Path:
482482 def getWorkDirectory (self ) -> pathlib .Path :
483483 return self .tempdir
484484
485- def buildModel (self , variableFilter = None ):
485+ def buildModel (self , variableFilter : Optional [ str ] = None ):
486486 if variableFilter is not None :
487487 self .variableFilter = variableFilter
488488
@@ -497,7 +497,7 @@ def buildModel(self, variableFilter=None):
497497 self .xmlFile = pathlib .Path (buildModelResult [0 ]).parent / buildModelResult [1 ]
498498 self .xmlparse ()
499499
500- def sendExpression (self , expr , parsed = True ):
500+ def sendExpression (self , expr : str , parsed : bool = True ):
501501 try :
502502 retval = self .getconn .sendExpression (expr , parsed )
503503 except OMCSessionException as ex :
0 commit comments