bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def bundles(self, pathname): """ Name ---- `bundles` (`pathname`) | def bundles(self, pathname): """ Name ---- `bundles` (`pathname`) | 446,400 |
def deserialize(self): """ Deserialize the contents of this bundle. | def deserialize(self): """ Deserialize the contents of this bundle. | 446,401 |
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | 446,402 |
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | 446,403 |
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | 446,404 |
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] nam... | 446,405 |
def test_cross_site_login_fails(self): response = self.client.post(self.login_path, { 'user': 'user', 'pass': 'pass'}) self.assertEquals(response.status_code, 403) | def test_cross_site_login_fails(self): response = self.client.post(self.login_path, { 'user': 'user', 'pass': 'pass'}) self.assertEquals(response.status_code, 403) | 446,406 |
def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post( self.endpoint_path, request_body, "text/xml") self.assertContains(response, "<methodResponse>", status_code=200) | def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post(endpoint_path, request_body, "text/xml") self.assertContains(response, "<methodResponse>", status_code=200) | 446,407 |
def test_test_result__unknown(self): obj = TestResult(result=TestResult.RESULT_UNKNOWN, id=1) self.assertEqual(unicode(obj), "#1 unknown") | def test_test_result__unknown(self): obj = TestResult(result=TestResult.RESULT_UNKNOWN, id=1) self.assertEqual(unicode(obj), "#1 unknown") | 446,408 |
def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" endpoint_path = reverse("dashboard_app.dashboard_xml_rpc_handler") request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post(endpoint_path, request_body, "text/xml") self.assertContains(respo... | def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" endpoint_path = reverse("xml-rpc") request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post(endpoint_path, request_body, "text/xml") self.assertContains(response, "<methodResponse>", status_... | 446,409 |
def test_debian_import_failure(self): """ Make sure we import debian_bundle if debian is not available """ self.prohibit_importing('debian.debian_support') self.mock_imports('launch_control.sw_profile') mocker = Mocker() obj = mocker.replace('debian_bundle.debian_support.version_compare') mocker.replay() import launch_... | def test_debian_import_failure(self): """ Make sure we import debian_bundle if debian is not available """ self.prohibit_importing('debian.debian_support') self.mock_imports('launch_control.sw_profile') mocker = Mocker() obj = mocker.replace('debian_bundle.debian_support.version_compare') mocker.replay() import launch_... | 446,410 |
... def _deserialize(cls, doc): | ... def _deserialize(cls, doc): | 446,411 |
def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value | def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value | 446,412 |
def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value | def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value | 446,413 |
def _set_duration(self, duration): if duration is not None and not isinstance(duration, timedelta): raise TypeError("Duration must be None or timedelta " "instance") if duration is not None and duration.days < 0: raise ValueError("Duration cannot be negative") self._duration = duration | def _set_duration(self, duration): if duration is not None and not isinstance(duration, timedelta): raise TypeError("Duration must be None or timedelta " "instance") if duration is not None and duration.days < 0: raise ValueError("Duration cannot be negative") self._duration = duration | 446,414 |
def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s:%d" % ( args.username, args.password, parts.host, parts.port or 80) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.sc... | def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s" % ( args.username, args.password, parts.host, parts.port or 80) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.schem... | 446,415 |
def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s:%d" % ( args.username, args.password, parts.host, parts.port or 80) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.sc... | def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s:%d" % ( args.username, args.password, parts.netloc) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.scheme, netloc, "/... | 446,416 |
def __eq__(self, other): return self.name == other.name and \ debian_version_compare(self.version, other.version) == 0 | def __eq__(self, other): return self.name == other.name and \ debian_version_compare(self.version, other.version) == 0 | 446,417 |
def memory_model_to_db_model(self, c_bundle, s_bundle): """ Translate a memory model to database model """ from dashboard_app.models import ( Attachment, HardwareDevice, NamedAttribute, SoftwarePackage, Test, TestCase, TestResult, TestRun, ) # All variables prefixed with c_ refer to CLIENT SIDE models # All variables p... | def memory_model_to_db_model(self, c_bundle, s_bundle): """ Translate a memory model to database model """ from dashboard_app.models import ( Attachment, HardwareDevice, NamedAttribute, SoftwarePackage, Test, TestCase, TestResult, TestRun, ) # All variables prefixed with c_ refer to CLIENT SIDE models # All variables p... | 446,418 |
def __init__(self): self.parser = argparse.ArgumentParser( description=""" Command line tool for interacting with Launch Control """, epilog=""" Please report all bugs using the Launchpad bug tracker: http://bugs.launchpad.net/launch-control/+filebug """, add_help=False) self.subparsers = self.parser.add_subparsers(tit... | def __init__(self): self.parser = argparse.ArgumentParser( description=""" Command line tool for interacting with Launch Control """, epilog=""" Please report all bugs using the Launchpad bug tracker: http://bugs.launchpad.net/launch-control/+filebug """, add_help=False) self.subparsers = self.parser.add_subparsers( ti... | 446,419 |
def __init__(self, test_result, test_id=None, message=None, timestamp=None, duration=None): """ Initialize qualitative sample instance. | def __init__(self, test_result, test_id=None, message=None, timestamp=None, duration=None): """ Initialize qualitative sample instance. | 446,420 |
def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRuns]}) | def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRuns]}) | 446,421 |
def test_allowed_for_anyone(self): with fixtures.created_bundle_streams(self.bundle_streams): pathnames = [bundle_stream.pathname for bundle_stream in BundleStream.objects.allowed_for_anyone().order_by('pathname')] self.assertEqual(pathnames, self.expected_pathnames) | def test_allowed_for_anyone(self): with fixtures.created_bundle_streams(self.bundle_streams): pathnames = [bundle_stream.pathname for bundle_stream in BundleStream.objects.allowed_for_anyone().order_by('pathname')] self.assertEqual(pathnames, self.expected_pathnames) | 446,422 |
def deserialize(self, content_sha1): """ Name ---- `deserialize` (`content_sha1`) | def deserialize(self, content_sha1): """ Name ---- `deserialize` (`content_sha1`) | 446,423 |
def drop_cap(prev_chunk, chunk): if not prev_chunk.text or not chunk.text: return False if not 1 <= len(prev_chunk.text) <= 2: return False if int(prev_chunk.get('height')) <= int(chunk.get('height')): return False drop_cap_horiz_gap = int(prev_chunk.get('width')) / 2 drop_cap_vert_gap = int(prev_chunk.get('height')) /... | def drop_cap(prev_chunk, chunk): if not prev_chunk.text or not chunk.text: return False if not 1 <= len(prev_chunk.text) <= 2: return False if int(prev_chunk.get('height')) <= int(chunk.get('height')): return False drop_cap_horiz_gap = int(prev_chunk.get('width'))... | 446,424 |
def main(): options = Options() parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') parser.add_option('--version', action='store_true', help='print version and exit') options.add_to_option_parser(parser) opts, args = parser.parse_args() if opts.version: print "pdf2html.py v%s by %s" % (__version__, _... | def main(): options = Options() parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') parser.add_option('--version', action='store_true', help='print version and exit') options.add_to_option_parser(parser) opts, args = parser.parse_args() if opts.version: print "pdf2html.py v%s by %s" % (__version__, _... | 446,425 |
def convert_pdf_to_html(pdf_file, html_file): tmpdir = tempfile.mkdtemp('pdf2html') try: xml_file = os.path.join(tmpdir, 'data') # pdf2html always adds .xml subprocess.check_call(['pdftohtml', '-xml', pdf_file, xml_file]) xml_file += '.xml' convert_pdfxml_to_html(xml_file, html_file) finally: shutil.rmtree(tmpdir) | def convert_pdf_to_html(pdf_file, html_file, debug=False): tmpdir = tempfile.mkdtemp('pdf2html') try: xml_file = os.path.join(tmpdir, 'data') # pdf2html always adds .xml subprocess.check_call(['pdftohtml', '-xml', pdf_file, xml_file]) xml_file += '.xml' convert_pdfxml_to_html(xml_file, html_file) finally: shutil.rmtree... | 446,426 |
def convert_pdf_to_html(pdf_file, html_file): tmpdir = tempfile.mkdtemp('pdf2html') try: xml_file = os.path.join(tmpdir, 'data') # pdf2html always adds .xml subprocess.check_call(['pdftohtml', '-xml', pdf_file, xml_file]) xml_file += '.xml' convert_pdfxml_to_html(xml_file, html_file) finally: shutil.rmtree(tmpdir) | def convert_pdf_to_html(pdf_file, html_file): tmpdir = tempfile.mkdtemp('pdf2html') try: xml_file = os.path.join(tmpdir, 'data') # pdf2html always adds .xml subprocess.check_call(['pdftohtml', '-xml', pdf_file, xml_file]) xml_file += '.xml' convert_pdfxml_to_html(xml_file, html_file, debug) finally: shutil.rmtree(tmpdi... | 446,427 |
def convert_pdfxml_to_html(xml_file, html_file): # The structure of the pdf2xml documents is this: # <pdf2xml> # <page number="1" position="absolute" top="0" left="0" # height="800" width="600" > # <fontspec id="0" size="12" family="Times" color="#000000" /> # ... # <text top="100" lef... | def convert_pdfxml_to_html(xml_file, html_file, debug=False): # The structure of the pdf2xml documents is this: # <pdf2xml> # <page number="1" position="absolute" top="0" left="0" # height="800" width="600" > # <fontspec id="0" size="12" family="Times" color="#000000" /> # ... # <text ... | 446,428 |
def main(): parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') opts, args = parser.parse_args() if len(args) < 1: parser.error('please specify an input file name') if len(args) > 2: parser.error('too many arguments') pdf_name = args[0] if len(args) > 1: output_name = args[1] else: output_name = os.p... | def main(): parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') opts, args = parser.parse_args() if len(args) < 1: parser.error('please specify an input file name') if len(args) > 2: parser.error('too many arguments') pdf_name = args[0] if len(args) > 1: output_name = args[1] else: output_name = os.p... | 446,429 |
def main(): parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') opts, args = parser.parse_args() if len(args) < 1: parser.error('please specify an input file name') if len(args) > 2: parser.error('too many arguments') pdf_name = args[0] if len(args) > 1: output_name = args[1] else: output_name = os.p... | def main(): parser = optparse.OptionParser(usage='%prog input.pdf [output.html]') opts, args = parser.parse_args() if len(args) < 1: parser.error('please specify an input file name') if len(args) > 2: parser.error('too many arguments') pdf_name = args[0] if len(args) > 1: output_name = args[1] else: output_name = os.p... | 446,430 |
def n_most_frequent(attr, n): frequencies = count_frequencies(attr) frequencies = [(freq, value) for value, freq in frequencies.items()] frequencies.sort() if False: # debug print attr + ':' for f, v in frequencies[-5:]: print f, v return [value for (freq, value) in frequencies[-n:]] | def n_most_frequent(attr, n): frequencies = count_frequencies(attr) frequencies = [(freq, value) for value, freq in frequencies.items()] frequencies.sort() if False: # debug print attr + ':' for f, v in frequencies[-5:]: print f, v return [value for (freq, value) in frequencies[-n:]] | 446,431 |
def n_most_frequent(attr, n): frequencies = count_frequencies(attr) frequencies = [(freq, value) for value, freq in frequencies.items()] frequencies.sort() if False: # debug print attr + ':' for f, v in frequencies[-5:]: print f, v return [value for (freq, value) in frequencies[-n:]] | def n_most_frequent(attr, n): frequencies = count_frequencies(attr) frequencies = [(freq, value) for value, freq in frequencies.items()] frequencies.sort() if False: # debug print attr + ':' for f, v in frequencies[-5:]: bar = '*' * (30 * f / frequencies[-1][0]) print ' %6d chunks have value %-6s %s' % (f, v, bar) ret... | 446,432 |
def looks_like_a_heading(chunk): if len(chunk) != 1: return False bold = chunk while bold.tag != 'b': if len(bold) != 1: return False bold = bold[0] return (fonts[chunk.get('font')] != most_frequent_font and int(chunk.get('height')) >= int(most_frequent_height) and bold.text and any(c.isalpha() for c in bold.text)) | def looks_like_a_heading(chunk): if len(chunk) != 1: return False bold = chunk while bold.tag != 'b': if len(bold) != 1: return False bold = bold[0] return (fonts[chunk.get('font')] != most_frequent_font and int(chunk.get('height')) >= int(most_frequent_height) and bold.text and any(c.isalpha() for c in bold.text)) | 446,433 |
def even_pages(page): "even pages" return int(page.get('number')) % 2 == 0 | def even_pages(page): "even pages" return int(page.get('number')) % 2 == 0 | 446,434 |
def detected(request, *args, **kwargs): middleware.process_request(request) return view(request, *args, **kwargs) | def detected(request, *args, **kwargs): Middleware.process_request(request) return view(request, *args, **kwargs) | 446,435 |
def detected(request, *args, **kwargs): middleware.process_request(request) return view(request, *args, **kwargs) | def detected(request, *args, **kwargs): middleware.process_request(request) return view(request, *args, **kwargs) | 446,436 |
def main(): usage = \ | def main(): usage = \ | 446,437 |
def handle_json_GET_routepatterns(self, params): """Given a route_id generate a list of patterns of the route. For each pattern include some basic information and a few sample trips.""" schedule = self.server.schedule route = schedule.GetRoute(params.get('route', None)) if not route: self.send_error(404) return time = ... | def handle_json_GET_routepatterns(self, params): """Given a route_id generate a list of patterns of the route. For each pattern include some basic information and a few sample trips.""" schedule = self.server.schedule route = schedule.GetRoute(params.get('route', None)) if not route: self.send_error(404) return time = ... | 446,438 |
def tzname(self): aheadUTC = self.minutes > 0 if aheadUTC: sign = '+' mins = self.minutes * -1 else: sign = '-' mins = self.minutes wholehours = int(self.minutes / 60.) minutesleft = self.minutes % 60 return """%s%0.2d%0.2d""" % (sign, wholehours, minutesleft) | def tzname(self): sign = '+' mins = self.minutes if mins < 0: sign = '-' mins = self.minutes wholehours = int(self.minutes / 60.) minutesleft = self.minutes % 60 return """%s%0.2d%0.2d""" % (sign, wholehours, minutesleft) | 446,439 |
def tzname(self): aheadUTC = self.minutes > 0 if aheadUTC: sign = '+' mins = self.minutes * -1 else: sign = '-' mins = self.minutes wholehours = int(self.minutes / 60.) minutesleft = self.minutes % 60 return """%s%0.2d%0.2d""" % (sign, wholehours, minutesleft) | def tzname(self): aheadUTC = self.minutes > 0 if aheadUTC: sign = '+' mins = self.minutes * -1 else: sign = '-' mins = mins * -1 wholehours = mins / 60 minutesleft = mins % 60 return """%s%0.2d%0.2d""" % (sign, wholehours, minutesleft) | 446,440 |
def getCriteriaItems(self): result = [] depth = (not self.Recurse() and 1) or -1 paths = ['/'.join(o.getPhysicalPath()) for o in self.Value()] | def getCriteriaItems(self): result = [] depth = (not self.Recurse() and 1) or -1 paths = ['/'.join(o.getPhysicalPath()) for o in self.Value()] | 446,441 |
def setText(self, value, **kwargs): """Body text mutator * hook into mxTidy an replace the value with the tidied value """ field = self.getField('text') # XXX this is ugly # When an object is initialized the first time we have to # set the filename and mimetype. # In the case the value is empty/None we must not set th... | def setText(self, value, **kwargs): """Body text mutator * hook into mxTidy an replace the value with the tidied value """ field = self.getField('text') # XXX this is ugly # When an object is initialized the first time we have to # set the filename and mimetype. # In the case the value is empty/None we must not set th... | 446,442 |
def setText(self, value, **kwargs): """Body text mutator * hook into mxTidy an replace the value with the tidied value """ field = self.getField('text') # XXX this is ugly # When an object is initialized the first time we have to # set the filename and mimetype. # In the case the value is empty/None we must not set th... | def setText(self, value, **kwargs): """Body text mutator * hook into mxTidy an replace the value with the tidied value """ field = self.getField('text') # XXX this is ugly # When an object is initialized the first time we have to # set the filename and mimetype. # In the case the value is empty/None we must not set th... | 446,443 |
print "def get_%s_icon_name_from_enum(enum):" % name | print "def get_%s_icon_name_from_enum(enum):" % name | 446,444 |
print "def get_%s_icon_name_from_enum(enum):" % name | print "def get_%s_icon_name_from_enum(enum):" % name | 446,445 |
print "def get_%s_animation_name_from_enum(enum):" % name | print "def get_%s_animation_name_from_enum(enum):" % name | 446,446 |
print "def get_%s_animation_name_from_enum(enum):" % name | print "def get_%s_animation_name_from_enum(enum):" % name | 446,447 |
print "def get_%s_animation_name_from_enum(enum):" % name | print "def get_%s_animation_name_from_enum(enum):" % name | 446,448 |
print "def get_%s_localised_past_from_enum(enum):" % name | print "def get_%s_localised_past_from_enum(enum):" % name | 446,449 |
print "def get_%s_localised_past_from_enum(enum):" % name | print "def get_%s_localised_past_from_enum(enum):" % name | 446,450 |
print "def get_%s_localised_past_from_enum(enum):" % name | print "def get_%s_localised_past_from_enum(enum):" % name | 446,451 |
print "def get_%s_localised_present_from_enum(enum):" % name | print "def get_%s_localised_present_from_enum(enum):" % name | 446,452 |
print "def get_%s_localised_present_from_enum(enum):" % name | print "def get_%s_localised_present_from_enum(enum):" % name | 446,453 |
print "def get_%s_localised_present_from_enum(enum):" % name | print "def get_%s_localised_present_from_enum(enum):" % name | 446,454 |
print "def get_%s_description_from_enum(enum):" % name | print "def get_%s_description_from_enum(enum):" % name | 446,455 |
print "def get_%s_description_from_enum(enum):" % name | print "def get_%s_description_from_enum(enum):" % name | 446,456 |
def test_AlmostEqual(self): self.assertAlmostEqual(1.00000001, 1.0) self.assertNotAlmostEqual(1.0000001, 1.0) self.assertRaises(self.failureException, self.assertAlmostEqual, 1.0000001, 1.0) self.assertRaises(self.failureException, self.assertNotAlmostEqual, 1.00000001, 1.0) | def test_AlmostEqual(self): self.assertAlmostEqual(1.00000001, 1.0) self.assertNotAlmostEqual(1.0000001, 1.0) self.assertRaises(self.failureException, self.assertAlmostEqual, 1.0000001, 1.0) self.assertRaises(self.failureException, self.assertNotAlmostEqual, 1.00000001, 1.0) | 446,457 |
def testDefault(self): self.assertFalse(unittest2.TestCase.longMessage) | def testDefault(self): self.assertFalse(unittest2.TestCase.longMessage) | 446,458 |
def testBufferOutputStartTestAddSuccess(self): real_out = self._real_out real_err = self._real_err result = unittest2.TestResult() self.assertFalse(result.buffer) result.buffer = True self.assertIs(real_out, sys.stdout) self.assertIs(real_err, sys.stderr) result.startTest(self) self.assertIsNot(real_out, sys.stdou... | def testBufferOutputStartTestAddSuccess(self): real_out = self._real_out real_err = self._real_err result = unittest2.TestResult() self.assertFalse(result.buffer) result.buffer = True self.assertIs(real_out, sys.stdout) self.assertIs(real_err, sys.stderr) result.startTest(self) self.assertIsNot(real_out, sys.stdou... | 446,459 |
def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | 446,460 |
def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | def testBufferOutputAddErrorOrFailure(self): for message_attr, add_attr, include_error in [ ('errors', 'addError', True), ('failures', 'addFailure', False), ('errors', 'addError', True), ('failures', 'addFailure', False) ]: result = self.getStartedResult() buffered_out = sys.stdout buffered_err = sys.stderr result._ori... | 446,461 |
def usageExit(self, msg=None): if msg: print msg usage = {'progName': self.progName, 'catchbreak': '', 'failfast': ''} if self.failfast != False: usage['failfast'] = FAILFAST if self.catchbreak != False: usage['catchbreak'] = CATCHBREAK print self.USAGE % usage sys.exit(2) | def usageExit(self, msg=None): if msg: print msg usage = {'progName': self.progName, 'catchbreak': '', 'failfast': ''} if self.failfast != False: usage['failfast'] = FAILFAST if self.catchbreak != False and installHandler is not None: usage['catchbreak'] = CATCHBREAK print self.USAGE % usage sys.exit(2) | 446,462 |
def parseArgs(self, argv): if len(argv) > 1 and argv[1].lower() == 'discover': self._do_discovery(argv[2:]) return | def parseArgs(self, argv): if len(argv) > 1 and argv[1].lower() == 'discover': self._do_discovery(argv[2:]) return | 446,463 |
def isfile(path): # another_dir is not a package and so shouldn't be recursed into return not path.endswith('dir') and not 'another_dir' in path | def isfile(path): # another_dir is not a package and so shouldn't be recursed into return not path.endswith('dir') and not 'another_dir' in path | 446,464 |
def isdir(_): return True | def isdir(_): return True | 446,465 |
def isdir(_): return True | def isdir(_): return True | 446,466 |
def isfile(path): # another_dir is not a package and so shouldn't be recursed into return not path.endswith('dir') and not 'another_dir' in path | def isfile(path): # another_dir is not a package and so shouldn't be recursed into return not path.endswith('dir') and not 'another_dir' in path | 446,467 |
def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. """ if fi... | If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. """ if file is None: file = sys.stderr if limit is None: if hasattr(sys, 'tracebacklimit'): limit = sys.tracebacklimit... | 446,468 |
def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. """ if fi... | def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. class TracebackCases(unittest2.TestCase): | 446,469 |
def format_tb(tb, limit = None): """A shorthand for 'format_list(extract_stack(f, limit)).""" return format_list(extract_tb(tb, limit)) | def get_exception_format(self, func, exc): try: func() except exc, value: return traceback.format_exception_only(exc, value) else: raise ValueError, "call did not raise exception" | 446,470 |
def extract_tb(tb, limit = None): """Return list of up to limit pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a quadruple (filename, line number, function name, text) repres... | def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a quadruple (filename, line number, function name, text) representing the info... | 446,471 |
def extract_tb(tb, limit = None): """Return list of up to limit pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a quadruple (filename, line number, function name, text) repres... | def extract_tb(tb, limit = None): """Return list of up to limit pre-processed entries from traceback. def syntax_error_with_caret_2(self): compile("1 +\n", "?", "exec") def syntax_error_without_caret(self): import test.badsyntax_nocaret def syntax_error_bad_indentation(self): compile("def spam():\n print 1\n print... | 446,472 |
def print_exception(etype, value, tb, limit=None, file=None): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value a... | This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError and value has the appropriate format, it prints the line where the syntax error occurre... | 446,473 |
def print_exception(etype, value, tb, limit=None, file=None): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value a... | def print_exception(etype, value, tb, limit=None, file=None): """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value a... | 446,474 |
def getContent(self): return getUtility(IRegistry).forInterface(self.schema) | def getContent(self): return getUtility(IRegistry).forInterface(self.schema, prefix=self.prefix) | 446,475 |
def open_socket(self): while 1 : try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) break except socket.error, (value,message): if self.server: self.server.close() print "Could not open socket: " + message time.sleep(1) | def open_socket(self): while 1 : try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) break except socket.error, (value,message): if self.server: self.server.close() time.sleep(1) | 446,476 |
def open_socket(self): while 1 : try: self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.bind((self.host,self.port)) self.server.listen(5) break except socket.error, (value,message): if self.server: self.server.close() print "Could not open socket: " + message time.sleep(1) | defopen_socket(self):while1:try:self.server=socket.socket(socket.AF_INET,socket.SOCK_STREAM)self.server.bind((self.host,self.port))self.server.listen(5)breakexceptsocket.error,(value,message):ifself.server:self.server.close()print"Couldnotopensocket:"+messagetime.sleep(1) | 446,477 |
def run(self): generate_html() | def run(self): generate_html() | 446,478 |
def run(self): generate_html() | defrun(self):generate_html() | 446,479 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,480 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,481 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,482 |
def run(self): running = 1 while running: message = self.client.recv(self.size) if message: f = open(self.address[0], 'w') message = '<p><strong>' + self.address[0] + '</strong>: \"' + message + '\"</p>\n' f.write(message) f.close() else: self.client.close() running = 0 | def run(self): running = 1 while running: message = self.client.recv(self.size) if message: f = open(self.address[0], 'w') message = '<p><strong>' + self.address[0] + '</strong>: ' + message + '</p>\n' f.write(message) f.close() else: self.client.close() running = 0 | 446,483 |
def get_output(cmd): pipe = os.popen(cmd) output = pipe.read() pipe.close() return output | team_name_map = { re.compile('WE20\d\d'): 'WrightEagle', re.compile('helios'): 'Helios', re.compile('nq{player,coach}'): 'LsuAmoyNQ', re.compile('oxsy'): 'Oxsy', re.compile('BS2k'): 'BrainStormer' } def get_output(cmd) : pipe = os.popen(cmd) output = pipe.read() pipe.close() return output | 446,484 |
def build_message( ): message = uptime() + ", " message += rcssserver() return message | def build_message( ) : message = uptime() + ", " message += rcssserver() return message | 446,485 |
def testing() : return get_output("ps -o comm= -e | sort | uniq -c | sort -nr | head -2 | awk '{print $2}'").strip().split('\n') | def find_testing_teams() : teams = [] process_list = get_output("ps -o comm= -e | sort | uniq").strip().split('\n') for process in process_list : for pattern in team_name_map.keys() : if pattern.match(process) : teams.append(team_name_map[pattern]) break if len(teams) >= 2 : break return teams | 446,486 |
def rcssserver() : output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; if count > 0: team = testing() return ' #rcssserver: %d,%s (%s,%s)' % (count, output[0], team[0], team[1]) return ' #rcssserver: 0' | def rcssserver() : output = get_output('ps -o user= -C rcssserver').split('\n'); count = len(output) - 1; if count > 0: team = testing() return ' #rcssserver: %d,%s (%s,%s)' % (count, output[0], team[0], team[1]) return ' #rcssserver: 0' | 446,487 |
def generate_html(self) : html_content = g_html_head for client in sorted(g_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_message_board[client] + '</p>\n' html_content += g_html_tail | def generate_html(self) : html_content = g_html_head for ip in sorted(g_message_board.keys()) : html_content += '<p><strong>' + ip + '</strong>: ' + g_message_board[ip] + '</p>\n' html_content += g_html_tail | 446,488 |
def __init__(self): self.host = '' self.port = 50000 self.size = 1024 self.server = None self.threads = [] | def __init__(self): self.host = '' self.port = 50000 self.server = None self.threads = [] | 446,489 |
def __init__(self): self.host = '' self.port = 50000 self.size = 1024 self.server = None self.threads = [] | def __init__(self): self.host = '' self.port = 50000 self.size = 1024 self.server = None self.threads = [] | 446,490 |
def run(self): c = HtmlGenerator() c.start() self.threads.append(c) | def run(self): c = HtmlGenerator() c.start() self.threads.append(c) | 446,491 |
def run(self): c = HtmlGenerator() c.start() self.threads.append(c) | def run(self): c = HtmlGenerator() c.start() self.threads.append(c) | 446,492 |
def __init__(self,(client,address)): threading.Thread.__init__(self) self.client = client self.address = address self.size = 1024 | def __init__(self,(client,address)): threading.Thread.__init__(self) self.client = client self.ip = address[0] self.size = 1024 | 446,493 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,494 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,495 |
def generate_html(self) : html_content = g_html_head for client in sorted(g_client_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_client_message_board[client] + '</p>\n' html_content += g_html_tail | def generate_html(self) : html_content = g_html_head for client in sorted(g_message_board.keys()) : html_content += '<p><strong>' + client + '</strong>: ' + g_message_board[client] + '</p>\n' html_content += g_html_tail | 446,496 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,497 |
def run(self): running = 1 while running: message = self.client.recv(self.size) | def run(self): running = 1 while running: message = self.client.recv(self.size) | 446,498 |
def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], info[1])... | def testing_status() : server_name = 'rcssserver' server_user = '' process_list = get_cmd_output('export LANG="POSIX"; ps -e -o comm,user=').strip().split('\n') process_list.pop(0) team_count_map = {} cmd_count_map = {} matched_cmds = {} for process in process_list : info = process.split() (cmd, user) = (info[0], in... | 446,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.