本文整理汇总了Python中wdb.Wdb.get方法的典型用法代码示例。如果您正苦于以下问题:Python Wdb.get方法的具体用法?Python Wdb.get怎么用?Python Wdb.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wdb.Wdb
的用法示例。
在下文中一共展示了Wdb.get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def main():
"""Wdb entry point"""
sys.path.insert(0, os.getcwd())
args, extrargs = parser.parse_known_args()
sys.argv = ['wdb'] + extrargs
if args.file:
file = os.path.join(os.getcwd(), args.file)
if args.source:
print('The source argument cannot be used with file.')
sys.exit(1)
if not os.path.exists(file):
print('Error:', file, 'does not exist')
sys.exit(1)
Wdb.get().run_file(file)
else:
source = None
if args.source:
source = os.path.join(os.getcwd(), args.source)
if not os.path.exists(source):
print('Error:', source, 'does not exist')
sys.exit(1)
Wdb.get().shell(source)
示例2: main
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def main():
"""Inspired by python -m pdb. Debug any python script with wdb"""
if not sys.argv[1:] or sys.argv[1] in ("--help", "-h"):
print("usage: wdb.py scriptfile [arg] ...")
sys.exit(2)
mainpyfile = sys.argv[1]
if not os.path.exists(mainpyfile):
print('Error:', mainpyfile, 'does not exist')
sys.exit(1)
del sys.argv[0]
sys.path[0] = os.path.dirname(mainpyfile)
Wdb.get().run_file(mainpyfile)
示例3: f
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def f():
# Enable wdb
wdb = Wdb.get()
Wdb.enabled = True
start_response('200 OK', [
('Content-Type', 'text/html'), ('X-Thing', wdb.uuid)])
yield to_bytes(' ' * 4096)
wdb = set_trace()
wdb.die()
yield to_bytes('Exited')
示例4: main
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def main():
"""Wdb entry point"""
sys.path.insert(0, os.getcwd())
args, extrargs = parser.parse_known_args()
sys.argv = ['wdb'] + args.args + extrargs
if args.file:
file = os.path.join(os.getcwd(), args.file)
if args.source:
print('The source argument cannot be used with file.')
sys.exit(1)
if not os.path.exists(file):
print('Error:', file, 'does not exist')
sys.exit(1)
if args.trace:
Wdb.get().run_file(file)
else:
def wdb_pm(xtype, value, traceback):
sys.__excepthook__(xtype, value, traceback)
wdb = Wdb.get()
wdb.reset()
wdb.interaction(None, traceback, post_mortem=True)
sys.excepthook = wdb_pm
with open(file) as f:
code = compile(f.read(), file, 'exec')
execute(code, globals(), globals())
else:
source = None
if args.source:
source = os.path.join(os.getcwd(), args.source)
if not os.path.exists(source):
print('Error:', source, 'does not exist')
sys.exit(1)
Wdb.get().shell(source)
示例5: trace_wsgi
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def trace_wsgi(environ, start_response):
wdb = Wdb.get()
wdb.closed = False
appiter = None
try:
with trace(close_on_exit=True, under=self.app):
appiter = self.app(environ, start_response)
for item in appiter:
yield item
except Exception:
start_response('500 INTERNAL SERVER ERROR', [
('Content-Type', 'text/html')])
yield _handle_off()
finally:
hasattr(appiter, 'close') and appiter.close()
wdb.closed = False
示例6: catch
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def catch(environ, start_response):
wdb = Wdb.get()
wdb.closed = False
appiter = None
try:
appiter = self.app(environ, start_response)
for item in appiter:
yield item
except Exception:
start_response('500 INTERNAL SERVER ERROR', [
('Content-Type', 'text/html')])
yield _handle_off()
finally:
# Close set_trace debuggers
stop_trace(close_on_exit=True)
hasattr(appiter, 'close') and appiter.close()
wdb.closed = False
示例7: _wdb_execute
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def _wdb_execute(*args, **kwargs):
from wdb import trace, Wdb
wdb = Wdb.get()
wdb.closed = False # Activate request ignores
interesting = True
if len(args) > 0 and isinstance(args[0], ErrorHandler):
interesting = False
elif len(args) > 2 and isinstance(
args[0], StaticFileHandler) and args[2] == 'favicon.ico':
interesting = False
if Wdb.enabled and interesting:
with trace(close_on_exit=True, under=under):
old_execute(*args, **kwargs)
else:
old_execute(*args, **kwargs)
# Close set_trace debuggers
stop_trace(close_on_exit=True)
# Reset closed state
wdb.closed = False
示例8: run
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def run():
from wdb import Wdb
Wdb.get().run_file(fn)
示例9: run
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def run():
from wdb import Wdb
Wdb.get().run_file(fn[0].decode('utf-8'))
示例10: run
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def run():
from wdb import Wdb
Wdb.get().shell()
示例11: wdb_pm
# 需要导入模块: from wdb import Wdb [as 别名]
# 或者: from wdb.Wdb import get [as 别名]
def wdb_pm(xtype, value, traceback):
sys.__excepthook__(xtype, value, traceback)
wdb = Wdb.get()
wdb.reset()
wdb.interaction(None, traceback, post_mortem=True)