gflags.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:office-interoperability-tools 作者: milossramek 项目源码 文件源码
def _GetCallingModuleObjectAndName():
  """Returns the module that's calling into this module.

  We generally use this function to get the name of the module calling a
  DEFINE_foo... function.
  """
  # Walk down the stack to find the first globals dict that's not ours.
  for depth in range(1, sys.getrecursionlimit()):
    if not sys._getframe(depth).f_globals is globals():
      globals_for_frame = sys._getframe(depth).f_globals
      module, module_name = _GetModuleObjectAndName(globals_for_frame)
      if module_name is not None:
        return module, module_name
  raise AssertionError("No module was found")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号