MCPcopy
hub / github.com/prompt-toolkit/ptpython / _lookup

Method _lookup

src/ptpython/completer.py:391–399  ·  view source on GitHub ↗

Do lookup of `object_var` in the context. `temp_locals` is a dictionary, used for the locals.

(self, expression: str, temp_locals: dict[str, Any])

Source from the content-addressed store, hash-verified

389 )
390
391 def _lookup(self, expression: str, temp_locals: dict[str, Any]) -> object:
392 """
393 Do lookup of `object_var` in the context.
394 `temp_locals` is a dictionary, used for the locals.
395 """
396 try:
397 return eval(expression.strip(), self.get_globals(), temp_locals)
398 except BaseException:
399 return None # Many exception, like NameError can be thrown here.
400
401 def get_completions(
402 self, document: Document, complete_event: CompleteEvent

Callers 4

get_completionsMethod · 0.95
eval_expressionMethod · 0.95

Calls 1

get_globalsMethod · 0.80

Tested by

no test coverage detected