Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
1,300
def test_does_not_match_bad_arg_type_failure(self): try: assert_that('fred').does_not_match(123) fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('given pattern arg must be a string')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_does_not_match_bad_arg_type_failure
1,301
def test_does_not_match_bad_arg_empty_failure(self): try: assert_that('fred').does_not_match('') fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('given pattern arg must not be empty')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_does_not_match_bad_arg_empty_failure
1,302
def test_is_alpha_digit_failure(self): try: assert_that('foo123').is_alpha() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <foo123> to contain only alphabetic chars, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_alpha_digit_failure
1,303
def test_is_alpha_space_failure(self): try: assert_that('foo bar').is_alpha() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <foo bar> to contain only alphabetic chars, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_alpha_space_failure
1,304
def test_is_alpha_punctuation_failure(self): try: assert_that('foo,bar').is_alpha() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <foo,bar> to contain only alphabetic chars, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_alpha_punctuation_failure
1,305
def test_is_alpha_bad_value_type_failure(self): try: assert_that(123).is_alpha() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is not a string')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_alpha_bad_value_type_failure
1,306
def test_is_alpha_empty_value_failure(self): try: assert_that('').is_alpha() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is empty')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_alpha_empty_value_failure
1,307
def test_is_digit_alpha_failure(self): try: assert_that('foo123').is_digit() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <foo123> to contain only digits, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_digit_alpha_failure
1,308
def test_is_digit_space_failure(self): try: assert_that('1 000 000').is_digit() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <1 000 000> to contain only digits, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_digit_space_failure
1,309
def test_is_digit_punctuation_failure(self): try: assert_that('-123').is_digit() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <-123> to contain only digits, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_digit_punctuation_failure
1,310
def test_is_digit_bad_value_type_failure(self): try: assert_that(123).is_digit() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is not a string')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_digit_bad_value_type_failure
1,311
def test_is_digit_empty_value_failure(self): try: assert_that('').is_digit() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is empty')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_digit_empty_value_failure
1,312
def test_is_lower_failure(self): try: assert_that('FOO').is_lower() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <FOO> to contain only lowercase chars, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_lower_failure
1,313
def test_is_lower_bad_value_type_failure(self): try: assert_that(123).is_lower() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is not a string')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_lower_bad_value_type_failure
1,314
def test_is_lower_empty_value_failure(self): try: assert_that('').is_lower() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is empty')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_lower_empty_value_failure
1,315
def test_is_upper_failure(self): try: assert_that('foo').is_upper() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <foo> to contain only uppercase chars, but did not.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_upper_failure
1,316
def test_is_upper_bad_value_type_failure(self): try: assert_that(123).is_upper() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is not a string')
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_upper_bad_value_type_failure
1,317
def test_is_upper_empty_value_failure(self): try: assert_that('').is_upper() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('val is empty')
ValueError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_upper_empty_value_failure
1,318
def test_is_unicode_failure(self): try: assert_that(123).is_unicode() fail('should have raised error') except __HOLE__ as ex: assert_that(str(ex)).is_equal_to('Expected <123> to be unicode, but was <int>.')
AssertionError
dataset/ETHPy150Open ActivisionGameScience/assertpy/tests/test_string.py/TestString.test_is_unicode_failure
1,319
def fromTuple(self, locationTuple): """ Read the coordinates from a tuple. :: >>> t = (('pop', 1), ('snap', -100)) >>> l = Location() >>> l.fromTuple(t) >>> print(l) <Location pop:1, snap:-100 > """ for key...
TypeError
dataset/ETHPy150Open LettError/MutatorMath/Lib/mutatorMath/objects/location.py/Location.fromTuple
1,320
def asString(self, strict=False): """ Return the location as a string. :: >>> l = Location(pop=1, snap=(-100.0, -200)) >>> l.asString() 'pop:1, snap:(-100.000,-200.000)' """ if len(self.keys())==0: return "origin" v...
TypeError
dataset/ETHPy150Open LettError/MutatorMath/Lib/mutatorMath/objects/location.py/Location.asString
1,321
def isAmbivalent(self, dim=None): """ Return True if any of the factors are in fact tuples. If a dimension name is given only that dimension is tested. :: >>> l = Location(pop=1) >>> l.isAmbivalent() False >>> l = Location(pop=1, snap=(100,...
KeyError
dataset/ETHPy150Open LettError/MutatorMath/Lib/mutatorMath/objects/location.py/Location.isAmbivalent
1,322
def __sub__(self, other): new = self.__class__() new.update(self) for key, value in other.items(): try: new[key] = -value except __HOLE__: new[key] = (-value[0], -value[1]) selfDim = set(self.keys()) otherDim = set(other.key...
TypeError
dataset/ETHPy150Open LettError/MutatorMath/Lib/mutatorMath/objects/location.py/Location.__sub__
1,323
def _column_builder(self, col): """Return a callable that builds a column or aggregate object""" if len(col.name) > 1: # Aggregate try: aclass = aggregate_functions[col.name[0]] except __HOLE__: raise KeyError("Unknown aggregate functio...
KeyError
dataset/ETHPy150Open samuel/squawk/squawk/query.py/Query._column_builder
1,324
def check_constants(self): """Verify that all constant definitions evaluate to a value.""" for constant in self.constants: try: self.lookup_constant(constant) except __HOLE__ as e: fmt = "Constant '{name}' is undefined" self.append_...
KeyError
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/csparser/checker.py/Checker.check_constants
1,325
def get_service(hass, config): """Get the instapush notification service.""" if not validate_config({DOMAIN: config}, {DOMAIN: [CONF_API_KEY, 'app_secret', 'event', 'tracker'...
ValueError
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/notify/instapush.py/get_service
1,326
def get_tasks(): """Get the imported task classes for each task that will be run""" task_classes = [] for task_path in TASKS: try: module, classname = task_path.rsplit('.', 1) except __HOLE__: raise ImproperlyConfigured('%s isn\'t a task module' % task_path) t...
ValueError
dataset/ETHPy150Open jazzband/django-discover-jenkins/discover_jenkins/runner.py/get_tasks
1,327
def __getattr__(self, attr_name): try: return _wrap(self._d_[attr_name]) except __HOLE__: raise AttributeError( '%r object has no attribute %r' % (self.__class__.__name__, attr_name))
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/AttrDict.__getattr__
1,328
def __delattr__(self, attr_name): try: del self._d_[attr_name] except __HOLE__: raise AttributeError( '%r object has no attribute %r' % (self.__class__.__name__, attr_name))
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/AttrDict.__delattr__
1,329
@classmethod def get_dsl_type(cls, name): try: return cls._types[name] except __HOLE__: raise UnknownDslObject('DSL type %s does not exist.' % name)
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/DslMeta.get_dsl_type
1,330
@classmethod def get_dsl_class(cls, name): try: return cls._classes[name] except __HOLE__: raise UnknownDslObject('DSL class `%s` does not exist in %s.' % (name, cls._type_name))
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/DslBase.get_dsl_class
1,331
def __getattr__(self, name): if name.startswith('_'): raise AttributeError( '%r object has no attribute %r' % (self.__class__.__name__, name)) value = None try: value = self._params[name] except __HOLE__: # compound types should never ...
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/DslBase.__getattr__
1,332
def __getattr__(self, name): try: return super(ObjectBase, self).__getattr__(name) except __HOLE__: if name in self._doc_type.mapping: f = self._doc_type.mapping[name] if hasattr(f, 'empty'): value = f.empty() ...
AttributeError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/ObjectBase.__getattr__
1,333
def to_dict(self): out = {} for k, v in iteritems(self._d_): try: f = self._doc_type.mapping[k] if f._coerce: v = f.serialize(v) except __HOLE__: pass # don't serialize empty values # car...
KeyError
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/ObjectBase.to_dict
1,334
def _with_retries(self, pool, fn): """ Performs the passed function with retries against the given pool. :param pool: the connection pool to use :type pool: Pool :param fn: the function to pass a transport :type fn: function """ skip_nodes = [] d...
IOError
dataset/ETHPy150Open basho/riak-python-client/riak/client/transport.py/RiakClientTransport._with_retries
1,335
def find( menu ) : s = scope( menu ) try : findDialogue = s.scriptWindow.__findDialogue except __HOLE__ : findDialogue = GafferUI.NodeFinderDialogue( s.parent ) s.scriptWindow.addChildWindow( findDialogue ) s.scriptWindow.__findDialogue = findDialogue findDialogue.setScope( s.parent ) findDialogue.setVi...
AttributeError
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferUI/EditMenu.py/find
1,336
@api_endpoint(['POST']) def project_information(request): try: # TODO(marcua): Add checking for json.loads exceptions to all # endpoints. return get_project_information( json.loads(request.body.decode())['project_id']) except __HOLE__: raise BadRequest('project_id is ...
KeyError
dataset/ETHPy150Open unlimitedlabs/orchestra/orchestra/project_api/views.py/project_information
1,337
@api_endpoint(['POST']) def create_project(request): project_details = json.loads(request.body.decode()) try: if project_details['task_class'] == 'real': task_class = WorkerCertification.TaskClass.REAL else: task_class = WorkerCertification.TaskClass.TRAINING args...
KeyError
dataset/ETHPy150Open unlimitedlabs/orchestra/orchestra/project_api/views.py/create_project
1,338
def savepid (self): self._saved_pid = False if not self.pid: return True ownid = os.getpid() flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY mode = ((os.R_OK | os.W_OK) << 6) | (os.R_OK << 3) | os.R_OK try: fd = os.open(self.pid,flags,mode) except OSError: self.logger.daemon("PIDfile already exi...
IOError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon.savepid
1,339
def removepid (self): if not self.pid or not self._saved_pid: return try: os.remove(self.pid) except __HOLE__,exc: if exc.errno == errno.ENOENT: pass else: self.logger.daemon("Can not remove PIDfile %s" % self.pid,'error') return self.logger.daemon("Removed PIDfile %s" % self.pid)
OSError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon.removepid
1,340
def drop_privileges (self): """return true if we are left with insecure privileges""" # os.name can be ['posix', 'nt', 'os2', 'ce', 'java', 'riscos'] if os.name not in ['posix',]: return True uid = os.getuid() gid = os.getgid() if uid and gid: return True try: user = pwd.getpwnam(self.user) ...
OSError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon.drop_privileges
1,341
def _is_socket (self, fd): try: s = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW) except __HOLE__: # The file descriptor is closed return False try: s.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE) except socket.error,exc: # It is look like one but it is not a socket ... if exc.args[0] == ...
ValueError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon._is_socket
1,342
def daemonise (self): if not self.daemonize: return log = environment.settings().log if log.enable and log.destination.lower() in ('stdout','stderr'): self.logger.daemon('ExaBGP can not fork when logs are going to %s' % log.destination.lower(),'critical') return def fork_exit (): try: pid = os...
OSError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon.daemonise
1,343
def silence (self): # closing more would close the log file too if open maxfd = 3 for fd in range(0, maxfd): try: os.close(fd) except __HOLE__: pass os.open("/dev/null", os.O_RDWR) os.dup2(0, 1) os.dup2(0, 2) # import resource # if 'linux' in sys.platform: # nofile = resource.RLIMIT_N...
OSError
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/reactor/daemon.py/Daemon.silence
1,344
def find_retained_introns(gene): '''Given a bundle of transcripts, find intervals matching retained introns. A retained intron is defined as an interval from an exon/intron boundary to the next where both boundaries are in the same exon of another transcript''' intron_intervals = [GTF.toIntronInter...
StopIteration
dataset/ETHPy150Open CGATOxford/cgat/scripts/gtf2gtf.py/find_retained_introns
1,345
def main(argv=None): if not argv: argv = sys.argv parser = E.OptionParser(version="%prog version: $Id$", usage=globals()["__doc__"]) parser.add_option("--merge-exons-distance", dest="merge_exons_distance", type="int", ...
AttributeError
dataset/ETHPy150Open CGATOxford/cgat/scripts/gtf2gtf.py/main
1,346
def testInterface(algo): """ Tests whether the algorithm is properly implementing the correct Blackbox-optimization interface.""" # without any arguments, initialization has to work emptyalgo = algo() try: # but not learning emptyalgo.learn(0) return "Failed to throw missing ...
AssertionError
dataset/ETHPy150Open pybrain/pybrain/pybrain/tests/optimizationtest.py/testInterface
1,347
def testContinuousInterface(algo): """ Test the specifics for the interface for ContinuousOptimizers """ if not issubclass(algo, bbo.ContinuousOptimizer): return True # list starting points are internally converted to arrays x = algo(sf, xlist2) assert isinstance(x.bestEvaluable, ndarray), '...
ValueError
dataset/ETHPy150Open pybrain/pybrain/pybrain/tests/optimizationtest.py/testContinuousInterface
1,348
def testOnEvolvable(algo): if issubclass(algo, bbo.ContinuousOptimizer): return True if issubclass(algo, bbo.TopologyOptimizer): try: algo(evoEval, evo1).learn(1) return "Topology optimizers should not accept arbitrary Evolvables" except __HOLE__: retu...
AttributeError
dataset/ETHPy150Open pybrain/pybrain/pybrain/tests/optimizationtest.py/testOnEvolvable
1,349
def find_library_file(self, dirs, lib, debug=0): shortlib = '%s.lib' % lib longlib = 'lib%s.lib' % lib # this form very rare # get EMX's default library directory search path try: emx_dirs = os.environ['LIBRARY_PATH'].split(';') except __HOLE__: emx_di...
KeyError
dataset/ETHPy150Open babble/babble/include/jython/Lib/distutils/emxccompiler.py/EMXCCompiler.find_library_file
1,350
def check_config_h(): """Check if the current Python installation (specifically, pyconfig.h) appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: CONFIG_H_OK all is well, go ahead and compile CONFIG_H_NOT...
IOError
dataset/ETHPy150Open babble/babble/include/jython/Lib/distutils/emxccompiler.py/check_config_h
1,351
def dumps(self, msg, use_bin_type=False): ''' Run the correct dumps serialization format :param use_bin_type: Useful for Python 3 support. Tells msgpack to differentiate between 'str' and 'bytes' types by encoding them differently. ...
TypeError
dataset/ETHPy150Open saltstack/salt/salt/payload.py/Serial.dumps
1,352
def run(self, node, ip_address, platform, poller, mon_protocol, std_community, community, status): """ Create an node in an Orion monitoring platform. """ results = {} # Sort out whic...
IndexError
dataset/ETHPy150Open StackStorm/st2contrib/packs/orion/actions/node_create.py/NodeCreate.run
1,353
def admin(args): cfg = conf.ceph.load(args) conf_data = StringIO() cfg.write(conf_data) try: with file('%s.client.admin.keyring' % args.cluster, 'rb') as f: keyring = f.read() except: raise RuntimeError('%s.client.admin.keyring not found' % arg...
RuntimeError
dataset/ETHPy150Open ceph/ceph-deploy/ceph_deploy/admin.py/admin
1,354
def viewhereaccessor(context): U = hereaccessor(context) i = 1 while True: try: params = context.locate(inevow.IViewParameters, depth=i) except __HOLE__: break for (cmd, args, kw) in iter(params): U = getattr(U, cmd)(*args, **kw) i += 1 ...
KeyError
dataset/ETHPy150Open twisted/nevow/nevow/url.py/viewhereaccessor
1,355
def url(self, obj): try: return self._objmap.get(obj, None) except __HOLE__: return None
TypeError
dataset/ETHPy150Open twisted/nevow/nevow/url.py/URLGenerator.url
1,356
def do_GET(self): datadir = os.path.join(os.path.split(__file__)[0], "sample_provider_pages") # remove the first character because includes / submitted_url = self.path[1:len(self.path)+1] # separate everything after & because is id try: (url_part, arg_part) = submitt...
ValueError
dataset/ETHPy150Open Impactstory/total-impact-core/extras/functional_tests/alt_providers_test_proxy.py/ProvidersTestProxy.do_GET
1,357
def login(request): if 'openid' in request.GET or request.method == 'POST': form = LoginForm( dict(list(request.GET.items()) + list(request.POST.items())) ) if form.is_valid(): client = _openid_consumer(request) try: auth_request = client.b...
UnicodeDecodeError
dataset/ETHPy150Open pennersr/django-allauth/allauth/socialaccount/providers/openid/views.py/login
1,358
def __getattr__(self, key): if key in self._registered_documents: document = self._registered_documents[key] try: return getattr(self[document.__database__][document.__collection__], key) except __HOLE__: raise AttributeError("%s: __collection_...
AttributeError
dataset/ETHPy150Open namlook/mongokit/mongokit/connection.py/MongoKitConnection.__getattr__
1,359
def authorize_client(client, auth_type=None, service=None, source=None, scopes=None, oauth_type=None, consumer_key=None, consumer_secret=None): """Uses command line arguments, or prompts user for token values.""" if auth_type is None: auth_type = int(get_param( ...
IOError
dataset/ETHPy150Open kuri65536/python-for-android/python-build/python-libs/gdata/build/lib/gdata/sample_util.py/authorize_client
1,360
def launch_gevent_wsgi_server(application, port, max_concurrent_requests, server_name='server', use_pywsgi=False, **kwargs): """Set up and launch a Gevent WSGI server in the local process. The server will run forever and shut down cleanly when receiving a...
KeyboardInterrupt
dataset/ETHPy150Open tellapart/gevent_request_profiler/tellapart/frontend/util.py/launch_gevent_wsgi_server
1,361
def parse_amount(amount): to_find = [] try: if ',' in amount: # if a comma seperation (e.g. 10,11,12) is specified temp = amount.split(',') for i in temp: to_find.append(int(i)) return to_find elif '-' in amount: # if a range (e.g. 10-20) is specified temp = amount.split('-') for i in ran...
ValueError
dataset/ETHPy150Open AdamGreenhill/VirusShare-Search/VirusShare-Search.py/parse_amount
1,362
def update(directory, amount, latest): try: l = int(latest) except __HOLE__: print(" ERROR: incorrect value given for latest hash release.") exit() if amount == "all": # Downloads all md5 files for i in range(0,l): downloader(directory,i) elif amount == "missing": # Finds all md5 files not in a dir...
ValueError
dataset/ETHPy150Open AdamGreenhill/VirusShare-Search/VirusShare-Search.py/update
1,363
def find_yajl_cffi(ffi, required): ''' Finds and loads yajl shared object of the required major version (1, 2, ...) using cffi. ''' try: yajl = ffi.dlopen('yajl') except __HOLE__: raise YAJLImportError('Unable to load YAJL.') require_version(yajl.yajl_version(), required) ...
OSError
dataset/ETHPy150Open isagalaev/ijson/ijson/backends/__init__.py/find_yajl_cffi
1,364
def assertIsSuperAndSubsequence(self, super_seq, sub_seq, msg=None): super_seq = list(super_seq) sub_seq = list(sub_seq) current_tail = super_seq for sub_elem in sub_seq: try: super_index = current_tail.index(sub_elem) except __HOLE__: ...
ValueError
dataset/ETHPy150Open openstack/taskflow/taskflow/test.py/TestCase.assertIsSuperAndSubsequence
1,365
def testReadandValidateSchemaFromFile(self): infile = os.path.join(self.dirname, 'test_schema_file') f = open(infile, 'wt') f.write(test_util.GetCarsSchemaString()) f.close() read_schema = load_lib.ReadSchemaFile(infile) load_lib._ValidateExtendedSchema(read_schema) expected_schema = json.lo...
ValueError
dataset/ETHPy150Open google/encrypted-bigquery-client/src/load_lib_test.py/LoadLibraryTest.testReadandValidateSchemaFromFile
1,366
def testReadandValidateNestedSchemaFromFile(self): infile = os.path.join(self.dirname, 'test_nested_schema_file') f = open(infile, 'wt') f.write(test_util.GetPlacesSchemaString()) f.close() read_schema = load_lib.ReadSchemaFile(infile) load_lib._ValidateExtendedSchema(read_schema) expected_s...
ValueError
dataset/ETHPy150Open google/encrypted-bigquery-client/src/load_lib_test.py/LoadLibraryTest.testReadandValidateNestedSchemaFromFile
1,367
def testReadandValidateMultipleNestedSchemaFromFile(self): infile = os.path.join(self.dirname, 'test_multiple_nested_schema_file') f = open(infile, 'wt') f.write(test_util.GetJobsSchemaString()) f.close() read_schema = load_lib.ReadSchemaFile(infile) load_lib._ValidateExtendedSchema(read_schema)...
ValueError
dataset/ETHPy150Open google/encrypted-bigquery-client/src/load_lib_test.py/LoadLibraryTest.testReadandValidateMultipleNestedSchemaFromFile
1,368
@unittest.skip("doesn't work in docker") def test_out_of_disk_space_message(self): # this test can only be run as root becasue it needs to create # a tmpfs temporary partition to invoke the correct exception def executeTest(ramdiskdir): openFiles = Storage.OpenFiles(10) ...
OSError
dataset/ETHPy150Open ufora/ufora/ufora/distributed/SharedState/Storage/FileIO_test.py/FileIOTest.test_out_of_disk_space_message
1,369
def _add_trace_comments(engine): """Add trace comments. Augment statements with a trace of the immediate calling code for a given statement. """ import os import sys import traceback target_paths = set([ os.path.dirname(sys.modules['oslo_db'].__file__), os.path.dirname(...
KeyError
dataset/ETHPy150Open openstack/oslo.db/oslo_db/sqlalchemy/engines.py/_add_trace_comments
1,370
def __setitem__(self, key, value): try: del self[key] except __HOLE__: pass self._items.append((key, value))
KeyError
dataset/ETHPy150Open benoitc/restkit/restkit/datastructures.py/MultiDict.__setitem__
1,371
def fastq_stats(fastq, quiet=False): lengths = [] # how many reads are exactly this length? posquals = [] # accumulator of quality values for each position # (not all the values, but an accumulator for each value at each position) qualities = [] # quality accumulator for each posit...
KeyboardInterrupt
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/fastq/stats.py/fastq_stats
1,372
def available_python_versions(self): """Get the executable names of available versions of Python on the system. """ for py in supported_pythons: try: check_call([py, '-c', 'import nose'], stdout=PIPE) yield py except (__HOLE__, CalledProces...
OSError
dataset/ETHPy150Open networkx/networkx/tools/test_pr.py/TestRun.available_python_versions
1,373
def setup(self): """Prepare the repository and virtualenvs.""" try: os.mkdir(basedir) except __HOLE__ as e: if e.errno != errno.EEXIST: raise os.chdir(basedir) # Delete virtualenvs and recreate for venv in glob('ven...
OSError
dataset/ETHPy150Open networkx/networkx/tools/test_pr.py/TestRun.setup
1,374
def __init__(self, target, onDelete=None): """Return a weak-reference-like instance for a bound method target -- the instance-method target for the weak reference, must have im_self and im_func attributes and be reconstructable via: target.im_func.__get__( target...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/dispatch/saferef.py/BoundMethodWeakref.__init__
1,375
def _description(self, test): if self._format: try: return self._format.format( method_name=str(test), short_description=test.shortDescription() or '') except __HOLE__: sys.exit(_( 'Bad format str...
KeyError
dataset/ETHPy150Open mblayman/tappy/tap/plugins/_nose.py/TAP._description
1,376
def children(self): """ List the children of this path object. @raise OSError: If an error occurs while listing the directory. If the error is 'serious', meaning that the operation failed due to an access violation, exhaustion of some kind of resource (file descriptors or ...
OSError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/filepath.py/AbstractFilePath.children
1,377
def restat(self, reraise=True): """ Re-calculate cached effects of 'stat'. To refresh information on this path after you know the filesystem may have changed, call this method. @param reraise: a boolean. If true, re-raise exceptions from L{os.stat}; otherwise, mark this path a...
OSError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/filepath.py/FilePath.restat
1,378
def touch(self): """ Updates the access and last modification times of the file at this file path to the current time. Also creates the file if it does not already exist. @raise Exception: if unable to create or modify the last modification time of the file. ...
IOError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/filepath.py/FilePath.touch
1,379
def moveTo(self, destination, followLinks=True): """ Move self to destination - basically renaming self to whatever destination is named. If destination is an already-existing directory, moves all children to destination if destination is empty. If destination is a non-empty di...
OSError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/filepath.py/FilePath.moveTo
1,380
@classmethod def isDate(cls, value, country='nl'): """ Check if value is a valid date. @@@ Still add checking on leap year >>> v = Validator() >>> v.isDate('2003/04/04') True >>> v.isDate('04/04/2004') True >>> v.is...
TypeError
dataset/ETHPy150Open petrvanblokland/Xierpa3/xierpa3/toolbox/parsers/validator.py/Validator.isDate
1,381
@classmethod def isEmail(cls, s): """ Test if s is a valid email adres. Testing is done on: - pattern - Only one @ - No characters > 127 in user - No characters > 127 in domain - Valid user name pattern - Valid ip number pattern - Valid...
IndexError
dataset/ETHPy150Open petrvanblokland/Xierpa3/xierpa3/toolbox/parsers/validator.py/Validator.isEmail
1,382
def build_extension(self, ext): """Wrap `build_extension` with `BuildFailed`.""" try: # Uncomment to test compile failures: # raise errors.CCompilerError("OOPS") build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed() ...
ValueError
dataset/ETHPy150Open psd-tools/psd-tools/setup.py/ve_build_ext.build_extension
1,383
def it_can_validate_a_hex_RGB_string(self, valid_fixture): str_value, exception = valid_fixture if exception is None: try: ST_HexColorRGB.validate(str_value) except __HOLE__: raise AssertionError( "string '%s' did not validate" ...
ValueError
dataset/ETHPy150Open scanny/python-pptx/tests/oxml/test_simpletypes.py/DescribeST_HexColorRGB.it_can_validate_a_hex_RGB_string
1,384
def emit(self, record): """ Emit a record. Output the record to the file, catering for rollover as described in doRollover(). """ try: if self.shouldRollover(record): self.doRollover() logging.FileHandler.emit(self, record) ...
KeyboardInterrupt
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/BaseRotatingHandler.emit
1,385
def emit(self, record): """ Emit a record. Pickles the record and writes it to the socket in binary format. If there is an error with the socket, silently drop the packet. If there was a problem with the socket, re-establishes the socket. """ try: ...
SystemExit
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/SocketHandler.emit
1,386
def emit(self, record): """ Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. """ msg = self.format(record) + '\000' """ We need to convert record level to lowerc...
SystemExit
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/SysLogHandler.emit
1,387
def emit(self, record): """ Emit a record. Format the record and send it to the specified addressees. """ try: import smtplib from email.utils import formatdate port = self.mailport if not port: port = smtplib.SMTP_...
SystemExit
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/SMTPHandler.emit
1,388
def __init__(self, appname, dllname=None, logtype="Application"): logging.Handler.__init__(self) try: import win32evtlogutil, win32evtlog self.appname = appname self._welu = win32evtlogutil if not dllname: dllname = os.path.split(self._welu...
ImportError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/NTEventLogHandler.__init__
1,389
def emit(self, record): """ Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log. """ if self._welu: try: id = self.getMessageID(record) cat = self.getEventCategory(re...
KeyboardInterrupt
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/NTEventLogHandler.emit
1,390
def emit(self, record): """ Emit a record. Send the record to the Web server as a percent-encoded dictionary """ try: import httplib, urllib host = self.host h = httplib.HTTP(host) url = self.url data = urllib.urlencode...
SystemExit
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/logging/handlers.py/HTTPHandler.emit
1,391
def make_string_packer(padding=" ", nullterminated=False): def pack_string(space, packer, width): try: w_s = packer.args_w[packer.args_index] except __HOLE__: raise space.error(space.w_ArgumentError, "too few arguments") string = space.str_w(space.convert_type(w_s, sp...
IndexError
dataset/ETHPy150Open topazproject/topaz/topaz/utils/packing/stringpacking.py/make_string_packer
1,392
def annotate_stacktrace(self, stacktrace): out = '' for ln in stacktrace.splitlines(): out += ln + '\n' match = re.search(r'/static/min/(.+)(\.[0-9a-f]+)\.js:(\d+):(\d+)', ln) if match: # Get the appropriate source map for the minified file. ...
IndexError
dataset/ETHPy150Open zulip/zulip/zerver/lib/unminify.py/SourceMap.annotate_stacktrace
1,393
def is_supported(): """ Return True if Lua scripting is supported """ global _supported if _supported is not None: return _supported try: import lupa except __HOLE__: log.msg("WARNING: Lua scripting is not available because 'lupa' Python package is not installed") _s...
ImportError
dataset/ETHPy150Open scrapinghub/splash/splash/lua.py/is_supported
1,394
def decode(bytes_sequence, encodings): """Return the first successfully decoded string""" for encoding in encodings: try: decoded = bytes_sequence.decode(encoding) return decoded except __HOLE__: # Try the next in the list. pass raise DecodeErr...
UnicodeDecodeError
dataset/ETHPy150Open pjdietz/rester-sublime-http-client/rester/http.py/decode
1,395
def run(self): """Method to run when the thread is started.""" if not self._validate_request(): return # Determine the class to use for the connection. if self.request.protocol == "https": try: connection_class = HTTPSConnection excep...
NameError
dataset/ETHPy150Open pjdietz/rester-sublime-http-client/rester/http.py/HttpClientRequestThread.run
1,396
def _read_response(self, curl_output): # Build a new response. self.response = Response() # Read the metadata appended to the end of the request. meta = curl_output[curl_output.rfind(b"\n\n"):] meta = meta.decode("ascii") meta = json.loads(meta) size_header = me...
ValueError
dataset/ETHPy150Open pjdietz/rester-sublime-http-client/rester/http.py/CurlRequestThread._read_response
1,397
def test_listrecursion(self): x = [] x.append(x) try: json.dumps(x) except ValueError: pass else: self.fail("didn't raise ValueError on list recursion") x = [] y = [x] x.append(y) try: json.dumps(x) ...
ValueError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/simplejson/tests/test_recursion.py/TestRecursion.test_listrecursion
1,398
def test_dictrecursion(self): x = {} x["test"] = x try: json.dumps(x) except __HOLE__: pass else: self.fail("didn't raise ValueError on dict recursion") x = {} y = {"a": x, "b": x} # ensure that the marker is cleared ...
ValueError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/simplejson/tests/test_recursion.py/TestRecursion.test_dictrecursion
1,399
def test_defaultrecursion(self): enc = RecursiveJSONEncoder() self.assertEquals(enc.encode(JSONTestObject), '"JSONTestObject"') enc.recurse = True try: enc.encode(JSONTestObject) except __HOLE__: pass else: self.fail("didn't raise Value...
ValueError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/simplejson/tests/test_recursion.py/TestRecursion.test_defaultrecursion