本文整理汇总了Python中pudb.set_trace函数的典型用法代码示例。如果您正苦于以下问题:Python set_trace函数的具体用法?Python set_trace怎么用?Python set_trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_trace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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")
示例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)
示例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()
示例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)
示例7: execusercustomize
def execusercustomize():
"""Run custom user specific code, if available."""
try:
import usercustomize
except ImportError:
import pudb ; pudb.set_trace()
pass
示例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
示例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
示例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`")
示例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)
示例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]
示例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
示例14: debugger
def debugger(parser, token):
"""
Activates a debugger session in both passes of the template renderer
"""
pudb.set_trace()
return DebuggerNode()
示例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)