@@ -98,6 +98,10 @@ def wait(self, timeout):
9898
9999class OMCSessionBase (metaclass = abc .ABCMeta ):
100100
101+ def __init__ (self , readonly = False ):
102+ self ._readonly = readonly
103+ self ._omc_cache = {}
104+
101105 def clearOMParserResult (self ):
102106 OMParser .result = {}
103107
@@ -125,10 +129,10 @@ def sendExpression(self, command, parsed=True):
125129 def ask (self , question , opt = None , parsed = True ):
126130 p = (question , opt , parsed )
127131
128- if self .readonly and question != 'getErrorString' :
132+ if self ._readonly and question != 'getErrorString' :
129133 # can use cache if readonly
130- if p in self .omc_cache :
131- return self .omc_cache [p ]
134+ if p in self ._omc_cache :
135+ return self ._omc_cache [p ]
132136
133137 if opt :
134138 expression = f'{ question } ({ opt } )'
@@ -144,7 +148,7 @@ def ask(self, question, opt=None, parsed=True):
144148 raise
145149
146150 # save response
147- self .omc_cache [p ] = res
151+ self ._omc_cache [p ] = res
148152
149153 return res
150154
@@ -329,10 +333,10 @@ def __init__(self, readonly=False, timeout=10.00,
329333 if dockerExtraArgs is None :
330334 dockerExtraArgs = []
331335
336+ super ().__init__ (readonly = readonly )
337+
332338 self .omhome = self ._get_omhome (omhome = omhome )
333339
334- self .readonly = readonly
335- self .omc_cache = {}
336340 self ._omc_process = None
337341 self ._omc_command = None
338342 self ._omc = None
0 commit comments