Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
600
def objectInfo(self, objname): 'get dict of methodnames on the named object' try: return self.objDict[objname].xmlrpc_methods except __HOLE__: return 'error: server has no object named %s' % objname
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/XMLRPCServerBase.objectInfo
601
def methodCall(self, objname, methodname, args): 'run the named method on the named object and return its result' try: obj = self.objDict[objname] if methodname in obj.xmlrpc_methods: m = getattr(obj, methodname) else: print >>sys.stder...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/XMLRPCServerBase.methodCall
602
def assign_processors(self): "hand out available processors to coordinators in order of need" margin = self.overload_margin - 1.0 free_cpus = [] nproc = {} for c in self.coordinators.values(): # COUNT NUMBER OF PROCS for host, pid in c.processors: # RUNNING ON EACH HO...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.assign_processors
603
def set_hostinfo(self, host, attr, val): "increase or decrease the maximum load allowed on a given host" try: setattr(self.hosts[host], attr, val) except __HOLE__: self.hosts[host] = HostInfo('%s=%s' % (attr, str(val))) return True # USE THIS AS DEFAULT XMLRPC RE...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.set_hostinfo
604
def delrule(self, rsrc): "delete a resource generation rule from our database" try: del self.rules[rsrc] except __HOLE__: print >>sys.stderr, "Attempt to delete unknown resource rule %s" \ % rsrc else: self.rules.close() # THIS IS T...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.delrule
605
def register_coordinator(self, name, url, user, priority, resources, immediate, demand_ncpu): "save a coordinator's registration info" try: print >>sys.stderr, 'change_priority: %s (%s,%s): %f -> %f' \ % (name, user, url, self.coordinators[url]....
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.register_coordinator
606
def unregister_coordinator(self, name, url, message): "remove a coordinator from our list" try: del self.coordinators[url] print >>sys.stderr, 'unregister_coordinator: %s (%s): %s' \ % (name, url, message) self.load_balance() # FORCE IT TO REBALANCE ...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.unregister_coordinator
607
def request_cpus(self, name, url): "return a list of hosts for this coordinator to run processors on" try: c = self.coordinators[url] except __HOLE__: print >>sys.stderr, 'request_cpus: unknown coordinator %s @ %s' \ % (name, url) return []...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.request_cpus
608
def register_processor(self, host, pid, url): "record a new processor starting up" try: self.coordinators[url] += (host, pid) self.systemLoad[host] += 1.0 # THIS PROBABLY INCREASES LOAD BY 1 except __HOLE__: pass return True # USE THIS AS DEFAULT XMLR...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.register_processor
609
def unregister_processor(self, host, pid, url): "processor shutting down, so remove it from the list" try: self.coordinators[url] -= (host, pid) self.systemLoad[host] -= 1.0 # THIS PROBABLY DECREASES LOAD BY 1 if self.systemLoad[host] < 0.0: self.syste...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.unregister_processor
610
def get_resource(self, host, pid, rsrc): """return a filename for the resource, or False if rule must be applied, or True if client must wait to get the resource""" key = host + ':' + rsrc try: # JUST HAND BACK THE RESOURCE return self.resources[key] except __HOLE__: ...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.get_resource
611
def del_lock(self, host, rsrc): "delete a lock on a pending resource construction process" key = host + ':' + rsrc try: del self.locks[key] # REMOVE THE LOCK except __HOLE__: print >> sys.stderr, "attempt to release non-existent lock \ %s,%s:%d...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ResourceController.del_lock
612
def __getitem__(self, k): try: return dict.__getitem__(self, k) except __HOLE__: val = AttrProxy(self.getattr_proxy, k) self[k] = val return val
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/DictAttrProxy.__getitem__
613
def __init__(self, name, script, it, resources, port=8888, priority=1.0, rc_url=None, errlog=False, immediate=False, ncpu_limit=999999, demand_ncpu=0, max_initialization_errors=3, **kwargs): self.name = name self.script = script self.it = iter(i...
IOError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.__init__
614
def start_client(self, host): "start a processor on a client node" import tempfile if len(self.clients) >= self.ncpu_limit: print >>sys.stderr, 'start_client: blocked, CPU limit', \ len(self.clients), self.ncpu_limit return # DON'T START ANOTHER PROCESS,...
AttributeError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.start_client
615
def register_client(self, host, pid, logfile): 'XMLRPC call to register client hostname and PID as starting_up' print >>sys.stderr, 'register_client: %s:%d' % (host, pid) self.clients[(host, pid)] = 0 try: self.logfile[logfile][1] = pid # SAVE OUR PID iclient = se...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.register_client
616
def unregister_client(self, host, pid, message): 'XMLRPC call to remove client from register as exiting' print >>sys.stderr, 'unregister_client: %s:%d %s' \ % (host, pid, message) try: del self.clients[(host, pid)] except KeyError: print >>sys.stde...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.unregister_client
617
def report_success(self, host, pid, success_id): 'mark task as successfully completed' # Keep permanent record of success ID. print >>self.successfile, success_id self.successfile.flush() self.nsuccess += 1 try: self.clients[(host, pid)] += 1 except __...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.report_success
618
def report_error(self, host, pid, id, tb_report): "get traceback report from client as text" print >>sys.stderr, "TRACEBACK: %s:%s ID %s\n%s" % \ (host, str(pid), str(id), tb_report) if (host, pid) in self.clients_initializing: logfile = self.clients_initializing[(host,...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.report_error
619
def next(self, host, pid, success_id): 'return next ID from iterator to the XMLRPC caller' if (host, pid) not in self.clients: print >>sys.stderr, 'next: unknown client %s:%d' % (host, pid) return False # HAND BACK "NO MORE FOR YOU TO DO" SIGNAL try: # INITIALIZATION DONE...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.next
620
def run_all(self, resultGenerator, **kwargs): "run until all task IDs completed, trap & report all errors" errors_in_a_row = 0 it = resultGenerator(self, **kwargs) # GET ITERATOR FROM GENERATOR report_time = time.time() self.register() # REGISTER WITH RESOURCE CONTROLLER & COORDI...
SystemExit
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Processor.run_all
621
def parse_argv(): """parse sys.argv into a dictionary of GNU-style args (--foo=bar) and a list of other args""" d = {} l = [] for v in sys.argv[1:]: if v[:2] == '--': try: k, v = v[2:].split('=') d[k] = v except __HOLE__: ...
ValueError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/parse_argv
622
def start_client_or_server(clientGenerator, serverGenerator, resources, script): """start controller, client or server depending on whether we get coordinator argument from the command-line args. Client must be a generator function that takes Processor as argument, and uses i...
TypeError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/start_client_or_server
623
def _run_pending_tasks(): now = time.time() old_pending = list(_pending_delayed_tasks) del _pending_delayed_tasks[:] for t in old_pending: if not _main_loop_running: return if now >= t.run_at_or_after: try: t.cb() except __HOLE__: raise except: _on_excepti...
KeyboardInterrupt
dataset/ETHPy150Open natduca/quickopen/src/message_loop_curses.py/_run_pending_tasks
624
def run_main_loop(): global _old_std _old_std = [ sys.stdout, sys.stderr ] if DEBUG: tempStdout = open('/tmp/quickopen.stdout', 'w', 0) sys.stdout = tempStdout sys.stderr = sys.stdout else: tempStdout = cStringIO.StringIO() sys.stdout = tempStdout sys.stderr = sys.stdout assert not i...
KeyboardInterrupt
dataset/ETHPy150Open natduca/quickopen/src/message_loop_curses.py/run_main_loop
625
def format(self, record): """Returns a JSON string based on a LogRecord instance. Args: record: A LogRecord instance. See below for details. Returns: A JSON string representing the record. A LogRecord instance has the following attributes and is used for formatting the final message. ...
TypeError
dataset/ETHPy150Open GoogleCloudPlatform/DataflowPythonSDK/google/cloud/dataflow/worker/logger.py/JsonLogFormatter.format
626
def test_argument_checking(self): self.assertRaises(TypeError, self.thetype) # need at least a func arg try: self.thetype(2)() except __HOLE__: pass else: self.fail('First arg not checked for callability')
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_functools.py/TestPartial.test_argument_checking
627
@unittest.skip("FIXME: Not working in Jython.") def test_attributes(self): p = self.thetype(hex) try: del p.__dict__ except __HOLE__: pass else: self.fail('partial object allowed __dict__ to be deleted')
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_functools.py/TestPartial.test_attributes
628
def main(): parser = argparse.ArgumentParser() parser.add_argument('-d', '--drop-data', default=False, action="store_true") parser.add_argument('-k', '--keep-torrent', default=False, action="store_true") args = parser.parse_args() if sys.stdin.isatty(): parser.error('no input, pipe another ...
ValueError
dataset/ETHPy150Open bittorrent/btc/btc/btc_remove.py/main
629
def __repr__(self): try: u = six.text_type(self) except (UnicodeEncodeError, __HOLE__): u = '[Bad Unicode data]' return force_str('<%s: %s>' % (self.__class__.__name__, u))
UnicodeDecodeError
dataset/ETHPy150Open thoas/django-sequere/sequere/contrib/timeline/action.py/Action.__repr__
630
def is_int(self, text): try: int(text) return True except __HOLE__: return False
ValueError
dataset/ETHPy150Open cloudera/hue/apps/oozie/src/oozie/models2.py/Dataset.is_int
631
def execute(self, item, context): try: obj, action = item except __HOLE__: self.logger.exception('Error executing on item: {0}'.format(item)) return try: func = getattr(self.sqlite_manager, action) except AttributeError: self.lo...
ValueError
dataset/ETHPy150Open facebook/augmented-traffic-control/atc/atcd/atcd/AtcdDBQueueTask.py/AtcdDBQueueTask.execute
632
def validate_document(self, document): self.schema = document.schema collection_name, errors = type(document).__name__, {} self.validate(document.document) for key, _errors in self.flattened_errors.items(): field = key field_schema = self.get_field_schema(field) ...
KeyError
dataset/ETHPy150Open lvieirajr/mongorest/mongorest/validator.py/Validator.validate_document
633
def patch_json(): try: import ujson # noqa except __HOLE__: # ujson is not available, we won't patch anything return patch_module('json', ['dumps', 'loads'])
ImportError
dataset/ETHPy150Open ziirish/burp-ui/burpui/_compat.py/patch_json
634
def _transform_object(self, obj): wrapped = Transformable(obj) error_component = wrapped['error_component'].resolve() if error_component is not None and error_component == 'connect': raise errors.IgnoreObject("Error connecting") banner = wrapped['data']['banner'].resolve()...
KeyError
dataset/ETHPy150Open zmap/ztag/ztag/transforms/pop3.py/POP3StartTLSTransform._transform_object
635
def _transform_object(self, obj): wrapped = Transformable(obj) error_component = wrapped['error_component'].resolve() if error_component is not None and error_component == 'connect': raise errors.IgnoreObject("Error connecting") banner = wrapped['data']['banner'].resolve() ...
IndexError
dataset/ETHPy150Open zmap/ztag/ztag/transforms/pop3.py/POP3STransform._transform_object
636
def _UnlockedVerifyConfig(self): """Verify function. @rtype: list @return: a list of error messages; a non-empty list signifies configuration errors """ # pylint: disable=R0914 result = [] seen_macs = [] ports = {} data = self._ConfigData() cluster = data.cluster #...
IndexError
dataset/ETHPy150Open ganeti/ganeti/lib/config/__init__.py/ConfigWriter._UnlockedVerifyConfig
637
@ConfigSync() def AssignGroupNodes(self, mods): """Changes the group of a number of nodes. @type mods: list of tuples; (node name, new group UUID) @param mods: Node membership modifications """ groups = self._ConfigData().nodegroups nodes = self._ConfigData().nodes resmod = [] # Tr...
KeyError
dataset/ETHPy150Open ganeti/ganeti/lib/config/__init__.py/ConfigWriter.AssignGroupNodes
638
def publish(self, argv=None, usage=None, description=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None): """ Process command line options and arguments (if `self.settings` not already set), run `self.reader` and then `...
SystemExit
dataset/ETHPy150Open adieu/allbuttonspressed/docutils/core.py/Publisher.publish
639
def __iter__(self): for line in self.fp: m = log_re.match(line.strip()) d = m.groupdict() d['remote_addr'] = d['remote_addr'].replace('"', '') try: request = d.pop('request') method, path, httpver = request.split(' ') ex...
ValueError
dataset/ETHPy150Open samuel/squawk/squawk/parsers/access_log.py/AccessLogParser.__iter__
640
def __getattr__(self, name): try: return self[name] except __HOLE__: raise AttributeError(name)
KeyError
dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/markov/ddp.py/DPSolveResult.__getattr__
641
@property def OptionParser(self): if self._optparse is None: try: me = 'repo %s' % self.NAME usage = self.helpUsage.strip().replace('%prog', me) except __HOLE__: usage = 'repo %s' % self.NAME self._optparse = optparse.OptionParser(usage = usage) self._Options(self._...
AttributeError
dataset/ETHPy150Open esrlabs/git-repo/command.py/Command.OptionParser
642
def _GetProjectByPath(self, manifest, path): project = None if os.path.exists(path): oldpath = None while path \ and path != oldpath \ and path != manifest.topdir: try: project = self._by_path[path] break except KeyError: oldpath = path ...
KeyError
dataset/ETHPy150Open esrlabs/git-repo/command.py/Command._GetProjectByPath
643
def __init__(self, event_type, timestamp, **kwargs): self.event_type = event_type # All events have these two attributes self.timestamp = timestamp for attribute in self.KNOWN_ATTRIBUTES: try: self._set(attribute, kwargs[attribute]) except __HOLE__: ...
KeyError
dataset/ETHPy150Open thefactory/marathon-python/marathon/models/events.py/MarathonEvent.__init__
644
def send(self, msg): messagestr = pickle.dumps(msg) message = struct.pack("I", len(messagestr)) + messagestr try: while len(message) > 0: try: bytesent = self.thesocket.send(message) message = message[bytesent:] ...
AttributeError
dataset/ETHPy150Open denizalti/concoord/concoord/object/pinger.py/Pinger.send
645
@magic.line_magic @magic_arguments() @argument('address', type=hexint_tuple, nargs='+', help='Single hex address, or a range start:end including both endpoints') def watch(self, line): """Watch memory for changes, shows the results in an ASCII data table. To use the results programmatically...
KeyboardInterrupt
dataset/ETHPy150Open scanlime/coastermelt/backdoor/shell_magics.py/ShellMagics.watch
646
@magic.line_magic @magic_arguments() @argument('address', type=hexint_aligned, nargs='?') @argument('wordcount', type=hexint, nargs='?', default=1, help='Number of words to remap') @argument('-d', '--delay', type=float, default=0.05, metavar='SEC', help='Add a delay between rounds') @argument('-p', ...
KeyboardInterrupt
dataset/ETHPy150Open scanlime/coastermelt/backdoor/shell_magics.py/ShellMagics.bitfuzz
647
def download_appstats(servername, appid, path, secure, rpc_server_factory, filename, appdir, merge, java_application): """Invoke remote_api to download appstats data.""" if os.path.isdir(appdir): sys.path.insert(0, appdir) try: logging.info('Importing ap...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/download_appstats.py/download_appstats
648
def download_data(filename, merge, java_application): """Download appstats data from memcache.""" oldrecords = [] oldfile = None if merge: try: oldfile = open(filename, 'rb') except __HOLE__: logging.info('No file to merge. Creating new file %s', filename) if oldfile:...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/download_appstats.py/download_data
649
def run_from_argv(self, argv): """ Changes the option_list to use the options from the wrapped command. Adds schema parameter to specify which schema will be used when executing the wrapped command. """ # load the command object. try: app_name = get_co...
KeyError
dataset/ETHPy150Open bernardopires/django-tenant-schemas/tenant_schemas/management/commands/tenant_command.py/Command.run_from_argv
650
def __init__(self, *args, **kwds): """ A dictionary which maintains the insertion order of keys. """ if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__end except __HOLE__: sel...
AttributeError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/OrderedDict.__init__
651
def pop(self): if self._pending_removals: self._commit_removals() while True: try: itemref = self.data.pop() except __HOLE__: raise KeyError('pop from empty WeakSet') item = itemref() if item is not None: ...
KeyError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/WeakSet.pop
652
def __eq__(self, other): if isinstance(other, self.__class__): return self._items == other._items else: try: return len(other) == len(self._items) and all(item in self for item in other) except __HOLE__: return NotImplemented
TypeError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/SortedSet.__eq__
653
def __ne__(self, other): if isinstance(other, self.__class__): return self._items != other._items else: try: return len(other) != len(self._items) or any(item not in self for item in other) except __HOLE__: return NotImplemented
TypeError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/SortedSet.__ne__
654
def __getitem__(self, key): try: index = self._index[self._serialize_key(key)] return self._items[index][1] except __HOLE__: raise KeyError(str(key))
KeyError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/OrderedMap.__getitem__
655
def __delitem__(self, key): # not efficient -- for convenience only try: index = self._index.pop(self._serialize_key(key)) self._index = dict((k, i if i < index else i - 1) for k, i in self._index.items()) self._items.pop(index) except __HOLE__: ra...
KeyError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/OrderedMap.__delitem__
656
def __eq__(self, other): if isinstance(other, OrderedMap): return self._items == other._items try: d = dict(other) return len(d) == len(self._items) and all(i[1] == d[i[0]] for i in self._items) except KeyError: return False except __HOLE__...
TypeError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/OrderedMap.__eq__
657
def popitem(self): try: kv = self._items.pop() del self._index[self._serialize_key(kv[0])] return kv except __HOLE__: raise KeyError()
IndexError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/OrderedMap.popitem
658
def _from_timestring(self, s): try: parts = s.split('.') base_time = time.strptime(parts[0], "%H:%M:%S") self.nanosecond_time = (base_time.tm_hour * Time.HOUR + base_time.tm_min * Time.MINUTE + base_time....
ValueError
dataset/ETHPy150Open datastax/python-driver/cassandra/util.py/Time._from_timestring
659
def read(self): """ Validate pidfile and make it stale if needed""" if not self.fname: return try: with open(self.fname, "r") as f: wpid = int(f.read() or 0) if wpid <= 0: return return wpid excep...
IOError
dataset/ETHPy150Open quantmind/pulsar/pulsar/utils/tools/pidfile.py/Pidfile.read
660
def to_python(self, value): if value and isinstance(value, basestring): try: return json.loads(value) except __HOLE__: raise ValidationError("Invalid JSON")#TODO more descriptive error? return None
ValueError
dataset/ETHPy150Open zbyte64/django-dockit/dockit/forms/fields.py/HiddenJSONField.to_python
661
def clean(self, data, initial=None): ret = list() for i, data_item in enumerate(data): if data_item.get('DELETE', False): continue if initial and len(initial) > i: initial_item = initial[i] else: initial_item = None ...
ValidationError
dataset/ETHPy150Open zbyte64/django-dockit/dockit/forms/fields.py/PrimitiveListField.clean
662
def _shift(self): try: self._next = self._iterator.next() except __HOLE__: self._has_next = False else: self._has_next = True
StopIteration
dataset/ETHPy150Open riffm/mint/mint.py/Looper._shift
663
def iter_changed(interval=1): mtimes = {} while 1: for filename in all_files_by_mask('*.mint'): try: mtime = os.stat(filename).st_mtime except __HOLE__: continue old_time = mtimes.get(filename) if old_time is None: ...
OSError
dataset/ETHPy150Open riffm/mint/mint.py/iter_changed
664
def on_selection_modified_async(self, view): """Called when the selection changes (cursor moves or text selected).""" if self.is_scratch(view): return view = self.get_focused_view_id(view) if view is None: return vid = view.id() # Get the line...
IndexError
dataset/ETHPy150Open SublimeLinter/SublimeLinter3/sublimelinter.py/SublimeLinter.on_selection_modified_async
665
def emit(self, record): """ Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline [N.B. this may be removed depending on feedback]. If exception information is present, it is formatte...
KeyboardInterrupt
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/__init__.py/StreamHandler.emit
666
def run(self, edit): try: repo_root = utils.find_hg_root(self.view.file_name()) # XXX: Will swallow the same error for the utils. call. except __HOLE__: msg = "SublimeHg: No server found for this file." sublime.status_message(msg) return ...
AttributeError
dataset/ETHPy150Open SublimeText/SublimeHg/sublime_hg.py/KillHgServerCommand.run
667
def run(self): # The requested command interacts with remote repository or is potentially # long-running. We run it in its own console so it can be killed easily # by the user. Also, they have a chance to enter credentials if necessary. if utils.is_flag_set(self.command_data.flags, R...
NotImplementedError
dataset/ETHPy150Open SublimeText/SublimeHg/sublime_hg.py/CommandRunnerWorker.run
668
def _fixMayaOutput(): if not hasattr( sys.stdout,"flush"): def flush(*args,**kwargs): pass try: sys.stdout.flush = flush except __HOLE__: # second try #if hasattr(maya,"Output") and not hasattr(maya.Output,"flush"): class MayaOutput...
AttributeError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/plogging.py/_fixMayaOutput
669
def nameToLevel(name): try: return int(name) except __HOLE__: return logLevels.getIndex(name)
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/plogging.py/nameToLevel
670
def levelToName(level): if not isinstance(level, int): raise TypeError(level) try: return logLevels.getKey(level) except __HOLE__: return str(level)
ValueError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/plogging.py/levelToName
671
def fix_winpython_pathenv(): """ Add Python & Python Scripts to the search path on Windows """ import ctypes from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID try: import _winreg as winreg except __HOLE__: import winreg # took these lines from the native "wi...
ImportError
dataset/ETHPy150Open smartanthill/smartanthill1_0/get-smartanthill.py/fix_winpython_pathenv
672
def install_pip(): try: from urllib2 import urlopen except __HOLE__: from urllib.request import urlopen f = NamedTemporaryFile(delete=False) response = urlopen("https://bootstrap.pypa.io/get-pip.py") f.write(response.read()) f.close() try: print (exec_python_cmd([f....
ImportError
dataset/ETHPy150Open smartanthill/smartanthill1_0/get-smartanthill.py/install_pip
673
def command_import_teamocil(args): """Import teamocil config to tmuxp format.""" if args.list: try: configs_in_user = config.in_dir( teamocil_config_dir, extensions='yml') except __HOLE__: configs_in_user = [] configs_in_cwd = config.in_dir( ...
OSError
dataset/ETHPy150Open tony/tmuxp/tmuxp/cli.py/command_import_teamocil
674
def command_import_tmuxinator(args): """Import tmuxinator config to tmuxp format.""" if args.list: try: configs_in_user = config.in_dir( tmuxinator_config_dir, extensions='yml') except __HOLE__: configs_in_user = [] configs_...
OSError
dataset/ETHPy150Open tony/tmuxp/tmuxp/cli.py/command_import_tmuxinator
675
def main(): """Main CLI application.""" parser = get_parser() argcomplete.autocomplete(parser, always_complete_options=False) args = parser.parse_args() log_level = 'INFO' if 'log_level' in args and isinstance(args.log_level, string_types): log_level = args.log_level.upper() set...
KeyboardInterrupt
dataset/ETHPy150Open tony/tmuxp/tmuxp/cli.py/main
676
def remote(self, name): with fasteners.InterProcessLock(self._filename + ".lock"): remotes, _ = self._load() try: return Remote(name, remotes[name]) except __HOLE__: raise ConanException("No remote '%s' defined in remotes in file %s" ...
KeyError
dataset/ETHPy150Open conan-io/conan/conans/client/remote_registry.py/RemoteRegistry.remote
677
def _api_scrape(json_inp, ndx): """ Internal method to streamline the getting of data from the json Args: json_inp (json): json input from our caller ndx (int): index where the data is located in the api Returns: If pandas is present: DataFrame (pandas.DataFrame): d...
KeyError
dataset/ETHPy150Open seemethere/nba_py/nba_py/__init__.py/_api_scrape
678
def show_negative_chains(model_path): """ Display negative chains. Parameters ---------- model_path: str The path to the model pickle file """ model = serial.load(model_path) try: control.push_load_data(False) dataset = yaml_parse.load(model.dataset_yaml_src) ...
AttributeError
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/scripts/dbm/show_negative_chains.py/show_negative_chains
679
def unicodify(self, s): u""" Make sure, whatever ``s`` is, that there is a value Unicode string answered. If ``s`` is not a string then use ``str(s)`` to convert to a string first. This will make database records convert to a string of their id, instead of showing the record ``r...
UnicodeDecodeError
dataset/ETHPy150Open petrvanblokland/Xierpa3/xierpa3/toolbox/parsers/etreexmlparser.py/UnbasedPathResolver.unicodify
680
def _getFileContents(self, clientVersion, fileList, rawStreams): manifest = ManifestWriter(self.tmpPath) sizeList = [] exception = None for stream, (encFileId, encVersion) in \ itertools.izip(rawStreams, fileList): if stream is None: ...
OSError
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netserver.py/NetworkRepositoryServer._getFileContents
681
def _commitChangeSet(self, authToken, cs, mirror = False, hidden = False, statusPath = None): # walk through all of the branches this change set commits to # and make sure the user has enough permissions for the operation verList = ((x.getName(), x.getOldVersion(), x.get...
IOError
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netserver.py/NetworkRepositoryServer._commitChangeSet
682
@accessReadOnly def getCommitProgress(self, authToken, clientVersion, url): base = util.normurl(self.urlBase()) url = util.normurl(url) if not url.startswith(base): raise errors.RepositoryError( 'The changeset that is being committed was not ' 'upl...
IOError
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netserver.py/NetworkRepositoryServer.getCommitProgress
683
@accessReadOnly def getTroveSigs(self, authToken, clientVersion, infoList): self.log(2, infoList) # process the results of the more generic call ret = self.getTroveInfo(authToken, clientVersion, trove._TROVEINFO_TAG_SIGS, infoList) try: mid...
ValueError
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netserver.py/NetworkRepositoryServer.getTroveSigs
684
def _deferGenerator(g, deferred): """ See L{deferredGenerator}. """ result = None # This function is complicated by the need to prevent unbounded recursion # arising from repeatedly yielding immediately ready deferreds. This while # loop and the waiting variable solve that by manually unfo...
StopIteration
dataset/ETHPy150Open twisted/twisted/twisted/internet/defer.py/_deferGenerator
685
def _inlineCallbacks(result, g, deferred): """ See L{inlineCallbacks}. """ # This function is complicated by the need to prevent unbounded recursion # arising from repeatedly yielding immediately ready deferreds. This while # loop and the waiting variable solve that by manually unfolding the ...
StopIteration
dataset/ETHPy150Open twisted/twisted/twisted/internet/defer.py/_inlineCallbacks
686
def contents_of(f, encoding='utf-8'): """Helper to read the contents of the given file or path into a string with the given encoding. Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'.""" try: contents = f.read() except AttributeError: try: with ...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/contents_of
687
def contains_sequence(self, *items): """Asserts that val contains the given sequence of items in order.""" if len(items) == 0: raise ValueError('one or more args must be given') else: try: for i in xrange(len(self.val) - len(items) + 1): ...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/AssertionBuilder.contains_sequence
688
def contains_duplicates(self): """Asserts that val is iterable and contains duplicate items.""" try: if len(self.val) != len(set(self.val)): return self except __HOLE__: raise TypeError('val is not iterable') self._err('Expected <%s> to contain dup...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/AssertionBuilder.contains_duplicates
689
def does_not_contain_duplicates(self): """Asserts that val is iterable and does not contain any duplicate items.""" try: if len(self.val) == len(set(self.val)): return self except __HOLE__: raise TypeError('val is not iterable') self._err('Expected...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/AssertionBuilder.does_not_contain_duplicates
690
def extracting(self, *names): """Asserts that val is collection, then extracts the named properties or named zero-arg methods into a list (or list of tuples if multiple names are given).""" if not isinstance(self.val, collections.Iterable): raise TypeError('val is not iterable') if i...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/AssertionBuilder.extracting
691
def __getattr__(self, attr): """Asserts that val has attribute attr and that attribute's value is equal to other via a dynamic assertion of the form: has_<attr>().""" if not attr.startswith('has_'): raise AttributeError('assertpy has no assertion <%s()>' % attr) attr_name = attr[4:]...
TypeError
dataset/ETHPy150Open ActivisionGameScience/assertpy/assertpy/assertpy.py/AssertionBuilder.__getattr__
692
def apply(self, dataset, can_fit=False): """ .. todo:: WRITEME """ patches = dataset.get_topological_view() num_topological_dimensions = len(patches.shape) - 2 if num_topological_dimensions != len(self.patch_shape): raise ValueError("ReassembleG...
IndexError
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/datasets/preprocessing.py/ReassembleGridPatches.apply
693
def apply(self, dataset, can_fit=False): """ .. todo:: WRITEME """ w_rows, w_cols = self.window_shape arr = dataset.get_topological_view() try: axes = dataset.view_converter.axes except __HOLE__: reraise_as(NotImplementedErro...
AttributeError
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/datasets/preprocessing.py/CentralWindow.apply
694
def isiterable(x): "Returns `True` if the specified object is iterable." try: iter(x) except __HOLE__: return False return True
TypeError
dataset/ETHPy150Open lsaffre/lino/lino/utils/__init__.py/isiterable
695
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 KeyError: raise MultiValueDictKeyError("Key %r not found in %r"...
IndexError
dataset/ETHPy150Open wcong/ants/ants/utils/datatypes.py/MultiValueDict.__getitem__
696
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 wcong/ants/ants/utils/datatypes.py/MultiValueDict.get
697
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 wcong/ants/ants/utils/datatypes.py/MultiValueDict.getlist
698
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(o...
TypeError
dataset/ETHPy150Open wcong/ants/ants/utils/datatypes.py/MultiValueDict.update
699
def __getitem__(self, key): for dict_ in self.dicts: try: return dict_[key] except __HOLE__: pass raise KeyError
KeyError
dataset/ETHPy150Open wcong/ants/ants/utils/datatypes.py/MergeDict.__getitem__