Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
500
def format_uptime(start_time): try: delta = datetime.now() - start_time days = delta.days hours = delta.seconds / 3600 minutes = (delta.seconds % 3600) / 60 seconds = (delta.seconds % 3600) % 60 return "%dd %dh %dm %ds" % (days, hours, minutes, seconds) except __H...
TypeError
dataset/ETHPy150Open onefinestay/gonzo/gonzo/scripts/utils.py/format_uptime
501
def _wait_file_notifier(self, filepath): while True: try: open(filepath) except __HOLE__: time.sleep(0.1) else: break #time.sleep(1)
IOError
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/bot/wl_process.py/WebLabProcess._wait_file_notifier
502
def get_url(self): """ Return a generated url from ``rule`` attribute. Returns ------- str Generated url """ try: rule = self.rule except __HOLE__: raise NotImplementedError('``rule`` attr must be defined.') return ur...
AttributeError
dataset/ETHPy150Open thisissoon/Flask-Velox/flask_velox/mixins/http.py/RedirectMixin.get_url
503
def get_libclang_headers(): try: paths = _ask_clang() except __HOLE__: paths = _guess_paths() return ['-I%s' % path for path in paths]
OSError
dataset/ETHPy150Open punchagan/cinspect/cinspect/clang_utils.py/get_libclang_headers
504
def read(): try: return sys.stdin.buffer.read() except __HOLE__: return sys.stdin.read()
AttributeError
dataset/ETHPy150Open freedoom/freedoom/bootstrap/bootstrap.py/read
505
def write(out): try: sys.stdout.buffer.write(out) except __HOLE__: sys.stdout.write(out)
AttributeError
dataset/ETHPy150Open freedoom/freedoom/bootstrap/bootstrap.py/write
506
def cached_wheel(cache_dir, link, format_control, package_name): if not cache_dir: return link if not link: return link if link.is_wheel: return link if not link.is_artifact: return link if not package_name: return link canonical_name = pkg_resources.safe_...
OSError
dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/site-packages/pip/wheel.py/cached_wheel
507
def render(self, context): if 'forloop' in context: parentloop = context['forloop'] else: parentloop = {} context.push() try: values = self.sequence.resolve(context, True) except VariableDoesNotExist: values = [] if values i...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/template/defaulttags.py/ForNode.render
508
def render(self, context): filepath = self.filepath.resolve(context) if not include_is_allowed(filepath): if settings.DEBUG: return "[Didn't have permission to include file]" else: return '' # Fail silently for invalid includes. try: ...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/template/defaulttags.py/SsiNode.render
509
def render(self, context): try: value = self.val_expr.resolve(context) max_value = self.max_expr.resolve(context) max_width = int(self.max_width.resolve(context)) except VariableDoesNotExist: return '' except (ValueError, TypeError): ra...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/template/defaulttags.py/WidthRatioNode.render
510
def refresh(self): """ Refresh context with new declarations from known registries. Useful for third-party extensions. """ # Populate built-in registry from . import (arraymath, enumimpl, iterators, linalg, numbers, optional, rangeobj, slicing, smar...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.refresh
511
def install_registry(self, registry): """ Install a *registry* (a imputils.Registry instance) of function and attribute implementations. """ try: loader = self._registries[registry] except __HOLE__: loader = RegistryLoader(registry) sel...
KeyError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.install_registry
512
def get_constant_generic(self, builder, ty, val): """ Return a LLVM constant representing value *val* of Numba type *ty*. """ try: impl = self._get_constants.find((ty,)) return impl(self, builder, ty, val) except __HOLE__: raise NotImplementedE...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.get_constant_generic
513
def get_function(self, fn, sig): """ Return the implementation of function *fn* for signature *sig*. The return value is a callable with the signature (builder, args). """ sig = sig.as_function() if isinstance(fn, (types.Function, types.BoundFunction, ...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.get_function
514
def get_getattr(self, typ, attr): """ Get the getattr() implementation for the given type and attribute name. The return value is a callable with the signature (context, builder, typ, val, attr). """ if isinstance(typ, types.Module): # Implement getattr for mo...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.get_getattr
515
def get_setattr(self, attr, sig): """ Get the setattr() implementation for the given attribute name and signature. The return value is a callable with the signature (builder, args). """ assert len(sig.args) == 2 typ = sig.args[0] valty = sig.args[1] ...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.get_setattr
516
def cast(self, builder, val, fromty, toty): """ Cast a value of type *fromty* to type *toty*. This implements implicit conversions as can happen due to the granularity of the Numba type system, or lax Python semantics. """ if fromty == toty or toty == types.Any: ...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext.cast
517
def _call_nrt_incref_decref(self, builder, root_type, typ, value, funcname, getters=()): self._require_nrt() from numba.runtime.atomicops import incref_decref_ty data_model = self.data_model_manager[typ] members = data_model.traverse(builder) fo...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/targets/base.py/BaseContext._call_nrt_incref_decref
518
def Import(modname): try: return sys.modules[modname] except __HOLE__: pass mod = __import__(modname) pathparts = modname.split(".") for part in pathparts[1:]: mod = getattr(mod, part) sys.modules[modname] = mod return mod
KeyError
dataset/ETHPy150Open kdart/pycopia/fepy/pycopia/fepy/remote/IpyServer.py/Import
519
def __call__(self, target, source, env): """ Smart autoscan function. Gets the list of objects for the Program or Lib. Adds objects and builders for the special qt files. """ try: if int(env.subst('$QT_AUTOSCAN')) == 0: return target, source ex...
ValueError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/qt.py/_Automoc.__call__
520
def real_download(self, filename, info_dict): def run_rtmpdump(args): start = time.time() resume_percent = None resume_downloaded_data_len = None proc = subprocess.Popen(args, stderr=subprocess.PIPE) cursor_in_new_line = True proc_stderr_cl...
ImportError
dataset/ETHPy150Open yasoob/youtube-dl-GUI/youtube_dl/downloader/rtmp.py/RtmpFD.real_download
521
def test_nargs_default(runner): try: @click.command() @click.argument('src', nargs=-1, default=42) def copy(src): pass except __HOLE__ as e: assert 'nargs=-1' in str(e) else: assert False
TypeError
dataset/ETHPy150Open pallets/click/tests/test_arguments.py/test_nargs_default
522
def _fetch_content_type_counts(self): """ If an object with an empty _ct_inventory is encountered, compute all the content types currently used on that object and save the list in the object itself. Further requests for that object can then access that information and find out wh...
KeyError
dataset/ETHPy150Open feincms/feincms/feincms/module/extensions/ct_tracker.py/TrackerContentProxy._fetch_content_type_counts
523
def do_transition(self, comment, transition, user): try: if transition in self.get_current_state().origin_transitions.all(): self.log_entries.create( comment=comment, transition=transition, user=user ) except __HOLE__: # No init...
AttributeError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/document_states/models.py/WorkflowInstance.do_transition
524
def get_current_state(self): try: return self.get_last_transition().destination_state except __HOLE__: return self.workflow.get_initial_state()
AttributeError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/document_states/models.py/WorkflowInstance.get_current_state
525
def get_last_log_entry(self): try: return self.log_entries.order_by('datetime').last() except __HOLE__: return None
AttributeError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/document_states/models.py/WorkflowInstance.get_last_log_entry
526
def get_last_transition(self): try: return self.get_last_log_entry().transition except __HOLE__: return None
AttributeError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/document_states/models.py/WorkflowInstance.get_last_transition
527
def _parse_headers(self, data): data = native_str(data.decode('latin1')) eol = data.find("\r\n") start_line = data[:eol] try: headers = httputil.HTTPHeaders.parse(data[eol:]) except __HOLE__: # probably form split() if there was no ':' in the line ...
ValueError
dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/http1connection.py/HTTP1Connection._parse_headers
528
@require_POST @csrf_exempt def import_submission_for_form(request, username, id_string): """ Retrieve and process submission from SMSSync Request """ sms_identity = request.POST.get('From', '').strip() sms_text = request.POST.get('Body', '').strip() now_timestamp = datetime.datetime.now().strftime('%s'...
ValueError
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/sms_support/providers/twilio.py/import_submission_for_form
529
def setup_env(): """Configures app engine environment for command-line apps.""" # Try to import the appengine code from the system path. try: from google.appengine.api import apiproxy_stub_map except __HOLE__: for k in [k for k in sys.modules if k.startswith('google')]: del s...
ImportError
dataset/ETHPy150Open adieu/djangoappengine/boot.py/setup_env
530
def setup_threading(): if sys.version_info >= (2, 7): return # XXX: On Python 2.5 GAE's threading.local doesn't work correctly with subclassing try: from django.utils._threading_local import local import threading threading.local = local except __HOLE__: pass
ImportError
dataset/ETHPy150Open adieu/djangoappengine/boot.py/setup_threading
531
def setup_project(): from .utils import have_appserver, on_production_server if have_appserver: # This fixes a pwd import bug for os.path.expanduser() env_ext['HOME'] = PROJECT_DIR # The dev_appserver creates a sandbox which restricts access to certain # modules and builtins in order to...
AttributeError
dataset/ETHPy150Open adieu/djangoappengine/boot.py/setup_project
532
@property def n_topics(self): try: return self.model.n_topics except __HOLE__: return self.model.n_components
AttributeError
dataset/ETHPy150Open chartbeat-labs/textacy/textacy/tm/topic_model.py/TopicModel.n_topics
533
def _get_aa(self, attr): if attr in self.cache: return self.cache[attr] else: try: kv = self.KVClass.objects.get(**{'key': attr, 'obj': self.obj}) except __HOLE__: raise AttributeError("{...
ObjectDoesNotExist
dataset/ETHPy150Open mozilla/inventory/core/keyvalue/utils.py/AuxAttr._get_aa
534
def __getattribute__(self, attr): try: return super(AuxAttr, self).__getattribute__(attr) except __HOLE__: pass return self._get_aa(attr)
AttributeError
dataset/ETHPy150Open mozilla/inventory/core/keyvalue/utils.py/AuxAttr.__getattribute__
535
def __setattr__(self, attr, value): try: if super(AuxAttr, self).__getattribute__(attr): return super(AuxAttr, self).__setattr__(attr, value) except AttributeError: pass try: kv = self.KVClass.objects.get(**{'key': attr, 'obj': ...
ObjectDoesNotExist
dataset/ETHPy150Open mozilla/inventory/core/keyvalue/utils.py/AuxAttr.__setattr__
536
def __delattr__(self, attr): try: if super(AuxAttr, self).__getattribute__(attr): return super(AuxAttr, self).__delattr__(attr) except __HOLE__: pass if hasattr(self, attr): self.cache.pop(attr) kv = self.KVClass.objects.get(**{'key...
AttributeError
dataset/ETHPy150Open mozilla/inventory/core/keyvalue/utils.py/AuxAttr.__delattr__
537
def tearDown(self): for filename in (self.csv_file, self.json_file, self.schema_file): try: remove(filename) except __HOLE__: continue
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/avro-1.7.6/test/test_script.py/TestWrite.tearDown
538
@staticmethod def read(reader, dump=None): name = reader.constant_pool[reader.read_u2()].bytes.decode('mutf-8') size = reader.read_u4() if dump is not None: reader.debug(" " * dump, '%s (%s bytes)' % (name, size)) try: return globals()[name].read_info(read...
KeyError
dataset/ETHPy150Open pybee/voc/voc/java/attributes.py/Attribute.read
539
@task def evacuate(name_config=None, debug=None, iteration=False): init(name_config, debug) try: iteration = int(iteration) except __HOLE__: LOG.error("Invalid value provided as 'iteration' argument, it must be " "integer") return env.key_filename = cfglib.CONF....
ValueError
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/fabfile.py/evacuate
540
def render_admin_panel(self, req, cat, page, path_info): # Trap AssertionErrors and convert them to TracErrors try: return self._render_admin_panel(req, cat, page, path_info) except __HOLE__ as e: raise TracError(e)
AssertionError
dataset/ETHPy150Open edgewall/trac/trac/ticket/admin.py/TicketAdminPanel.render_admin_panel
541
def _do_remove(self, number): try: number = int(number) except __HOLE__: raise AdminCommandError(_("<number> must be a number")) with self.env.db_transaction: model.Ticket(self.env, number).delete() printout(_("Ticket #%(num)s and all associated data r...
ValueError
dataset/ETHPy150Open edgewall/trac/trac/ticket/admin.py/TicketAdmin._do_remove
542
def prompt_for_user_token(username, scope=None, client_id = None, client_secret = None, redirect_uri = None): ''' prompts the user to login if necessary and returns the user token suitable for use with the spotipy.Spotify constructor Parameters: - username - the Spotify u...
NameError
dataset/ETHPy150Open plamere/spotipy/spotipy/util.py/prompt_for_user_token
543
def getattr_gi(self, inst, key): #TODO: this can probably just be removed now? return self.NONE try: if inst.get_data(key) is None: return self.NONE except __HOLE__: return self.NONE type.__setattr__(inst.__class__, key, GIProxy(key, 'data'...
TypeError
dataset/ETHPy150Open pyjs/pyjs/pyjs/runners/giwebkit.py/GIResolver.getattr_gi
544
def getattr_w3(self, inst, key_w3): key_gi = self._key_gi(key_w3) for base in inst.__class__.__mro__: key = (base, key_w3) if key in self._custom: try: attr = self._custom[key].bind(key) except __HOLE__: attr...
AttributeError
dataset/ETHPy150Open pyjs/pyjs/pyjs/runners/giwebkit.py/GIResolver.getattr_w3
545
def get_process_list(self): process_list = [] for p in psutil.process_iter(): mem = p.memory_info() # psutil throws a KeyError when the uid of a process is not associated with an user. try: username = p.username() except __HOLE...
KeyError
dataset/ETHPy150Open Jahaja/psdash/psdash/node.py/LocalService.get_process_list
546
def get_process(self, pid): p = psutil.Process(pid) mem = p.memory_info_ex() cpu_times = p.cpu_times() # psutil throws a KeyError when the uid of a process is not associated with an user. try: username = p.username() except __HOLE__: username = No...
KeyError
dataset/ETHPy150Open Jahaja/psdash/psdash/node.py/LocalService.get_process
547
def get_logs(self): available_logs = [] for log in self.node.logs.get_available(): try: stat = os.stat(log.filename) available_logs.append({ 'path': log.filename.encode("utf-8"), 'size': stat.st_size, ...
OSError
dataset/ETHPy150Open Jahaja/psdash/psdash/node.py/LocalService.get_logs
548
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' osmajor = _osrel()[0] if osmajor < '6': cmd = 'update-rc.d -f {0} defaults 99'.format(_cmd_quote(name)) else: ...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/modules/debian_service.py/enable
549
def _convert_entity(m): if m.group(1) == "#": try: return unichr(int(m.group(2))) except __HOLE__: return "&#%s;" % m.group(2) try: return _HTML_UNICODE_MAP[m.group(2)] except KeyError: return "&%s;" % m.group(2)
ValueError
dataset/ETHPy150Open IanLewis/kay/kay/ext/gaema/escape.py/_convert_entity
550
def get(self, key): """Returns the deserialized data for the provided key. """ encoded_key = self.encode_key(key) try: return self.deserialize_data(self.get_binary(encoded_key)) except __HOLE__: if encoded_key == key: raise KeyError(binasc...
KeyError
dataset/ETHPy150Open blixt/py-starbound/starbound/btreedb4.py/FileBTreeDB4.get
551
@require_can_edit_apps def form_designer(request, domain, app_id, module_id=None, form_id=None): meta = get_meta(request) track_entered_form_builder_on_hubspot.delay(request.couch_user, request.COOKIES, meta) app = get_app(domain, app_id) module = None try: module = app.get_module(module_i...
IndexError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/app_manager/views/formdesigner.py/form_designer
552
def process_response(self, request, response): content_type = response.get('content-type') try: if content_type.startswith('text/html'): # only update last_access when rendering the main page request.customer.last_access = timezone.now() reques...
AttributeError
dataset/ETHPy150Open awesto/django-shop/shop/middleware.py/CustomerMiddleware.process_response
553
def _url_for_fetch(self, mapping): try: return mapping['pre_processed_url'] except __HOLE__: return mapping['raw_url']
KeyError
dataset/ETHPy150Open openelections/openelections-core/openelex/us/tx/datasource.py/Datasource._url_for_fetch
554
def shortest_augmenting_path_impl(G, s, t, capacity, residual, two_phase, cutoff): """Implementation of the shortest augmenting path algorithm. """ if s not in G: raise nx.NetworkXError('node %s not in graph' % str(s)) if t not in G: raise nx.NetworkXErr...
StopIteration
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/flow/shortestaugmentingpath.py/shortest_augmenting_path_impl
555
def main(args): git_uri = validate_args(args) client = _get_solum_client() plan_file = get_planfile(git_uri, args.app_name, args.command, args.public) print('\n') print("************************* Starting setup *************************") print('\n') plan_uri = create_plan(client, plan_file)...
OSError
dataset/ETHPy150Open openstack/python-solumclient/contrib/setup-tools/solum-app-setup.py/main
556
@classmethod def setUpClass(cls): # Upload the app to the Platform. cls.base_input = makeInputs() bundled_resources = dxpy.app_builder.upload_resources(src_dir) try: app_name = os.path.basename(os.path.abspath(src_dir)) + "_test" except __HOLE__: app_n...
OSError
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/templating/templates/python/basic/test/test.py/TestDX_APP_WIZARD_NAME.setUpClass
557
def getvideosize(url, verbose=False): try: if url.startswith('http:') or url.startswith('https:'): ffprobe_command = ['ffprobe', '-icy', '0', '-loglevel', 'repeat+warning' if verbose else 'repeat+error', '-print_format', 'json', '-select_streams', 'v', '-show_format', '-show_streams', '-timeout'...
KeyboardInterrupt
dataset/ETHPy150Open cnbeining/Biligrab/biligrab.py/getvideosize
558
def checkForTracebacks(self): try: with open(self.appServer.errorLog) as f: data = f.read() if 'Traceback (most recent call last)' in data: print >> sys.stderr, "Contents of error.log after test:" print >> sys.stderr, data s...
IOError
dataset/ETHPy150Open sassoftware/conary/conary_test/lib/repserver.py/ConaryServer.checkForTracebacks
559
def parse_params(option, opt, value, parser): try: args_dict = json.loads(value) except __HOLE__: print "argument error, %s should be valid JSON" % value setattr(parser.values, option.dest, args_dict)
ValueError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/hqadmin/management/commands/make_supervisor_conf.py/parse_params
560
def core_build_id(): '''Unique id in URN form, distinguishing each unique build. If building from a repository checkout, the resulting string will have the format "urn:rcsid:IDENTIFIER". If building from source which is not under revision control, the build id will have the format "urn:utcts:YYYYMMDDHHMMSS". (U...
IOError
dataset/ETHPy150Open rsms/smisk/setup.py/core_build_id
561
def run(self): try: import sphinx if not os.path.exists(self.out_dir): if self.dry_run: self.announce('skipping creation of directory %s (dry run)' % self.out_dir) else: self.announce('creating directory %s' % self.out_dir) os.makedirs(self.out_dir) if self.dry_run: self.announ...
ImportError
dataset/ETHPy150Open rsms/smisk/setup.py/sphinx_build.run
562
def __init__(self, attrs=None): Distribution.__init__(self, attrs) self.cmdclass = { 'build': build, 'build_ext': build_ext, 'sdist': sdist, 'config': config, 'docs': sphinx_build, 'clean': clean, } try: shell_cmd('which dpkg-buildpackage') self.cmdclass['debian'] = debian except __HOL...
IOError
dataset/ETHPy150Open rsms/smisk/setup.py/SmiskDistribution.__init__
563
def cleanup(self, releases_path, reserve_version): changes = 0 if os.path.lexists(releases_path): releases = [ f for f in os.listdir(releases_path) if os.path.isdir(os.path.join(releases_path,f)) ] try: releases.remove(reserve_version) except __HOLE__...
ValueError
dataset/ETHPy150Open roots/trellis/lib/trellis/modules/deploy_helper.py/DeployHelper.cleanup
564
def _update(self, contracts): updated = set() retry = set() try: with self.updating_counter(len(contracts)): start = time.clock() hashes = [c.hash for c in contracts] url = '{0}/challenge/{1}'.format(self.api_url, ...
KeyError
dataset/ETHPy150Open StorjOld/downstream-farmer/downstream_farmer/client.py/DownstreamClient._update
565
@classmethod def _check_geo_field(cls, opts, lookup): """ Utility for checking the given lookup with the given model options. The lookup is a string either specifying the geographic field, e.g. 'point, 'the_geom', or a related lookup on a geographic field like 'address__point...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/gis/db/models/sql/where.py/GeoWhereNode._check_geo_field
566
def __init__ ( self, parent, **traits ): """ Initializes the editor object. """ HasPrivateTraits.__init__( self, **traits ) try: self.old_value = getattr( self.object, self.name ) except __HOLE__: ctrait = self.object.base_trait(self.name) if c...
AttributeError
dataset/ETHPy150Open enthought/traitsui/traitsui/editor.py/Editor.__init__
567
def run(self): """This is executed once the application GUI has started. *Make sure all other MayaVi specific imports are made here!* """ # Various imports to do different things. from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.outline import ...
ImportError
dataset/ETHPy150Open enthought/mayavi/docs/source/mayavi/auto/subclassing_mayavi_application.py/MyApp.run
568
def __getattr__(self, name): try: return self.ground(self.attrs[name]) except __HOLE__: raise AttributeError(name)
KeyError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/conch/insults/text.py/CharacterAttributes._ColorAttribute.__getattr__
569
def _init_flow_exceptions(): """Internal helper to initialize _flow_exceptions. This automatically adds webob.exc.HTTPException, if it can be imported. """ global _flow_exceptions _flow_exceptions = () add_flow_exception(datastore_errors.Rollback) try: from webob import exc except __HOLE__: pas...
ImportError
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/tasklets.py/_init_flow_exceptions
570
def _help_tasklet_along(self, ns, ds_conn, gen, val=None, exc=None, tb=None): # XXX Docstring info = utils.gen_info(gen) # pylint: disable=invalid-name __ndb_debug__ = info try: save_context = get_context() save_namespace = namespace_manager.get_namespace() save_ds_connection = dat...
StopIteration
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/tasklets.py/Future._help_tasklet_along
571
def tasklet(func): # XXX Docstring @utils.wrapping(func) def tasklet_wrapper(*args, **kwds): # XXX Docstring # TODO: make most of this a public function so you can take a bare # generator and turn it into a tasklet dynamically. (Monocle has # this I believe.) # pylint: disable=invalid-name ...
StopIteration
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/tasklets.py/tasklet
572
def _make_cloud_datastore_context(app_id, external_app_ids=()): """Creates a new context to connect to a remote Cloud Datastore instance. This should only be used outside of Google App Engine. Args: app_id: The application id to connect to. This differs from the project id as it may have an additional...
ImportError
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/tasklets.py/_make_cloud_datastore_context
573
def get_file_obj(fname, mode='r', encoding=None): """ Light wrapper to handle strings and let files (anything else) pass through. It also handle '.gz' files. Parameters ========== fname: string or file-like object File to open / forward mode: string Argument passed to the '...
AttributeError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/iolib/openfile.py/get_file_obj
574
def main(): """\ Usage: sports-naarad [-h] [-F] [-C] live_score|news|[player_stats name] [-my_fav_team] Get latest updates for football and cricket Options: -h, --help shows help(this) message -F, --football [uefa, barclay, fifa] Get football updates. The tourna...
IndexError
dataset/ETHPy150Open PyRag/sports-naarad/sports_naarad/naarad.py/main
575
def unpack(value): """Return a three tuple of data, code, and headers""" if not isinstance(value, tuple): return value, 200, {} try: data, code, headers = value return data, code, headers except ValueError: pass try: data, code = value return data, c...
ValueError
dataset/ETHPy150Open flask-restful/flask-restful/flask_restful/utils/__init__.py/unpack
576
def generate_edgelist(G, delimiter=' ', data=True): """Generate a single line of the graph G in edge list format. Parameters ---------- G : NetworkX graph delimiter : string, optional Separator for node labels data : bool or list of keys If False generate no edge data. If True ...
KeyError
dataset/ETHPy150Open networkx/networkx/networkx/readwrite/edgelist.py/generate_edgelist
577
def _test_list_bulk(self, typecallable, creator=None): if creator is None: creator = self.entity_maker class Foo(object): pass canary = Canary() instrumentation.register_class(Foo) attributes.register_attribute(Foo, 'attr', uselist=True, ...
TypeError
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CollectionsTest._test_list_bulk
578
def _test_set(self, typecallable, creator=None): if creator is None: creator = self.entity_maker class Foo(object): pass canary = Canary() instrumentation.register_class(Foo) attributes.register_attribute(Foo, 'attr', uselist=True, ...
TypeError
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CollectionsTest._test_set
579
def _test_set_bulk(self, typecallable, creator=None): if creator is None: creator = self.entity_maker class Foo(object): pass canary = Canary() instrumentation.register_class(Foo) attributes.register_attribute(Foo, 'attr', uselist=True, ...
TypeError
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CollectionsTest._test_set_bulk
580
def _test_dict(self, typecallable, creator=None): if creator is None: creator = self.dictable_entity class Foo(object): pass canary = Canary() instrumentation.register_class(Foo) attributes.register_attribute(Foo, 'attr', uselist=True, ...
KeyError
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CollectionsTest._test_dict
581
def _test_dict_bulk(self, typecallable, creator=None): if creator is None: creator = self.dictable_entity class Foo(object): pass canary = Canary() instrumentation.register_class(Foo) attributes.register_attribute(Foo, 'attr', uselist=True, ...
TypeError
dataset/ETHPy150Open zzzeek/sqlalchemy/test/orm/test_collection.py/CollectionsTest._test_dict_bulk
582
def get_parser(self, directory, base_python_name): """ Get a parser for the given directory, or create one if necessary. This way parsers can be cached and reused. # @@: settings are inherited from the first caller """ try: return self.parsers_by_directory[(...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/urlparser.py/URLParser.get_parser
583
def load_module_from_name(environ, filename, module_name, errors): if module_name in sys.modules: return sys.modules[module_name] init_filename = os.path.join(os.path.dirname(filename), '__init__.py') if not os.path.exists(init_filename): try: f = open(init_filename, 'w') ...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/urlparser.py/load_module_from_name
584
def __call__(self, environ, start_response): path_info = environ.get('PATH_INFO', '') if not path_info: return self.add_slash(environ, start_response) if path_info == '/': # @@: This should obviously be configurable filename = 'index.html' else: ...
IOError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/urlparser.py/PkgResourcesParser.__call__
585
def _get_hosts(self): """ Return list of hostnames sorted by load. """ # Get host load information. try: proc = ShellProc(self._QHOST, stdout=PIPE) except Exception as exc: self._logger.error('%r failed: %s' % (self._QHOST, exc)) return [] line...
ValueError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/grid_engine.py/GridEngineAllocator._get_hosts
586
@rbac('owner') def execute_command(self, resource_desc): """ Submit command based on `resource_desc`. resource_desc: dict Description of command and required resources. The '-V' `qsub` option is always used to export the current environment to the job. This envi...
KeyError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/grid_engine.py/GridEngineServer.execute_command
587
def main(args): print "INFO\t" + now() + "\tstarting " + sys.argv[0] + " called with args: " + ' '.join(sys.argv) + "\n" bedfile = open(args.varFileName, 'r') reffile = pysam.Fastafile(args.refFasta) if not os.path.exists(args.bamFileName + '.bai'): sys.stderr.write("ERROR\t" + now() + "\tinput...
AssertionError
dataset/ETHPy150Open adamewing/bamsurgeon/bin/addindel.py/main
588
def Log(self, format_str, *args): """Logs the message using the flow's standard logging. Args: format_str: Format string *args: arguments to the format string Raises: RuntimeError: on parent missing logs_collection """ format_str = utils.SmartUnicode(format_str) try: # ...
TypeError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/HuntRunner.Log
589
def _CreateAuditEvent(self, event_action): try: flow_name = self.flow_obj.args.flow_runner_args.flow_name except __HOLE__: flow_name = "" event = flow.AuditEvent(user=self.flow_obj.token.username, action=event_action, urn=self.flow_obj.urn, ...
AttributeError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/HuntRunner._CreateAuditEvent
590
def _AddURNToCollection(self, urn, collection_urn): # TODO(user): Change to use StaticAdd once all active hunts are # migrated. try: aff4.FACTORY.Open(collection_urn, "UrnCollection", mode="rw", token=self.token).Add(urn) exce...
IOError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt._AddURNToCollection
591
def _AddHuntErrorToCollection(self, error, collection_urn): # TODO(user) Change to use StaticAdd once all active hunts are # migrated. try: aff4.FACTORY.Open(collection_urn, "HuntErrorCollection", mode="rw", token=self.token).Add(...
IOError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt._AddHuntErrorToCollection
592
@classmethod def StartHunt(cls, args=None, runner_args=None, **kwargs): """This class method creates new hunts.""" # Build the runner args from the keywords. if runner_args is None: runner_args = HuntRunnerArgs() cls.FilterArgsFromSemanticProtobuf(runner_args, kwargs) # Is the required flo...
AttributeError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt.StartHunt
593
def AddResultsToCollection(self, responses, client_id): if responses.success: with self.lock: self.processed_responses = True msgs = [rdf_flows.GrrMessage(payload=response, source=client_id) for response in responses] try: with aff4.FACTORY.Open(self.state.co...
IOError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt.AddResultsToCollection
594
def SetDescription(self, description=None): if description: self.state.context.args.description = description else: try: flow_name = self.state.args.flow_runner_args.flow_name except __HOLE__: flow_name = "" self.state.context.args.description = flow_name
AttributeError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt.SetDescription
595
@flow.StateHandler() def Start(self): """Initializes this hunt from arguments.""" self.state.context.Register("results_metadata_urn", self.urn.Add("ResultsMetadata")) self.state.context.Register("results_collection_urn", self.urn.Add("Result...
AttributeError
dataset/ETHPy150Open google/grr/grr/lib/hunts/implementation.py/GRRHunt.Start
596
def __getitem__(self, name): 'get connection to the named server object' try: return dict.__getitem__(self, name) except __HOLE__: # Get information about the requested object. methodDict = self.server.objectInfo(name) import types if i...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/XMLRPCClient.__getitem__
597
def __call__(self, url, name): try: s = self[url] # REUSE EXISTING CONNECTION TO THE SERVER except __HOLE__: s = XMLRPCClient(url) # GET NEW CONNECTION TO THE SERVER self[url] = s # CACHE THIS CONNECTION return s[name] # GET THE REQUESTED OBJECT PROXY FROM THE...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ConnectionDict.__call__
598
def safe_dispatch(self, name, args): """restrict calls to selected methods, and trap all exceptions to keep server alive!""" import datetime if name in self.xmlrpc_methods: # Make sure this method is explicitly allowed. try: # TRAP ALL ERRORS TO PREVENT OUR SERVER FROM DYING ...
SystemExit
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/safe_dispatch
599
def __init__(self, s, separator=None, eq_separator=None): list.__init__(self) if separator is None: separator = self._separator if eq_separator is None: eq_separator = self._eq_separator args = s.split(separator) i = 0 for arg in args: ...
KeyError
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/ObjectFromString.__init__