本文整理汇总了Python中pudb.set_trace函数的典型用法代码示例。如果您正苦于以下问题:Python set_trace函数的具体用法?Python set_trace怎么用?Python set_trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_trace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_input
def test_input(self):
import pudb; pudb.set_trace()
test_string = 'asdfQWER'
r = subp.connect("cat | tr [:lower:] [:upper:]")
r.send(test_string)
self.assertEqual(r.std_out, test_string.upper())
self.assertEqual(r.status_code, 0)
开发者ID:marcwebbie,项目名称:subp,代码行数:7,代码来源:test.py
示例2: fetch
def fetch(self):
"""Attempt to fetch the object from the Infoblox device. If successful
the object will be updated and the method will return True.
:rtype: bool
:raises: infoblox.exceptions.ProtocolError
"""
from pudb import set_trace; set_trace()
self._search_values = self._build_search_values({})
LOGGER.debug('Fetching %s, %s', self._path, self._search_values)
response = self._session.get(self._path, self._search_values,
{'_return_fields': self._return_fields})
if response.status_code == 200:
values = response.json()
self._assign(values)
return bool(values)
elif response.status_code >= 400:
try:
error = response.json()
raise exceptions.ProtocolError(error['text'])
except ValueError:
raise exceptions.ProtocolError(response.content)
return False
开发者ID:scottyob,项目名称:infoblox,代码行数:26,代码来源:mappingDb.py
示例3: generate_email_csv
def generate_email_csv(csv_input):
"""Takes a csv of qualified (already won a contract) companies from usaspending.gov and uses their duns numbers to get their email addresses"""
# Get a pandas dataframe column with all of the relevant duns numbers
df = pd.read_csv(csv_input)
duns_numbers = df.dunsnumber.tolist()
# Gets the file number for the current file by taking the max of all of the other numbers in the lists directory and adding one to the hightest number
non_decimal = re.compile(r'[^\d]+')
file_number_list = [int(non_decimal.sub('', file)) for file in listdir('mail/lists')]
file_number = max(file_number_list)+1 if file_number_list else 1
file_name = 'mail/lists/email_{0}.csv'.format(file_number)
# Actually get the emails
sam_qs = SamRecord.objects.all().filter(duns__in=duns_numbers)[:100]
results = set([])
pudb.set_trace()
for sam in sam_qs:
email = sam.email_address
if email:
results.add(email)
with open(file_name, 'w') as f:
for email in results:
f.write(email+"\n")
开发者ID:Superman8218,项目名称:emerald,代码行数:31,代码来源:generate_list.py
示例4: test
def test():
webbrowser.open_new_tab('http://i.imgur.com/GIdn4.png')
time.sleep(1)
webbrowser.open_new_tab('http://imgur.com/a/EMy4e')
w = World()
w.add_object(Sphere((0,0,0), 1))
w.add_object(Sphere((3,0,0), 1))
w.add_object(Sphere((0,4,0), 2))
w.add_object(Sphere((3,0,2), 2))
w.add_object(Sphere((-3,-3,-3), 2, 1))
raw_input()
# imitation light
#w.add_object(Sphere((100,100,0), 80, 0, .95))
w.add_light(Light((100, 100, 0)))
w.add_object(Checkerboard(((0,-5,0), (0,-5, 5)), ((0,-5,0),(5,-5,0))))
#w.add_view(View(((0,0,-5), (2,0,-4)), ((0,0,-5), (0,2,-5)), -4))
#w.add_view(View(((0,0,-3), (2,0,-3)), ((0,0,-3), (0,2,-3)), -4))
w.add_view(View(((0,0,-5), (2,0,-6)), ((0,0,-5), (0,2,-5)), -4))
#w.add_view(View(((0,0,-100), (2,0,-100)), ((0,0,-100), (0,2,-100)), -4))
print w
#w.render_images(10, 10, 7, 7)
#w.render_images(1680, 1050, 7, 7)
#w.render_asciis(220, 100, 5, 5)
import pudb; pudb.set_trace();
w.debug_render_view(w.views[0], 10, 10, 5, 5)
开发者ID:thomasballinger,项目名称:raycasting,代码行数:33,代码来源:demo.py
示例5: setUp
def setUp(self):
from django.db import connection
from django.db.models.base import ModelBase
from django.core.management.color import no_style
from django_sphinxsearch.managers import SearchManager
# Create a dummy model which extends the mixin
import pudb; pudb.set_trace()
self.model = ModelBase('__TestModel__{}'.format(self.mixin.__name__), (self.mixin, ),
{ '__module__': self.mixin.__module__ })
# Create the schema for our test model
self._style = no_style()
sql, _ = connection.creation.sql_create_model(self.model, self._style)
self._cursor = connection.cursor()
for statement in sql:
self._cursor.execute(statement)
self.model.search = SearchManager(index="test_index", fields={'data': 100}, limit=10)
self.model.search.contribute_to_class(model=self.model, name="search")
source_data = (
"Python is a programming language that lets you work more quickly and integrate your systems more effectively.",
"You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.",
"Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.",
"Python is free to use, even for commercial products, because of its OSI-approved open source license.",
"New to Python or choosing between Python 2 and Python 3? Read Python 2 or Python 3.",
"The Python Software Foundation holds the intellectual property rights behind Python, underwrites the PyCon conference, and funds other projects in the Python community."
)
for pk, data in enumerate(source_data, start=1):
instance = self.model(pk=pk, data=data)
instance.save()
开发者ID:adw0rd,项目名称:django-sphinxsearch,代码行数:31,代码来源:tests.py
示例6: test_003_square3_ff
def test_003_square3_ff(self):
src_data0 = (0, 1, 0, 1, 0)
src_data1 = (-3.0, 4.0, -5.5, 2.0, 3.0)
src_data2 = (2.0, 2.0, 2.0, 2.0, 2.0)
src_data3 = (2.7, 2.7, 2.1, 2.3, 2.5)
expected_result0 = (-3.0, 2.0, -5.5, 2.0, 3.0)
expected_result1 = (-3.0, 2.7, -5.5, 2.3, 3.0)
src0 = blocks.vector_source_f(src_data0)
src1 = blocks.vector_source_f(src_data1)
src2 = blocks.vector_source_f(src_data2)
src3 = blocks.vector_source_f(src_data3)
sqr = square3_ff()
dst0 = blocks.vector_sink_f()
dst1 = blocks.vector_sink_f()
self.tb.connect(src0, (sqr, 0))
self.tb.connect(src1, (sqr, 1))
self.tb.connect(src2, (sqr, 2))
self.tb.connect(src3, (sqr, 3))
self.tb.connect((sqr, 0), dst0)
self.tb.connect((sqr, 1), dst1)
self.tb.run()
result_data0 = dst0.data()
result_data1 = dst1.data()
from pudb import set_trace
set_trace()
self.assertFloatTuplesAlmostEqual(expected_result0, result_data0, 6)
self.assertFloatTuplesAlmostEqual(expected_result1, result_data1, 6)
开发者ID:arunkbharathan,项目名称:MyPython,代码行数:28,代码来源:qa_square3_ff.py
示例7: execusercustomize
def execusercustomize():
"""Run custom user specific code, if available."""
try:
import usercustomize
except ImportError:
import pudb ; pudb.set_trace()
pass
开发者ID:maggietong,项目名称:dot,代码行数:7,代码来源:custom-site.py
示例8: read_command_line
def read_command_line():
"""Look for options from user on the command line for this script"""
parser = optparse.OptionParser(
'Usage: what [options] command\n\n%s' % __doc__)
parser.add_option('-e', '--hide_errors', action='store_true',
help='hide error messages from successful commands')
parser.add_option('-f', '--file', action='store_true',
help='show real path to file (if it is a file)')
parser.add_option('-q', '--quiet', action='store_true',
help='do not show any output')
parser.add_option('-v', '--verbose', action='store_true',
help='whether to show more info, such as file contents')
parser.add_option('-A', '--aliases', default='/tmp/aliases',
help='path to file which holds aliases')
parser.add_option('-F', '--functions', default='/tmp/functions',
help='path to file which holds functions')
parser.add_option('-U', '--debugging', action='store_true',
help='debug with pudb (or pdb if pudb is not available)')
options, arguments = parser.parse_args()
if options.debugging:
try:
import pudb as pdb
except ImportError:
import pdb
pdb.set_trace()
# plint does not seem to notice that methods are globals
# pylint: disable=global-variable-undefined
global get_options
get_options = lambda: options
return arguments
开发者ID:io41,项目名称:what,代码行数:30,代码来源:what.py
示例9: chunkToSixBytes
def chunkToSixBytes(self, peerString):
for i in xrange(0, len(peerString), 6):
chunk = peerString[i:i+6]
if len(chunk) < 6:
import pudb; pudb.set_trace()
raise IndexError("Size of the chunk was not six bytes.")
yield chunk
开发者ID:alkimist,项目名称:Katastrophe,代码行数:7,代码来源:peers.py
示例10: enable_debugging
def enable_debugging():
try:
import pudb
pudb.set_trace()
except ImportError as error:
print(error)
raise ArgumentError("`pudb` argument given but unable to import `pudb`")
开发者ID:russellnakamura,项目名称:cameraobscura,代码行数:7,代码来源:main.py
示例11: test_find_end_directive
def test_find_end_directive(example, output):
text = open(example).read()
from refactorlib.cheetah.parse import parse
lxmlnode = parse(text)
tree = lxmlnode.getroottree()
new_output = []
for directive in lxmlnode.xpath('//Directive'):
new_output.append(
'Directive: %s' % tree.getpath(directive),
)
if directive.is_multiline_directive:
try:
new_output.append(
'End: %s' % tree.getpath(directive.get_end_directive()),
)
except:
import pudb; pudb.set_trace()
raise
else:
new_output.append(
'Single-line: %s' % directive.totext()
)
new_output.append('')
new_output = '\n'.join(new_output)
assert_same_content(output, new_output)
开发者ID:campaul,项目名称:RefactorLib,代码行数:28,代码来源:directive_test.py
示例12: getRanking
def getRanking(isbn):
import pudb
pudb.set_trace()
page = urlopen('%s%s' % (AMZN, isbn))
data = page.read()
page.close()
return REGEX.findall(data)[0]
开发者ID:stenin,项目名称:pld,代码行数:7,代码来源:bookrank.py
示例13: __call__
def __call__(self, *args, **kwargs):
if PY2 and self.func_name in ["<setcomp>", "<dictcomp>", "<genexpr>"]:
# D'oh! http://bugs.python.org/issue19611 Py2 doesn't know how to
# inspect set comprehensions, dict comprehensions, or generator
# expressions properly. They are always functions of one argument,
# so just do the right thing.
assert len(args) == 1 and not kwargs, "Surprising comprehension!"
callargs = {".0": args[0]}
else:
try:
callargs = inspect.getcallargs(self._func, *args, **kwargs)
except Exception as e:
import pudb
pudb.set_trace() # -={XX}=-={XX}=-={XX}=-
raise
frame = self._vm.make_frame(self.func_code, callargs, self.func_globals, self.func_locals)
CO_GENERATOR = 32 # flag for "this code uses yield"
if self.func_code.co_flags & CO_GENERATOR:
gen = Generator(frame, self._vm)
frame.generator = gen
retval = gen
else:
retval = self._vm.run_frame(frame)
return retval
开发者ID:Ryan311,项目名称:byterun,代码行数:25,代码来源:pyobj.py
示例14: debugger
def debugger(parser, token):
"""
Activates a debugger session in both passes of the template renderer
"""
pudb.set_trace()
return DebuggerNode()
开发者ID:Mause,项目名称:pyalp,代码行数:7,代码来源:debugger.py
示例15: get_gid
def get_gid(self, gid):
first = self._first_gid
last = self._first_gid
if gid >= self._first_gid and gid <= self.last_gid:
for sheet in self._sheets:
if gid >= sheet.first_gid and gid <= sheet.last_gid:
pudb.set_trace()
return sheet.get_gid(gid)
开发者ID:airena,项目名称:airena,代码行数:8,代码来源:map.py
示例16: app_loop_callback
def app_loop_callback(cls, dt):
cls.engine['window'].app_loop_tick()
# If we need to register something
if cls.first_registered_entity:
cls.entity_register(cls.first_registered_entity)
cls.first_registered_entity = None
# Reorder Entities by execution priority if necessary
if cls.entity_priority_dirty == True:
cls.entity_list.sort(
reverse=True,
key=lambda object:
object.priority if hasattr(object, "priority") else 0
)
cls.entity_priority_dirty = False
# If we have an input engine enabled we pass off to it
# to manage and process input events.
if cls.engine['input']:
cls.engine['input'].process_input()
if cls.debug and cls.keyboard_key_released(K_F11):
from pudb import set_trace; set_trace()
# For each entity in priority order we iterate their
# generators executing their code
if not cls.disable_entity_execution:
for entity in cls.entity_list:
cls.current_entity_executing = entity
entity._iterate_generator()
if cls.disable_entity_execution:
if not cls.screen_overlay is None:
cls.current_entity_executing = cls.screen_overlay
cls.screen_overlay._iterate_generator()
break
else:
if not cls.screen_overlay is None:
cls.current_entity_executing = cls.screen_overlay
cls.screen_overlay._iterate_generator()
# If we have marked any entities for removal we do that here
for x in cls.entities_to_remove:
if x in cls.entity_list:
cls.engine['gfx'].remove_entity(x)
cls.entity_list.remove(x)
cls.entities_to_remove = []
# Pass off to the gfx engine to display entities
cls.engine['gfx'].update_screen_pre()
cls.engine['gfx'].draw_entities(cls.entity_list)
cls.engine['gfx'].update_screen_post()
# Wait for next frame, hitting a particular fps
cls.fps = int(cls.clock.get_fps())
cls.clock.tick(cls.current_fps)
开发者ID:arcticshores,项目名称:Myrmidon,代码行数:56,代码来源:Game.py
示例17: test_lists
def test_lists(self):
line_compare = lists.attribute_comparison('line', 44)
lines = [lists.Line(i, l) for i, l in enumerate(
open(__file__).read().splitlines(), 1)]
actual = lists._search(lines, line_compare)
expected = None
try:
self.assertEqual(actual, expected)
except: # pylint: disable=bare-except
import pudb
pudb.set_trace()
开发者ID:jalanb,项目名称:pym,代码行数:11,代码来源:test_lists.py
示例18: chunkToSixBytes
def chunkToSixBytes(self, peerString):
"""
Helper function to covert the string to 6 byte chunks.
4 bytes for the IP address and 2 for the port.
"""
for i in xrange(0, len(peerString), 6):
chunk = peerString[i:i+6]
if len(chunk) < 6:
import pudb; pudb.set_trace()
raise IndexError("Size of the chunk was not six bytes.")
yield chunk
开发者ID:AchillesA,项目名称:bittorrent,代码行数:11,代码来源:peers.py
示例19: __init__
def __init__(self, *args, **kwargs):
print(args, kwargs)
from pudb import set_trace
set_trace()
super(Pig, self).__init__(direction=(0, 0),
speed=0,
gravity=9.8,
*args, **kwargs)
self.status = self.STATUS_ALIVE
开发者ID:fpischedda,项目名称:yaff,代码行数:11,代码来源:pig.py
示例20: add
def add(name, number, phonebook):
from pudb import set_trace; set_trace()
pb_id = db.get_phonebook_id(phonebook)
if pb_id:
status = db.add_entry(pb_id[0], (name, number))
if status:
print "%s added to %s with number %s" % (name, phonebook, number)
else:
print "Error: name: %s or number: %s already present in %s" % (name,number , phonebook)
else:
print "Error: phonebook does not exist"
开发者ID:mlauter,项目名称:hsphonebook,代码行数:11,代码来源:phonebook.py
注:本文中的pudb.set_trace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论