MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / _GetFileAndLine

Function _GetFileAndLine

tensorlayer/logging/tl_logging.py:193–206  ·  view source on GitHub ↗

Returns (filename, linenumber) for the stack frame.

()

Source from the content-addressed store, hash-verified

191
192
193def _GetFileAndLine():
194 """Returns (filename, linenumber) for the stack frame."""
195 # Use sys._getframe(). This avoids creating a traceback object.
196 # pylint: disable=protected-access
197 f = _sys._getframe()
198 # pylint: enable=protected-access
199 our_file = f.f_code.co_filename
200 f = f.f_back
201 while f:
202 code = f.f_code
203 if code.co_filename != our_file:
204 return (code.co_filename, f.f_lineno)
205 f = f.f_back
206 return ('<unknown>', 0)
207
208
209def google2_log_prefix(level, timestamp=None, file_and_line=None):

Callers 3

log_every_nFunction · 0.85
log_first_nFunction · 0.85
google2_log_prefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…