Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
400
def load(filename): '''Load a known_hosts file, if not already loaded''' filename = os.path.expanduser(filename) with _lock: if filename not in _loaded_files: try: _loaded_files[filename] = KnownHosts(filename) except __HOLE__ as e: logging.get...
IOError
dataset/ETHPy150Open radssh/radssh/radssh/known_hosts.py/load
401
def find_first_key(hostname, known_hosts_files=['~/.ssh/known_hosts'], port=22): ''' Look for first matching host key in a sequence of known_hosts files ''' for f in known_hosts_files: x = load(f) try: entry = next(x.matching_keys(hostname, port)) return entry ...
StopIteration
dataset/ETHPy150Open radssh/radssh/radssh/known_hosts.py/find_first_key
402
def load(self, filename): ''' Load and index keys from OpenSSH known_hosts file. In order to preserve lines, the text content is stored in a list (_lines), and indexes are used to keep line number(s) per host, as well as index lists for hashed hosts and wildcard matches, which wo...
TypeError
dataset/ETHPy150Open radssh/radssh/radssh/known_hosts.py/KnownHosts.load
403
@classmethod def from_line(cls, line, lineno=None, filename=None): ''' Parses the given line of text to find the name(s) for the host, the type of key, and the key data. ''' if not line or not line.strip(): return None fields = line.strip().split(' ') ...
ValueError
dataset/ETHPy150Open radssh/radssh/radssh/known_hosts.py/HostKeyEntry.from_line
404
def statusUpdate(self, driver, update): logging.info("Task %s is in state %s, data %s", update.task_id.value, mesos_pb2.TaskState.Name(update.state), str(update.data)) try: key = self.task_key_map[update.task_id.value] except __HOLE__: # The map may ...
KeyError
dataset/ETHPy150Open airbnb/airflow/airflow/contrib/executors/mesos_executor.py/AirflowMesosScheduler.statusUpdate
405
def __init__(self, monitoring_latency, stats_interval=None, ip_address=None): super().__init__(monitoring_latency) self.__name = None self.__hardware_address = None if ip_address is None: ip_address = NetworkInterface.__get_active_ip_address() self._...
IndexError
dataset/ETHPy150Open uzumaxy/pyspectator/pyspectator/network.py/NetworkInterface.__init__
406
def run(xml_file): gui = GUI(window) loadxml.fromFile(gui, xml_file) if '--dump' in sys.argv: print '-'*75 gui.dump() print '-'*75 window.push_handlers(gui) gui.push_handlers(dragndrop.DragHandler('.draggable')) @gui.select('#press-me') def on_click(widget, *args):...
KeyError
dataset/ETHPy150Open ardekantur/pyglet/contrib/wydget/run_tests.py/run
407
def gettz(name): tzinfo = None if ZONEINFOFILE: for cachedname, tzinfo in CACHE: if cachedname == name: break else: tf = TarFile.open(ZONEINFOFILE) try: zonefile = tf.extractfile(name) except __HOLE__: ...
KeyError
dataset/ETHPy150Open wesabe/fixofx/3rdparty/dateutil/zoneinfo/__init__.py/gettz
408
def ExtractGroup(regex, text, group=1): """Extracts a float from a regular expression matched to 'text'. Args: regex: string or regexp pattern. Regular expression. text: string. Text to search. group: int. Group containing a floating point value. Use '0' for the whole string. Returns: A flo...
IndexError
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/regex_util.py/ExtractGroup
409
def convert_header_to_unicode(header): def _decode(value, encoding): if isinstance(value, six.text_type): return value if not encoding or encoding == 'unknown-8bit': encoding = DEFAULT_CHARSET return value.decode(encoding, 'replace') try: return ''.join( ...
UnicodeDecodeError
dataset/ETHPy150Open coddingtonbear/django-mailbox/django_mailbox/utils.py/convert_header_to_unicode
410
def get_body_from_message(message, maintype, subtype): """ Fetchs the body message matching main/sub content type. """ body = six.text_type('') for part in message.walk(): if part.get_content_maintype() == maintype and \ part.get_content_subtype() == subtype: char...
ValueError
dataset/ETHPy150Open coddingtonbear/django-mailbox/django_mailbox/utils.py/get_body_from_message
411
def poll(self): # get today and tomorrow now = datetime.datetime.now() tomorrow = now + datetime.timedelta(days=1) # get reminder time in datetime format remtime = datetime.timedelta(minutes=self.remindertime) # parse khal output for the next seven days # and ge...
ValueError
dataset/ETHPy150Open qtile/qtile/libqtile/widget/khal_calendar.py/KhalCalendar.poll
412
def _get_key(self, kh, cmd): try: return self.keys[kh] except __HOLE__: raise pyhsm.exception.YHSM_CommandFailed( pyhsm.defines.cmd2str(cmd), pyhsm.defines.YSM_KEY_HANDLE_INVALID)
KeyError
dataset/ETHPy150Open Yubico/python-pyhsm/pyhsm/soft_hsm.py/SoftYHSM._get_key
413
def _populate_cache(self): """ Populates the result cache with ``ITER_CHUNK_SIZE`` more entries (until the cursor is exhausted). """ if self._result_cache is None: self._result_cache = [] if self._has_more: try: for i in xrange(ITER...
StopIteration
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/queryset/queryset.py/QuerySet._populate_cache
414
def __repr__(self): """Provides the string representation of the QuerySet .. versionchanged:: 0.6.13 Now doesnt modify the cursor """ if self._iter: return '.. queryset mid-iteration ..' data = [] for i in xrange(REPR_OUTPUT_SIZE + 1): try: ...
StopIteration
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/queryset/queryset.py/QuerySetNoCache.__repr__
415
def test_or(self): i = self.s.union(self.otherword) self.assertEqual(self.s | set(self.otherword), i) self.assertEqual(self.s | frozenset(self.otherword), i) try: self.s | self.otherword except __HOLE__: pass else: self.fail("s|t did no...
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestJointOps.test_or
416
def test_and(self): i = self.s.intersection(self.otherword) self.assertEqual(self.s & set(self.otherword), i) self.assertEqual(self.s & frozenset(self.otherword), i) try: self.s & self.otherword except __HOLE__: pass else: self.fail("s&...
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestJointOps.test_and
417
def test_sub(self): i = self.s.difference(self.otherword) self.assertEqual(self.s - set(self.otherword), i) self.assertEqual(self.s - frozenset(self.otherword), i) try: self.s - self.otherword except __HOLE__: pass else: self.fail("s-t ...
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestJointOps.test_sub
418
def test_xor(self): i = self.s.symmetric_difference(self.otherword) self.assertEqual(self.s ^ set(self.otherword), i) self.assertEqual(self.s ^ frozenset(self.otherword), i) try: self.s ^ self.otherword except __HOLE__: pass else: self....
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestJointOps.test_xor
419
def test_remove_keyerror_unpacking(self): # bug: www.python.org/sf/1576657 for v1 in ['Q', (1,)]: try: self.s.remove(v1) except __HOLE__, e: v2 = e.args[0] self.assertEqual(v1, v2) else: self.fail()
KeyError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestSet.test_remove_keyerror_unpacking
420
def test_changingSizeWhileIterating(self): s = set([1,2,3]) try: for i in s: s.update([4]) except __HOLE__: pass else: self.fail("no exception when changing size during iteration") #=====================================================...
RuntimeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestExceptionPropagation.test_changingSizeWhileIterating
421
def test_update_operator(self): try: self.set |= self.other except __HOLE__: pass else: self.fail("expected TypeError")
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestOnlySetsInBinaryOps.test_update_operator
422
def test_intersection_update_operator(self): try: self.set &= self.other except __HOLE__: pass else: self.fail("expected TypeError")
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestOnlySetsInBinaryOps.test_intersection_update_operator
423
def test_sym_difference_update_operator(self): try: self.set ^= self.other except __HOLE__: pass else: self.fail("expected TypeError")
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestOnlySetsInBinaryOps.test_sym_difference_update_operator
424
def test_difference_update_operator(self): try: self.set -= self.other except __HOLE__: pass else: self.fail("expected TypeError")
TypeError
dataset/ETHPy150Open ofermend/medicare-demo/socialite/jython/Lib/test/test_set.py/TestOnlySetsInBinaryOps.test_difference_update_operator
425
@contextlib.contextmanager def uncache(*names): """Uncache a module from sys.modules. A basic sanity check is performed to prevent uncaching modules that either cannot/shouldn't be uncached. """ for name in names: if name in ('sys', 'marshal', 'imp'): raise ValueError( ...
KeyError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_importlib.py/uncache
426
def __init__(self): m = mapnik.Map(256, 256) try: mapnik.load_map(m, str(self.mapfile)) except __HOLE__: pass m.buffer_size = 128 m.srs = '+init=epsg:3857' self.map = m
RuntimeError
dataset/ETHPy150Open bkg/django-spillway/spillway/carto.py/Map.__init__
427
def layer(self, queryset, stylename=None): cls = VectorLayer if hasattr(queryset, 'geojson') else RasterLayer layer = cls(queryset) stylename = stylename or layer.stylename try: style = self.map.find_style(stylename) except __HOLE__: self.map.append_style(...
KeyError
dataset/ETHPy150Open bkg/django-spillway/spillway/carto.py/Map.layer
428
def get_logging_fields(self, model): """ Returns a dictionary mapping of the fields that are used for keeping the acutal audit log entries. """ rel_name = '_%s_audit_log_entry'%model._meta.object_name.lower() def entry_instance_to_unicode(log_entry): try: ...
AttributeError
dataset/ETHPy150Open Atomidata/django-audit-log/audit_log/models/managers.py/AuditLog.get_logging_fields
429
def validate(): """ Validates the wercker.json file by doing the following: * Check whether there is a git repository in the current directory or up. * Check whether there is a wercker.json file in that root. * Check whether the size of that file is greater that zero. * Check whether the wercker...
ValueError
dataset/ETHPy150Open wercker/wercker-cli/werckercli/commands/validate.py/validate
430
def test_passes_through_unhandled_errors(self): try: with self.breaker: raise RuntimeError("error") except __HOLE__: self.assertEquals(len(self.breaker.errors), 0) else: self.assertTrue(False, "exception not raised")
RuntimeError
dataset/ETHPy150Open edgeware/python-circuit/circuit/test/test_breaker.py/CircuitBreakerTestCase.test_passes_through_unhandled_errors
431
def test_catches_handled_errors(self): try: with self.breaker: raise IOError("error") except __HOLE__: self.assertEquals(len(self.breaker.errors), 1) else: self.assertTrue(False, "exception not raised")
IOError
dataset/ETHPy150Open edgeware/python-circuit/circuit/test/test_breaker.py/CircuitBreakerTestCase.test_catches_handled_errors
432
@view_config(context=Root, request_method='POST', subpath=(), renderer='json') @view_config(context=SimpleResource, request_method='POST', subpath=(), renderer='json') @argify def upload(request, content, name=None, version=None): """ Handle update commands """ action = request.param(':action', 'fi...
ValueError
dataset/ETHPy150Open mathcamp/pypicloud/pypicloud/views/simple.py/upload
433
@property def message(self): try: return self.args[0] except __HOLE__: return ""
IndexError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPError.message
434
def __delitem__(self, header): try: del self.headers[header] except __HOLE__: pass
IndexError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HttpResponse.__delitem__
435
def close(self): try: self._container.close() except __HOLE__: pass
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HttpResponse.close
436
def __getitem__(self, key): for d in (self.POST, self.GET): try: return d[key] except __HOLE__: pass raise KeyError("%s not found in either POST or GET" % key)
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest.__getitem__
437
def _get_get(self): try: return self._get except __HOLE__: # The WSGI spec says 'QUERY_STRING' may be absent. self._get = urlparse.queryparse(self.environ.get(b'QUERY_STRING', b'')) return self._get
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_get
438
def _get_post(self): try: return self._post except __HOLE__: self._parse_post_content() return self._post
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_post
439
def _get_cookies(self): try: return self._cookies except __HOLE__: self._cookies = cookies = {} for cookie in httputils.parse_cookie(self.environ.get(b'HTTP_COOKIE', b'')): cookies[cookie.name] = cookie.value return cookies
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_cookies
440
def _get_files(self): try: return self._files except __HOLE__: self._parse_post_content() return self._files
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_files
441
def _get_raw_post_data(self): try: content_length = int(self.environ.get(b"CONTENT_LENGTH")) except __HOLE__: # if CONTENT_LENGTH was empty string or not an integer raise HttpErrorLengthRequired("A Content-Length header is required.") return self.environ[b'wsgi.input'].re...
ValueError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_raw_post_data
442
def _get_headers(self): try: return self._headers except __HOLE__: self._headers = hdrs = httputils.Headers() for k, v in self.environ.iteritems(): if k.startswith(b"HTTP"): hdrs.append(httputils.make_header(k[5:].replace(b"_", b"-"...
AttributeError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/HTTPRequest._get_headers
443
def unregister(self, method): if isinstance(method, basestring): method = get_method(method) try: m = self._reverse[method] except __HOLE__: return # not registered anyway else: del self._reverse[method] i = 0 for ur...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/URLResolver.unregister
444
def get_url(self, method, **kwargs): """Reverse mapping. Answers the question: How do I reach the callable object mapped to in the LOCATIONMAP? """ if isinstance(method, basestring): if "." in method: method = get_method(method) else: ...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/URLResolver.get_url
445
def get_alias(self, name, **kwargs): try: urlmap = self._aliases[name] except __HOLE__: raise InvalidPath("Alias not registered") return urlmap.get_url(**kwargs)
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/URLResolver.get_alias
446
def __call__(self, request, **kwargs): meth = self._methods.get(request.method, self._invalid) try: return meth(request, **kwargs) except __HOLE__: return HttpResponseNotAllowed(self._implemented)
NotImplementedError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/RequestHandler.__call__
447
def get(self, request, function): try: handler = self._mapping[function] except __HOLE__: request.log_error("No JSON handler for %r.\n" % function) return JSON404() kwargs = JSONQuery(request) try: return JSONResponse(handler(request, **kwa...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/JSONRequestHandler.get
448
def get_large_icon(self, name): try: namepair = self.config.ICONMAP["large"][name] except __HOLE__: namepair = self.config.ICONMAP["large"]["default"] return self._doc.nodemaker(b"Img", {"src": self.resolver.get_url("images", name=namepair[1]), "alt...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/ResponseDocument.get_large_icon
449
def get_medium_icon(self, name): try: filename = self.config.ICONMAP["medium"][name] except __HOLE__: filename = self.config.ICONMAP["medium"]["default"] return self._doc.nodemaker(b"Img", {"src": self.resolver.get_url("images", name=filename), "alt...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/ResponseDocument.get_medium_icon
450
def get_small_icon(self, name): try: filename = self.config.ICONMAP["small"][name] except __HOLE__: filename = self.config.ICONMAP["small"]["default"] return self._doc.nodemaker(b"Img", {"src": self.resolver.get_url("images", name=filename), "alt":n...
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/ResponseDocument.get_small_icon
451
def _get_module(name): try: return sys.modules[name] except __HOLE__: pass mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod
KeyError
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/framework.py/_get_module
452
def handle(self, requests): logging.debug("[zmq] <~ self%s" % ''.join([format_method(*req) for req in requests])) # loop request chain module = self.server.module result = module parsed = module.name for method, args, kwargs in requests: # parse request try: if method == '__dir': result = d...
AttributeError
dataset/ETHPy150Open alexcepoi/pyscale/pyscale/zmq/rpc.py/RpcWorker.handle
453
def do_get_member_for(parser, token): try: # Splitting by None == splitting by spaces. tag_name, arg = token.contents.split(None, 1) except __HOLE__: raise template.TemplateSyntaxError, "%r tag requires arguments" % token.contents.split()[0] m = re.search(r'(\w+) as (\w+)', arg) ...
ValueError
dataset/ETHPy150Open ofri/Open-Knesset/mks/templatetags/mks_tags.py/do_get_member_for
454
@staticmethod def get_board(id_): try: return DeviceService.get_boards()[id_] except __HOLE__: raise BoardUnknownId(id_)
KeyError
dataset/ETHPy150Open smartanthill/smartanthill1_0/smartanthill/device/service.py/DeviceService.get_board
455
def test_is_forest(): # generate chain chain = np.c_[np.arange(1, 10), np.arange(9)] assert_true(is_forest(chain, len(chain) + 1)) assert_true(is_forest(chain)) # generate circle circle = np.vstack([chain, [9, 0]]) assert_false(is_forest(circle)) assert_false(is_forest(circle, len(chain)...
ImportError
dataset/ETHPy150Open pystruct/pystruct/pystruct/tests/test_inference/test_maxprod.py/test_is_forest
456
def _format_peer_cidrs(ipsec_site_connection): try: return '\n'.join([jsonutils.dumps(cidrs) for cidrs in ipsec_site_connection['peer_cidrs']]) except (TypeError, __HOLE__): return ''
KeyError
dataset/ETHPy150Open openstack/python-neutronclient/neutronclient/neutron/v2_0/vpn/ipsec_site_connection.py/_format_peer_cidrs
457
def _read_incdec(self, reader): response_line = reader.read_line() try: return MemcacheResult.OK, int(response_line) except __HOLE__: return MemcacheResult.get(response_line), None
ValueError
dataset/ETHPy150Open hrosenhorn/gevent-memcache/lib/geventmemcache/protocol.py/MemcacheTextProtocol._read_incdec
458
def readfileintodict(filename, d): ''' Read key=value pairs from a file, into a dict. Skip comments; strip newline characters and spacing. ''' with open(filename, 'r') as f: lines = f.readlines() for l in lines: if l[:1] == '#': continue try: key, ...
ValueError
dataset/ETHPy150Open coreemu/core/daemon/core/misc/utils.py/readfileintodict
459
def get_object(self): try: return self._object except __HOLE__: transfer_id = self.kwargs['transfer_id'] try: self._object = cinder.transfer_get(self.request, transfer_id) return self._object except Exception: ...
AttributeError
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/volumes/volumes/views.py/ShowTransferView.get_object
460
def start(self): """Start the app for the stop subcommand.""" try: pid = self.get_pid_from_file() except PIDFileError: self.log.critical( 'Could not read pid file, cluster is probably not running.' ) # Here I exit with a unusual exi...
OSError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/ipclusterapp.py/IPClusterStop.start
461
def build_launcher(self, clsname): """import and instantiate a Launcher based on importstring""" if '.' not in clsname: # not a module, presume it's the raw name in apps.launcher clsname = 'IPython.parallel.apps.launcher.'+clsname # print repr(clsname) try: ...
ImportError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/ipclusterapp.py/IPClusterEngines.build_launcher
462
def start(self): """Start the app for the engines subcommand.""" self.log.info("IPython cluster: started") # First see if the cluster is already running # Now log and daemonize self.log.info( 'Starting engines with [daemon=%r]' % self.daemonize ) ...
KeyboardInterrupt
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/ipclusterapp.py/IPClusterEngines.start
463
def start(self): """Start the app for the start subcommand.""" # First see if the cluster is already running try: pid = self.get_pid_from_file() except PIDFileError: pass else: if self.check_pid(pid): self.log.critical( ...
KeyboardInterrupt
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/apps/ipclusterapp.py/IPClusterStart.start
464
def parse_lookup(self, lookup): try: section, name = lookup.split( preferences_settings.SECTION_KEY_SEPARATOR) except __HOLE__: name = lookup section = None return section, name
ValueError
dataset/ETHPy150Open EliotBerriot/django-dynamic-preferences/dynamic_preferences/managers.py/PreferencesManager.parse_lookup
465
def load_from_db(self): """Return a dictionary of preferences by section directly from DB""" a = {} db_prefs = {p.preference.identifier(): p for p in self.queryset} for preference in self.registry.preferences(): try: db_pref = db_prefs[preference.identifier()]...
KeyError
dataset/ETHPy150Open EliotBerriot/django-dynamic-preferences/dynamic_preferences/managers.py/PreferencesManager.load_from_db
466
def get(self, *args, **kwargs): angular_modules = [] js_files = [] for app_config in apps.get_app_configs(): # Add the angular app, if the module has one. if getattr(app_config, 'angular_{}_module'.format(kwargs.get('openslides_app')), ...
AttributeError
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/core/views.py/AppsJsView.get
467
@detail_route(methods=['post']) def update_elements(self, request, pk): """ REST API operation to update projector elements. It expects a POST request to /rest/core/projector/<pk>/update_elements/ with a dictonary to update the projector config. This must be a dictionary with...
ValueError
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/core/views.py/ProjectorViewSet.update_elements
468
@detail_route(methods=['post']) def deactivate_elements(self, request, pk): """ REST API operation to deactivate projector elements. It expects a POST request to /rest/core/projector/<pk>/deactivate_elements/ with a list of hex UUIDs. These are the projector_elements in the config ...
ValueError
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/core/views.py/ProjectorViewSet.deactivate_elements
469
@staticmethod def try_login(username, password): conn = get_ldap_connection(configuration.get("ldap", "bind_user"), configuration.get("ldap", "bind_password")) search_filter = "(&({0})({1}={2}))".format( configuration.get("ldap", "user_filter"), configuration.get("ldap", "us...
KeyError
dataset/ETHPy150Open airbnb/airflow/airflow/contrib/auth/backends/ldap_auth.py/LdapUser.try_login
470
def parse_datetime(d): """ Parse a datetime as formatted in one of the following formats: date: %Y-%m-%d' datetime: '%Y-%m-%d %H:%M:%S' datetime with microseconds: '%Y-%m-%d %H:%M:%S.%f' Can also handle a datetime.date or datetime.datetime object, (or anything that has year, month and day ...
ValueError
dataset/ETHPy150Open StackStorm/st2contrib/packs/lastline/actions/lib/analysis_apiclient.py/parse_datetime
471
def get_completed(self, after, before): """ Return scores of tasks completed in the specified time range. This takes care of using the analysis API's pagination to make sure it gets all tasks. :param after: datetime.datetime :param before: datetime.datetime :yi...
TypeError
dataset/ETHPy150Open StackStorm/st2contrib/packs/lastline/actions/lib/analysis_apiclient.py/TaskCompletion.get_completed
472
def init_shell(banner): """Set up the iPython shell.""" try: #this import can fail, that's why it's in a try block! #pylint: disable=E0611 #pylint: disable=F0401 from IPython.frontend.terminal.embed import InteractiveShellEmbed #@UnresolvedImport #pylint: enable=E0611 ...
ImportError
dataset/ETHPy150Open StackStorm/st2contrib/packs/lastline/actions/lib/analysis_apiclient.py/init_shell
473
def get_style(style): from markdown_deux.conf import settings try: return settings.MARKDOWN_DEUX_STYLES[style] except __HOLE__: return settings.MARKDOWN_DEUX_STYLES.get("default", settings.MARKDOWN_DEUX_DEFAULT_STYLE)
KeyError
dataset/ETHPy150Open trentm/django-markdown-deux/lib/markdown_deux/__init__.py/get_style
474
def test_no_style_xml(): try: import openpyxl except __HOLE__: raise nose.SkipTest('openpyxl not installed') data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] # data is a 2D array filename = get_output_path("no_style.xlsx") sheetname = "test" wb = Workbook() wb.new_sheet(sheetname, data=data) wb.save(filename) wbr ...
ImportError
dataset/ETHPy150Open kz26/PyExcelerate/pyexcelerate/tests/test_Style.py/test_no_style_xml
475
def call(self, path, query=None, method='GET', data=None, files=None, get_all_pages=False, complete_response=False, **kwargs): """Make a REST call to the Zendesk web service. Parameters: path - Path portion of the Zendesk REST endpoint URL. query - Query parame...
KeyError
dataset/ETHPy150Open fprimex/zdesk/zdesk/zdesk.py/Zendesk.call
476
def parse_soup(content): try: soup = BeautifulSoup(content, convertEntities=BeautifulSoup.HTML_ENTITIES) return soup except __HOLE__, e: logger.error("%d: %s" % (e.code, e.msg)) return
HTTPError
dataset/ETHPy150Open numb3r3/crawler-python/crawler/core/base.py/parse_soup
477
def get_response(url, proxies=None): try: if proxies: if url.startswith('http:') and 'http' in proxies: prox = proxies['http'] if prox.startswith('socks'): session.proxies = proxies r = session.get(url) else:...
ValueError
dataset/ETHPy150Open numb3r3/crawler-python/crawler/core/base.py/get_response
478
def _get_office(self, raw_result): office_query = { 'state': STATE, 'name': self._clean_office(raw_result.office) } if office_query['name'] is 'President': office_query['state'] = 'US' if office_query['name'] in self.district_offices: #if...
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/BaseTransform._get_office
479
def get_party(self, raw_result, attr='party'): party = getattr(raw_result, attr) if not party: return None clean_abbrev = self._clean_party(party) if not clean_abbrev: return None try: return self._party_cache[clean_abbrev] except __H...
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/BaseTransform.get_party
480
def _clean_party(self, party): try: return self.PARTY_MAP[party] except __HOLE__: return None
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/BaseTransform._clean_party
481
def get_candidate_fields(self, raw_result): year = raw_result.end_date.year fields = self._get_fields(raw_result, candidate_fields) try: name = HumanName(raw_result.full_name) except __HOLE__: name = HumanName("{} {}".format(raw_result.given_name, raw_result.fam...
TypeError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/BaseTransform.get_candidate_fields
482
def get_contest(self, raw_result): """ Returns the Contest model instance for a given RawResult. Caches the result in memory to reduce the number of calls to the datastore. """ key = "%s-%s" % (raw_result.election_id, raw_result.contest_slug) try: #p...
IndexError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/BaseTransform.get_contest
483
def get_candidate(self, raw_result, extra={}): """ Get the Candidate model for a RawResult Keyword arguments: * extra - Dictionary of extra query parameters that will be used to select the candidate. """ key = (raw_result.election_id, raw_result.conte...
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/wa/transform/__init__.py/CreateResultsTransform.get_candidate
484
def getstat(path): """ returns the stat information of a file""" statinfo=None try: statinfo=os.lstat(path) except (IOError, __HOLE__) as e: # FileNotFoundError only since python 3.3 if args.debug: sys.stderr.write(str(e)) except: raise return statinfo
OSError
dataset/ETHPy150Open FredHutch/swift-commander/swift_commander/swsymlinks.py/getstat
485
def get_klasses(): modules = [rest_views, generics, serializers] if viewsets is not None: modules.append(viewsets) klasses = {} for module in modules: for attr_str in dir(module): is_subclass = False attr = getattr(module, attr_str) try: ...
TypeError
dataset/ETHPy150Open vintasoftware/cdrf.co/rest_framework_ccbv/inspector.py/get_klasses
486
def kappa(y_true, y_pred, weights=None, allow_off_by_one=False): """ Calculates the kappa inter-rater agreement between two the gold standard and the predicted ratings. Potential values range from -1 (representing complete disagreement) to 1 (representing complete agreement). A kappa value of 0 is ...
ValueError
dataset/ETHPy150Open EducationalTestingService/skll/skll/metrics.py/kappa
487
def makeAnnotatorDistance( infile, outfile, builder, workspace, workspace_label="direction", annotations = None ): '''check statistical association between intervals and tra...
OSError
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD_annotator.py/makeAnnotatorDistance
488
def main(): parser = argparse.ArgumentParser(description="Fixes the content-type of assets on S3") parser.add_argument("--access-key", "-a", type=str, required=True, help="The AWS access key") parser.add_argument("--secret-key", "-s", type=str, required=True, help="The AWS secret key") parser.add_argum...
KeyboardInterrupt
dataset/ETHPy150Open dailymuse/s3-content-type-fixer/s3_content_type_fixer.py/main
489
def __getitem__(self, name): try: return self._class_info[name] except __HOLE__: return self._function_info[name]
KeyError
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/getdocs.py/SuiteInfoBase.__getitem__
490
def is_row_deleted(self, row_getter): def predicate(driver): if self._is_element_present(*self._empty_table_locator): return True with self.waits_disabled(): return not self._is_element_displayed(row_getter()) try: self._wait_until(pred...
IndexError
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/test/integration_tests/regions/tables.py/TableRegion.is_row_deleted
491
def project(self, project, **kwargs): """Wraps `Rundeck API /project/[NAME] <http://rundeck.org/docs/api/index.html#getting-project-info>`_ :Parameters: project : str name of Project :Keywords: create : bool Create the project if it is no...
HTTPError
dataset/ETHPy150Open marklap/rundeckrun/rundeck/api.py/RundeckApiTolerant.project
492
def test_instance(self): ''' Test creating and deleting instance on Joyent ''' try: self.assertIn( INSTANCE_NAME, [i.strip() for i in self.run_cloud('-p joyent-test {0}'.format(INSTANCE_NAME))] ) except AssertionError: ...
AssertionError
dataset/ETHPy150Open saltstack/salt/tests/integration/cloud/providers/joyent.py/JoyentTest.test_instance
493
def assertContainsSameWords(self, string1, string2): try: for w1, w2 in zip_longest(string1.split(), string2.split(), fillvalue=''): self.assertEqual(w1, w2) except __HOLE__: raise AssertionError("%r does not contain the same words as %r" % (string1, ...
AssertionError
dataset/ETHPy150Open fusionbox/django-widgy/tests/utilstests/tests.py/HtmlToText.assertContainsSameWords
494
def credentials_are_valid(self, user_settings, client): if user_settings: client = client or GitHubClient(external_account=user_settings.external_accounts[0]) try: client.user() except (GitHubError, __HOLE__): return False return True
IndexError
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/github/serializer.py/GitHubSerializer.credentials_are_valid
495
def get_lan_ip(): ip = socket.gethostbyname(socket.gethostname()) if ip.startswith("127.") and os.name != "nt": interfaces = [ "eth0", "eth1", "eth2", "wlan0", "wlan1", "wifi0", "ath0", "ath1", "p...
IOError
dataset/ETHPy150Open xumiao/pymonk/monk/utils/utils.py/get_lan_ip
496
def get_base_schema(self): ''' Retrieves base schema, taking into account dynamic typing ''' schema = self.admin.model if schema._meta.typed_field: field = schema._meta.fields[schema._meta.typed_field] if self.request.GET.get(schema._meta.typed_field, Fals...
KeyError
dataset/ETHPy150Open zbyte64/django-dockit/dockit/admin/views.py/DocumentProxyView.get_base_schema
497
def _unpickle_method(func_name, obj, cls): """ Author: Steven Bethard http://bytes.com/topic/python/answers/552476-why-cant-you-pickle-instancemethods """ for cls in cls.mro(): try: func = cls.__dict__[func_name] except __HOLE__: pass else: ...
KeyError
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py/_unpickle_method
498
def is_number(s): """Check if input is float.""" try: float(s) return True except __HOLE__: return False
TypeError
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py/is_number
499
def worker_landmarks_curved(self, arguments_worker): """Define landmarks along the centerline. Here, landmarks are densely defined along the centerline, and every gapxy, a cross of landmarks is created """ try: iz = arguments_worker[0] iz_curved, x_centerline_deri...
KeyboardInterrupt
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py/SpinalCordStraightener.worker_landmarks_curved