Skip to content

Commit fbd5c50

Browse files
committed
Return unchanged result from _ask_with_fallback
Fix typo
1 parent 8ad5efa commit fbd5c50

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

OMPython/OMCSession.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ def _ask_with_fallback(self, question: str, opt: str = None):
140140
logger.warning('OMTypedParser error: %s', ex.msg)
141141
result = self.ask(question=question, opt=opt, parsed=False)
142142
try:
143-
answer = om_parser_basic(result)
144-
return answer[2:]
143+
return om_parser_basic(result)
145144
except (TypeError, UnboundLocalError) as ex:
146145
logger.warning('OMParser error: %s', ex)
147146
return result
@@ -254,15 +253,17 @@ def getComponentModifierNames(self, className, componentName):
254253
return self.ask('getComponentModifierNames', f'{className}, {componentName}')
255254

256255
def getComponentModifierValue(self, className, componentName):
257-
return self._ask_with_fallback(question='getComponentModifierValue',
258-
opt=f'{className}, {componentName}')
256+
result = self._ask_with_fallback(question='getComponentModifierValue',
257+
opt=f'{className}, {componentName}')
258+
return result[2:]
259259

260260
def getExtendsModifierNames(self, className, componentName):
261261
return self.ask('getExtendsModifierNames', f'{className}, {componentName}')
262262

263263
def getExtendsModifierValue(self, className, extendsName, modifierName):
264-
return self._ask_with_fallback(question='getExtendsModifierValue',
265-
opt=f'{className}, {extendsName}, {modifierName}')
264+
result = self._ask_with_fallback(question='getExtendsModifierValue',
265+
opt=f'{className}, {extendsName}, {modifierName}')
266+
return result[2:]
266267

267268
def getNthComponentModification(self, className, comp_id):
268269
# FIXME: OMPython exception Results KeyError exception

OMPython/OMParser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ def check_for_values(string):
894894
return result
895895

896896

897-
# TODO: hack to be able to use one entry point wich also resets the (global) variable results
897+
# TODO: hack to be able to use one entry point which also resets the (global) variable results
898898
# this should be checked such that the content of this file can be used as class with correct handling of
899899
# variable usage
900900
def om_parser_basic(string: str):

0 commit comments

Comments
 (0)