MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / lookup

Function lookup

tools/python-3.11.9-amd64/Lib/cgitb.py:69–83  ·  view source on GitHub ↗

Find the value for a given name in the given environment.

(name, frame, locals)

Source from the content-addressed store, hash-verified

67 return ''
68
69def lookup(name, frame, locals):
70 """Find the value for a given name in the given environment."""
71 if name in locals:
72 return 'local', locals[name]
73 if name in frame.f_globals:
74 return 'global', frame.f_globals[name]
75 if '__builtins__' in frame.f_globals:
76 builtins = frame.f_globals['__builtins__']
77 if type(builtins) is type({}):
78 if name in builtins:
79 return 'builtin', builtins[name]
80 else:
81 if hasattr(builtins, name):
82 return 'builtin', getattr(builtins, name)
83 return None, __UNDEF__
84
85def scanvars(reader, frame, locals):
86 """Scan one logical line of Python and look up values of variables used."""

Callers 11

getdefaultlocaleFunction · 0.70
openFunction · 0.70
EncodedFileFunction · 0.70
getencoderFunction · 0.70
getdecoderFunction · 0.70
getincrementalencoderFunction · 0.70
getincrementaldecoderFunction · 0.70
getreaderFunction · 0.70
getwriterFunction · 0.70
scanvarsFunction · 0.70
find_cookieFunction · 0.70

Calls 1

typeClass · 0.50

Tested by

no test coverage detected