Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
1,300
def get_week(self): """ Return the week for which this view should display data """ week = self.week if week is None: try: week = self.kwargs['week'] except KeyError: try: week = self.request.GET['week'] ...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/WeekMixin.get_week
1,301
def _date_from_string(year, year_format, month='', month_format='', day='', day_format='', delim='__'): """ Helper: get a datetime.date object given a format string and a year, month, and day (only year is mandatory). Raise a 404 for an invalid date. """ format = delim.join((year_format, month_forma...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/_date_from_string
1,302
def _get_next_prev(generic_view, date, is_previous, period): """ Helper: Get the next or the previous valid date. The idea is to allow links on month/day views to never be 404s by never providing a date that'll be invalid for the given view. This is a bit complicated since it handles different inte...
IndexError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/_get_next_prev
1,303
def __getattr__(self, attr): try: return getattr(self._obj, attr) except __HOLE__: return wrapped(self._obj.Get, attr)
AttributeError
dataset/ETHPy150Open tjguk/winsys/winsys/active_directory.py/IADs.__getattr__
1,304
def _parseClientTCP(*args, **kwargs): """ Perform any argument value coercion necessary for TCP client parameters. Valid positional arguments to this function are host and port. Valid keyword arguments to this function are all L{IReactorTCP.connectTCP} arguments. @return: The coerced values a...
KeyError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/endpoints.py/_parseClientTCP
1,305
def _loadCAsFromDir(directoryPath): """ Load certificate-authority certificate objects in a given directory. @param directoryPath: a L{FilePath} pointing at a directory to load .pem files from. @return: a C{list} of L{OpenSSL.crypto.X509} objects. """ from twisted.internet import ssl ...
IOError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/endpoints.py/_loadCAsFromDir
1,306
def _parseClientUNIX(*args, **kwargs): """ Perform any argument value coercion necessary for UNIX client parameters. Valid keyword arguments to this function are all L{IReactorUNIX.connectUNIX} keyword arguments except for C{checkPID}. Instead, C{lockfile} is accepted and has the same meaning. Al...
KeyError
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/endpoints.py/_parseClientUNIX
1,307
def _find_calls(self): calls = [] stack = [] for m in self._profile_mmaps: m.seek(0) while True: b = m.read(struct.calcsize("=B")) if not b: break marker, = struct.unpack("=B", b) if marke...
IndexError
dataset/ETHPy150Open alex/tracebin/client/tracebin/recorder.py/Recorder._find_calls
1,308
def __getitem__(self, key): for dict in self.dicts: try: return dict[key] except __HOLE__: pass raise KeyError
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MergeDict.__getitem__
1,309
def get(self, key, default=None): try: return self[key] except __HOLE__: return default
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MergeDict.get
1,310
def getlist(self, key): for dict in self.dicts: try: return dict.getlist(key) except __HOLE__: pass raise KeyError
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MergeDict.getlist
1,311
def __getitem__(self, key): """ Returns the last data value for this key, or [] if it's an empty list; raises KeyError if not found. """ try: list_ = dict.__getitem__(self, key) except __HOLE__: raise MultiValueDictKeyError, "Key %r not found in %r...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MultiValueDict.__getitem__
1,312
def get(self, key, default=None): "Returns the default value if the requested data doesn't exist" try: val = self[key] except __HOLE__: return default if val == []: return default return val
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MultiValueDict.get
1,313
def getlist(self, key): "Returns an empty list if the requested data doesn't exist" try: return dict.__getitem__(self, key) except __HOLE__: return []
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MultiValueDict.getlist
1,314
def update(self, *args, **kwargs): "update() extends rather than replaces existing key lists. Also accepts keyword args." if len(args) > 1: raise TypeError, "update expected at most 1 arguments, got %d", len(args) if args: other_dict = args[0] if isinstance(ot...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/MultiValueDict.update
1,315
def __init__(self, key_to_list_mapping): for k, v in key_to_list_mapping.items(): current = self bits = k.split('.') for bit in bits[:-1]: current = current.setdefault(bit, {}) # Now assign value to current position try: ...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/datastructures.py/DotExpandedDict.__init__
1,316
def Dial(proto, *args): """ A Dial is a generic client for stream-oriented protocols. Example:: conn, err = Dial("tcp", ('127.0.0.1', 8000)) conn.write("hello") print(conn.read()) """ try: dial_func = DIAL_HANDLERS[proto] except __HOLE__: raise ValueError("...
KeyError
dataset/ETHPy150Open benoitc/flower/flower/net/__init__.py/Dial
1,317
def Listen(addr=('0.0.0.0', 0), proto="tcp", *args): """A Listener is a generic network listener for stream-oriented protocols. Multiple tasks may invoke methods on a Listener simultaneously. Example:: def handle_connection(conn): while True: data = conn.re...
KeyError
dataset/ETHPy150Open benoitc/flower/flower/net/__init__.py/Listen
1,318
def _checkConsistency(richInputs, fsm, inputContext): """ Verify that the outputs that can be generated by fsm have their requirements satisfied by the given rich inputs. @param richInputs: A L{list} of all of the types which will serve as rich inputs to an L{IFiniteStateMachine}. @type ric...
KeyError
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/_checkConsistency
1,319
def receive(self, input): current = self.table[self.state] if input not in self.inputs.iterconstants(): raise IllegalInput(input) try: transition = current[input] except __HOLE__: raise UnhandledInput(self.state, input) self.state = transiti...
KeyError
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/_FiniteStateMachine.receive
1,320
def __init__(self, original, prefix="output_"): """ @param original: Any old object with a bunch of methods using the specified method prefix. @param prefix: The string prefix which will be used for method dispatch. For example, if C{"foo_"} is given then to execute the...
AttributeError
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/MethodSuffixOutputer.__init__
1,321
def __get__(self, obj, cls): if obj is None: return self if self._getter(obj) in self._allowed: try: return obj.__dict__[self] except __HOLE__: raise AttributeError() raise WrongState(self, obj)
KeyError
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/stateful.__get__
1,322
def __delete__(self, obj): if self._getter(obj) not in self._allowed: raise WrongState(self, obj) try: del obj.__dict__[self] except __HOLE__: raise AttributeError()
KeyError
dataset/ETHPy150Open ClusterHQ/machinist/machinist/_fsm.py/stateful.__delete__
1,323
def func_factory(method): try: func = getattr(math, method) except __HOLE__: return def inner(arg1, arg2=None): try: return func(arg1, arg2) except TypeError: return func(arg1) inner.__name__ = method doc = func.__doc__.splitlines() if len(...
AttributeError
dataset/ETHPy150Open justquick/django-native-tags/native_tags/contrib/math_.py/func_factory
1,324
def main(argv): # pragma: no cover ip = "127.0.0.1" port = 5684 try: opts, args = getopt.getopt(argv, "hi:p:", ["ip=", "port="]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if opt == '-h': usage() sys.exit() el...
KeyboardInterrupt
dataset/ETHPy150Open Tanganelli/CoAPthon/coapforwardproxy.py/main
1,325
def _get_rt_from_session(self): """ Returns the request token cached in the session by ``_get_request_token`` """ try: return self.request.session['oauth_%s_request_token' % get_token_prefix( ...
KeyError
dataset/ETHPy150Open pennersr/django-allauth/allauth/socialaccount/providers/oauth/client.py/OAuthClient._get_rt_from_session
1,326
def _get_at_from_session(self): """ Get the saved access token for private resources from the session. """ try: return self.request.session['oauth_%s_access_token' % get_token_prefix( self.req...
KeyError
dataset/ETHPy150Open pennersr/django-allauth/allauth/socialaccount/providers/oauth/client.py/OAuth._get_at_from_session
1,327
def feed_index(service, opts): """Feed the named index in a specific manner.""" indexname = opts.args[0] itype = opts.kwargs['ingest'] # get index handle try: index = service.indexes[indexname] except KeyError: print "Index %s not found" % indexname return if ityp...
KeyboardInterrupt
dataset/ETHPy150Open splunk/splunk-sdk-python/examples/genevents.py/feed_index
1,328
def new_object_graph( modules=finding.ALL_IMPORTED_MODULES, classes=None, binding_specs=None, only_use_explicit_bindings=False, allow_injecting_none=False, configure_method_name='configure', dependencies_method_name='dependencies', get_arg_names_from_class_name=( bind...
NotImplementedError
dataset/ETHPy150Open google/pinject/pinject/object_graph.py/new_object_graph
1,329
@staticmethod def parse(filename): if os.name in ("nt", "dos", "os2", "ce"): lib = windll.MediaInfo elif sys.platform == "darwin": try: lib = CDLL("libmediainfo.0.dylib") except __HOLE__: lib = CDLL("libmediainfo.dylib") el...
OSError
dataset/ETHPy150Open sbraz/pymediainfo/pymediainfo/__init__.py/MediaInfo.parse
1,330
def get_driver(self, resource_id): try: return self._drivers[resource_id] except __HOLE__: with excutils.save_and_reraise_exception(reraise=False): raise cfg_exceptions.DriverNotFound(resource='router', id=resour...
KeyError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py/DeviceDriverManager.get_driver
1,331
def get_driver_for_hosting_device(self, hd_id): try: return self._hosting_device_routing_drivers_binding[hd_id] except __HOLE__: with excutils.save_and_reraise_exception(reraise=False): raise cfg_exceptions.DriverNotFound(resource='hosting device', ...
KeyError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py/DeviceDriverManager.get_driver_for_hosting_device
1,332
def set_driver(self, resource): """Set the driver for a neutron resource. :param resource: Neutron resource in dict format. Expected keys: { 'id': <value> 'hosting_device': { 'id': <value>, } 'router_type': {'cfg_agent_driver':...
KeyError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py/DeviceDriverManager.set_driver
1,333
@cached_property def local(self): try: self.storage.path('') except __HOLE__: return False return True
NotImplementedError
dataset/ETHPy150Open django/django/django/contrib/staticfiles/management/commands/collectstatic.py/Command.local
1,334
def clear_dir(self, path): """ Deletes the given relative path using the destination storage backend. """ if not self.storage.exists(path): return dirs, files = self.storage.listdir(path) for f in files: fpath = os.path.join(path, f) i...
NotImplementedError
dataset/ETHPy150Open django/django/django/contrib/staticfiles/management/commands/collectstatic.py/Command.clear_dir
1,335
def delete_file(self, path, prefixed_path, source_storage): """ Checks if the target file should be deleted if it already exists """ if self.storage.exists(prefixed_path): try: # When was the target file modified last time? target_last_modified...
NotImplementedError
dataset/ETHPy150Open django/django/django/contrib/staticfiles/management/commands/collectstatic.py/Command.delete_file
1,336
def link_file(self, path, prefixed_path, source_storage): """ Attempt to link ``path`` """ # Skip this file if it was already copied earlier if prefixed_path in self.symlinked_files: return self.log("Skipping '%s' (already linked earlier)" % path) # Delete the...
OSError
dataset/ETHPy150Open django/django/django/contrib/staticfiles/management/commands/collectstatic.py/Command.link_file
1,337
def walk(node, gen_subnodes, event = enter, reverse_path = False, tree=True): """Traverse a tree or a graph based at 'node' and generate a sequence of paths in the graph from the initial node to the visited node. The arguments are @ node : an arbitrary python object used as root node. @...
StopIteration
dataset/ETHPy150Open tow/sunburnt/sunburnt/walktree.py/walk
1,338
def Load(self, name, batchsize=None, typesize=4): data_proto = self.data_proto try: this_set = next(d for d in data_proto.data if d.name == name) except __HOLE__ as e: print 'No data called %s found in proto file.' % name raise e filenames = sorted(glob.glob(os.path.join(data_proto.pr...
StopIteration
dataset/ETHPy150Open nitishsrivastava/deepnet/deepnet/compute_data_stats.py/DataViewer.Load
1,339
def remove_target(self, shape): """ This method removes the specified shape from the __shapes list. :param shape: MShape : Shape to be removed from the __shapes list. :return: bool : Whether or not the shape was found or not. """ try: self.__shapes.remove(shap...
ValueError
dataset/ETHPy150Open GelaniNijraj/PyMaterial/MAnimations/MAnimator.py/MAnimator.remove_target
1,340
def to_json(content, indent=None): """ Serializes a python object as JSON This method uses the DJangoJSONEncoder to to ensure that python objects such as Decimal objects are properly serialized. It can also serialize Django QuerySet objects. """ if isinstance(content, QuerySet): jso...
TypeError
dataset/ETHPy150Open croach/django-simple-rest/simple_rest/utils/serializers.py/to_json
1,341
def get_logger(entity): """ Retrieves loggers from the enties fully scoped name. get_logger(Replay) -> sc2reader.replay.Replay get_logger(get_logger) -> sc2reader.utils.get_logger :param entity: The entity for which we want a logger. """ try: return logg...
AttributeError
dataset/ETHPy150Open GraylinKim/sc2reader/sc2reader/log_utils.py/get_logger
1,342
def _generateFilters(self, filter_list): filter_strings = [] filter_strings_ipv6 = [] for tcfilter in filter_list: filter_tokens = tcfilter.split(",") try: filter_string = "" filter_string_ipv6 = "" for token in filter_token...
IndexError
dataset/ETHPy150Open urbenlegend/netimpair/netimpair2.py/NetemInstance._generateFilters
1,343
def main(): # Network impairment arguments argparser = argparse.ArgumentParser( description="Network Impairment Test Tool") argparser.add_argument( "-n", "--nic", metavar="INTERFACE", required=True, type=str, help="name of the network interface to be i...
AssertionError
dataset/ETHPy150Open urbenlegend/netimpair/netimpair2.py/main
1,344
@classmethod def get_resource_type(cls, ref): try: if not cls.is_reference(ref): raise ValueError('%s is not a valid reference.' % ref) return ref.split(cls.separator, 1)[0] except (ValueError, IndexError, __HOLE__): raise common_models.InvalidRef...
AttributeError
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/models/db/policy.py/PolicyTypeReference.get_resource_type
1,345
@classmethod def get_name(cls, ref): try: if not cls.is_reference(ref): raise ValueError('%s is not a valid reference.' % ref) return ref.split(cls.separator, 1)[1] except (__HOLE__, IndexError, AttributeError): raise common_models.InvalidReferenc...
ValueError
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/models/db/policy.py/PolicyTypeReference.get_name
1,346
def is_day(date): try: date_format = '%Y-%m-%d' is_valid = datetime.datetime.strptime(date, date_format).strftime( date_format) == date except TypeError: is_valid = False except __HOLE__: is_valid = False return is_valid
ValueError
dataset/ETHPy150Open Dwolla/arbalest/arbalest/pipeline/__init__.py/is_day
1,347
def is_day_hour(date): try: date_format = '%Y-%m-%d/%H' is_valid = datetime.datetime.strptime(date, date_format).strftime( date_format) == date except __HOLE__: is_valid = False except ValueError: is_valid = False return is_valid
TypeError
dataset/ETHPy150Open Dwolla/arbalest/arbalest/pipeline/__init__.py/is_day_hour
1,348
def __get_directory_keys(self, path): try: return [k.name for k in self.bucket.list(path, '/') if k.name.endswith('/')] except __HOLE__: return []
StopIteration
dataset/ETHPy150Open Dwolla/arbalest/arbalest/pipeline/__init__.py/S3SortedDataSources.__get_directory_keys
1,349
@staticmethod def __get_date_from_path(source): try: return datetime.datetime.strptime(source.split('/')[-1], '%Y-%d-%m').strftime('%Y-%d-%m') except __HOLE__: return None
ValueError
dataset/ETHPy150Open Dwolla/arbalest/arbalest/pipeline/__init__.py/SqlTimeSeriesImport.__get_date_from_path
1,350
def __init__(self, arch=ARCH_ARM_LINUX, memory=1024, debug_host=False, debug_target=False, qemu_bin=None, img_dir=".", img_fs="linux-rootfs.img", img_kernel="linux-kernel"): SockPuppet.Controller.__init__(self, debug=debug_host) self.debug_target = debug_target if qemu_bin is not None: ...
RuntimeError
dataset/ETHPy150Open blackberry/ALF/alf/debug/_qemu.py/QEmuTarget.__init__
1,351
def get_template_sources(template_name, template_dirs=None): """ Returns the absolute paths to "template_name", when appended to each directory in "template_dirs". Any paths that don't lie inside one of the template dirs are excluded from the result set, for security reasons. """ if not template...
UnicodeDecodeError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/template/loaders/filesystem.py/get_template_sources
1,352
def load_template_source(template_name, template_dirs=None): tried = [] for filepath in get_template_sources(template_name, template_dirs): try: return (open(filepath).read().decode(settings.FILE_CHARSET), filepath) except __HOLE__: tried.append(filepath) if tried: ...
IOError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/template/loaders/filesystem.py/load_template_source
1,353
def _simpleTroveList(self, troveList, newFilesByTrove): log.info('Verifying %s' % " ".join(x[1].getName() for x in troveList)) changedTroves = set() try: result = update.buildLocalChanges(self.db, troveList, root=self.cfg.root, ...
OSError
dataset/ETHPy150Open sassoftware/conary/conary/cmds/verify.py/_FindLocalChanges._simpleTroveList
1,354
def _scanFilesystem(self, fullTroveList, dirType = NEW_FILES_OWNED_DIR): dirs = list(self.db.db.getTroveFiles(fullTroveList, onlyDirectories = True)) skipDirs = dirset.DirectorySet(self.cfg.verifyDirsNoNewFiles) dirOwners = dirset.DirectoryDict() ...
StopIteration
dataset/ETHPy150Open sassoftware/conary/conary/cmds/verify.py/_FindLocalChanges._scanFilesystem
1,355
def _GetSourceSafely(obj): try: return inspect.getsource(obj) except __HOLE__: logs.LogOnce( _LOG.warning, 'Unable to load source code for %s. Only logging this once.', obj) return ''
IOError
dataset/ETHPy150Open google/openhtf/openhtf/io/test_record.py/_GetSourceSafely
1,356
def _read_yaml(self, path): ''' reads a yaml-formatted configuration file at the given path and returns a python dictionary with the pared items in it. ''' try: with open(path) as stream: return yaml.load(stream) except yaml.parser.ParserError ...
IOError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/loader.py/SaltEventsdLoader._read_yaml
1,357
def get_dynamic_route_by_def_name(self, def_name, routes): try: return [i for i in routes if def_name in i.mapping.values()][0] except __HOLE__: return None
IndexError
dataset/ETHPy150Open chibisov/drf-extensions/tests_app/tests/unit/routers/tests.py/ExtendedDefaultRouterTest.get_dynamic_route_by_def_name
1,358
def openlock(filename, operation, wait=True): """ Returns a file-like object that gets a fnctl() lock. `operation` should be one of LOCK_SH or LOCK_EX for shared or exclusive locks. If `wait` is False, then openlock() will not block on trying to acquire the lock. """ f = os.fdopen(os.o...
IOError
dataset/ETHPy150Open e-loue/django-lean/django_lean/lockfile.py/openlock
1,359
def _run_get_new_deps(self): self.task.set_tracking_url = self.tracking_url_callback self.task.set_status_message = self.status_message_callback def deprecated_tracking_url_callback(*args, **kwargs): warnings.warn("tracking_url_callback in run() args is deprecated, use " ...
TypeError
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/TaskProcess._run_get_new_deps
1,360
def run(self): logger.info('[pid %s] Worker %s running %s', os.getpid(), self.worker_id, self.task) if self.random_seed: # Need to have different random seeds if running in separate processes random.seed((os.getpid(), time.time())) status = FAILED expl = '' ...
KeyboardInterrupt
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/TaskProcess.run
1,361
def terminate(self): """Terminate this process and its subprocesses.""" # default terminate() doesn't cleanup child processes, it orphans them. try: return self._recursive_terminate() except __HOLE__: return super(TaskProcess, self).terminate()
ImportError
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/TaskProcess.terminate
1,362
def get(self, block=None, timeout=None): try: return self.pop() except __HOLE__: raise Queue.Empty
IndexError
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/DequeQueue.get
1,363
def __init__(self, scheduler=None, worker_id=None, worker_processes=1, assistant=False, **kwargs): if scheduler is None: scheduler = CentralPlannerScheduler() self.worker_processes = int(worker_processes) self._worker_info = self._generate_worker_info() if not worker_id: ...
AttributeError
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/Worker.__init__
1,364
def add(self, task, multiprocess=False): """ Add a Task for the worker to check and possibly schedule and run. Returns True if task and its dependencies were successfully scheduled or completed before. """ if self._first_task is None and hasattr(task, 'task_id'): sel...
KeyboardInterrupt
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/Worker.add
1,365
def _add(self, task, is_complete): if self._config.task_limit is not None and len(self._scheduled_tasks) >= self._config.task_limit: logger.warning('Will not schedule %s or any dependencies due to exceeded task-limit of %d', task, self._config.task_limit) return formatted_traceb...
KeyboardInterrupt
dataset/ETHPy150Open spotify/luigi/luigi/worker.py/Worker._add
1,366
def _set_connection(self, connection): try: self._connection = weakref.proxy(connection) self._connection._protocol except (AttributeError, __HOLE__): raise errors.InterfaceError(errno=2048)
TypeError
dataset/ETHPy150Open appnexus/schema-tool/schematool/mysql/connector/cursor.py/MySQLCursor._set_connection
1,367
def _have_unread_result(self): """Check whether there is an unread result""" try: return self._connection.unread_result except __HOLE__: return False
AttributeError
dataset/ETHPy150Open appnexus/schema-tool/schematool/mysql/connector/cursor.py/MySQLCursor._have_unread_result
1,368
def _handle_noresultset(self, res): """Handles result of execute() when there is no result set """ try: self._rowcount = res['affected_rows'] self._last_insert_id = res['insert_id'] self._warning_count = res['warning_count'] except (KeyError, __HOLE__)...
TypeError
dataset/ETHPy150Open appnexus/schema-tool/schematool/mysql/connector/cursor.py/MySQLCursor._handle_noresultset
1,369
def execute(self, operation, params=None, multi=False): """Executes the given operation Executes the given operation substituting any markers with the given parameters. For example, getting all rows where id is 5: cursor.execute("SELECT * FROM t1 WHERE id = %s...
TypeError
dataset/ETHPy150Open appnexus/schema-tool/schematool/mysql/connector/cursor.py/MySQLCursor.execute
1,370
def executemany(self, operation, seq_params): """Execute the given operation multiple times The executemany() method will execute the operation iterating over the list of parameters in seq_params. Example: Inserting 3 new employees and their phone number ...
ValueError
dataset/ETHPy150Open appnexus/schema-tool/schematool/mysql/connector/cursor.py/MySQLCursor.executemany
1,371
@classmethod def setUpClass(cls): super(CitationsViewsTestCase, cls).setUpClass() # populate the DB with parsed citation styles try: parse_citation_styles.main() except __HOLE__: pass
OSError
dataset/ETHPy150Open CenterForOpenScience/osf.io/tests/test_citations.py/CitationsViewsTestCase.setUpClass
1,372
def delete(self, package): filename = self.get_path(package) os.unlink(filename) version_dir = os.path.dirname(filename) try: os.rmdir(version_dir) except __HOLE__: return package_dir = os.path.dirname(version_dir) try: os.rmdir...
OSError
dataset/ETHPy150Open mathcamp/pypicloud/pypicloud/storage/files.py/FileStorage.delete
1,373
def __call__(self, *args, **kwargs): # If the function args cannot be used as a cache hash key, fail fast key = cPickle.dumps((args, kwargs)) try: return self.cache[key] except __HOLE__: value = self.func(*args, **kwargs) self.cache[key] = value ...
KeyError
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/elb/elb.py/memoized.__call__
1,374
def getcomments(pyObject): """Get lines of comments immediately preceding an object's source code. Returns None when source can't be found. """ try: lines, lnum = findsource(pyObject) except (__HOLE__, TypeError): return None if ismodule(pyObject): # Look for a comment ...
IOError
dataset/ETHPy150Open ufora/ufora/packages/python/pyfora/PyforaInspect.py/getcomments
1,375
def getframeinfo(frame, context=1): """Get information about a frame or traceback object. A tuple of five things is returned: the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. Th...
IOError
dataset/ETHPy150Open ufora/ufora/packages/python/pyfora/PyforaInspect.py/getframeinfo
1,376
def maybeName(obj): """ Returns an object's __name__ attribute or it's string representation. @param obj any object @return obj name or string representation """ try: return obj.__name__ except (__HOLE__, ): return str(obj)
AttributeError
dataset/ETHPy150Open blampe/IbPy/ib/lib/__init__.py/maybeName
1,377
def extracted(name, source, archive_format, archive_user=None, password=None, user=None, group=None, tar_options=None, zip_options=None, source_hash=None, if_missing=None, ...
TypeError
dataset/ETHPy150Open saltstack/salt/salt/states/archive.py/extracted
1,378
def validateFacts(val, factsToCheck): # may be called in streaming batches or all at end (final) if not streaming modelXbrl = val.modelXbrl modelDocument = modelXbrl.modelDocument # note EBA 2.1 is in ModelDocument.py timelessDatePattern = re.compile(r"\s*([0-9]{4})-([0-9]{2})...
AttributeError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/validate/EBA/__init__.py/validateFacts
1,379
def final(val): if not (val.validateEBA or val.validateEIOPA): return modelXbrl = val.modelXbrl modelDocument = modelXbrl.modelDocument _statusMsg = _("validating {0} filing rules").format(val.disclosureSystem.name) modelXbrl.profileActivity() modelXbrl.modelManager.showSt...
ValueError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/validate/EBA/__init__.py/final
1,380
def __del__(self): # This method can be called during interpreter shutdown, which means we # must do the absolute minimum here. Note that there could be running # daemon threads that are trying to call other methods on this object. try: self.os.close(self._inotify_fd) except (AttributeError, __HOLE__): ...
TypeError
dataset/ETHPy150Open powerline/powerline/powerline/lib/inotify.py/INotify.__del__
1,381
def handle(self, *args, **options): try: jad_path, jar_path = args except __HOLE__: raise CommandError('Usage: %s\n%s' % (self.args, self.help)) with open(jad_path, 'r') as f: jad_file = f.read() with open(jar_path, 'rb') as f: jar_file = ...
ValueError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/builds/management/commands/sign_jadjar.py/Command.handle
1,382
def fromEnvironment(cls): """ Get as many of the platform-specific error translation objects as possible and return an instance of C{cls} created with them. """ try: from ctypes import WinError except ImportError: WinError = None try: ...
ImportError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/win32.py/_ErrorFormatter.fromEnvironment
1,383
def test_autofield_field_raises_error_message(self): f = models.AutoField(primary_key=True) self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except ValidationError, e: self.assertEqual(e.messages, [u"'foo' value must be an integer...
AssertionError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_autofield_field_raises_error_message
1,384
def test_integer_field_raises_error_message(self): f = models.IntegerField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [u"'foo' value must be an integer."])
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_integer_field_raises_error_message
1,385
def test_boolean_field_raises_error_message(self): f = models.BooleanField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [u"'foo' value must be either T...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_boolean_field_raises_error_message
1,386
def test_float_field_raises_error_message(self): f = models.FloatField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [u"'foo' value must be a float."])
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_float_field_raises_error_message
1,387
def test_decimal_field_raises_error_message(self): f = models.DecimalField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [u"'foo' value must be a decima...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_decimal_field_raises_error_message
1,388
def test_null_boolean_field_raises_error_message(self): f = models.NullBooleanField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [u"'foo' value must be...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_null_boolean_field_raises_error_message
1,389
def test_date_field_raises_error_message(self): f = models.DateField() self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except ValidationError, e: self.assertEqual(e.messages, [ u"'foo' value has an invalid date fo...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_date_field_raises_error_message
1,390
def test_datetime_field_raises_error_message(self): f = models.DateTimeField() # Wrong format self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except ValidationError, e: self.assertEqual(e.messages, [ u"'fo...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_datetime_field_raises_error_message
1,391
def test_time_field_raises_error_message(self): f = models.TimeField() # Wrong format self.assertRaises(ValidationError, f.clean, 'foo', None) try: f.clean('foo', None) except __HOLE__, e: self.assertEqual(e.messages, [ u"'foo' value has an...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_time_field_raises_error_message
1,392
@app.route('/secret', methods=['GET']) def secret(): while 1: s = base64.urlsafe_b64encode(os.urandom(48)) try: iter(backend.list(s)).next() except __HOLE__: break return MeteredResponse(response='{0}\n'.format(s), status=201, ...
StopIteration
dataset/ETHPy150Open devstructure/blueprint/blueprint/io/server/__init__.py/secret
1,393
@app.route('/<secret>/<name>', methods=['PUT']) def put_blueprint(secret, name): validate_secret(secret) validate_name(name) librato.count('blueprint-io-server.bandwidth.in', request.content_length) statsd.update('blueprint-io-server.bandwidth.in', request.content_length) validate_content_length() ...
ValueError
dataset/ETHPy150Open devstructure/blueprint/blueprint/io/server/__init__.py/put_blueprint
1,394
def get_test_jobs(args): dbsession = models.get_session() TJ = models.TestJob for jobid in args: try: jobid = int(jobid) except __HOLE__: pass try: if type(jobid) is int: testjob = dbsession.query(TJ).get(jobid) else: ...
ValueError
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/QA/jobrunner.py/get_test_jobs
1,395
@pytest.fixture def redis(): try: from redis import StrictRedis from redis.exceptions import ConnectionError except __HOLE__: pytest.skip('redis library not installed') try: r = StrictRedis() r.ping() except ConnectionError: pytest.skip('could not connect ...
ImportError
dataset/ETHPy150Open mbr/flask-kvsession/tests/conftest.py/redis
1,396
def concat(objs, dim=None, data_vars='all', coords='different', compat='equals', positions=None, indexers=None, mode=None, concat_over=None): """Concatenate xarray objects along a new or existing dimension. Parameters ---------- objs : sequence of Dataset and DataArray objects ...
StopIteration
dataset/ETHPy150Open pydata/xarray/xarray/core/combine.py/concat
1,397
def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(ProfileListView, self).get_context_data(**kwargs) try: page = int(self.request.GET.get('page', None)) except (__HOLE__, ValueError): page = self.page ...
TypeError
dataset/ETHPy150Open bread-and-pepper/django-userena/userena/views.py/ProfileListView.get_context_data
1,398
def profile_list(request, page=1, template_name='userena/profile_list.html', paginate_by=50, extra_context=None, **kwargs): # pragma: no cover """ Returns a list of all profiles that are public. It's possible to disable this by changing ``USERENA_DISABLE_PROFILE_LIST`` to ``True`` in y...
TypeError
dataset/ETHPy150Open bread-and-pepper/django-userena/userena/views.py/profile_list
1,399
def _resolve_name(name, package, level): """Return the absolute name of the module to be imported.""" if not hasattr(package, 'rindex'): raise ValueError("'package' not set to a string") dot = len(package) for x in xrange(level, 1, -1): try: dot = package.rindex('.', 0, dot) ...
ValueError
dataset/ETHPy150Open slacy/minimongo/minimongo/config.py/_resolve_name