Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
400
def _ignore_request_headers_rewriter(environ): """Ignore specific request headers. Certain request headers should not be sent to the application. This function removes those headers from the environment. For a complete list of these headers please see: https://developers.google.com/appengine/docs/python/r...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/request_rewriter.py/_ignore_request_headers_rewriter
401
def _rewriter_middleware(request_rewriter_chain, response_rewriter_chain, application, environ, start_response): """Wraps an application and applies a chain of rewriters to its response. This first applies each function in request_rewriter_chain to the environ. It then executes the appli...
StopIteration
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/request_rewriter.py/_rewriter_middleware
402
def test_spectral_amg_mode(): # Test the amg mode of SpectralClustering centers = np.array([ [0., 0., 0.], [10., 10., 10.], [20., 20., 20.], ]) X, true_labels = make_blobs(n_samples=100, centers=centers, cluster_std=1., random_state=42) D = pai...
ImportError
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/cluster/tests/test_spectral.py/test_spectral_amg_mode
403
def k_fold_cross_validation(fitters, df, duration_col, event_col=None, k=5, evaluation_measure=concordance_index, predictor="predict_expectation", predictor_kwargs={}, fitter_kwargs={}): """ Perform cross validation on a dataset...
TypeError
dataset/ETHPy150Open CamDavidsonPilon/lifelines/lifelines/utils/__init__.py/k_fold_cross_validation
404
def expand(self, constraints): if self.tripleStore.graph.store.batch_unification: patterns = [] if self.statement: self.checkForEagerTermination() for statement in [self.statement] + self.rest: (s,p,o,func) = statement ...
TypeError
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/query.py/_SPARQLNode.expand
405
def expandAtClient(self, constraints): """ The expansion itself. See class comments for details. :param constraints: array of global constraining (filter) methods """ self.checkForEagerTermination() # if there are no more statements, that means that the constraints ...
TypeError
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/query.py/_SPARQLNode.expandAtClient
406
def _orderedSelect(self, selection, orderedBy, orderDirection): """ The variant of the selection (as below) that also includes the sorting. Because that is much less efficient, this is separated into a distinct method that is called only if necessary. It is called from the :meth:...
AttributeError
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/query.py/Query._orderedSelect
407
def main(): TestRunner = get_runner(settings) # Ugly parameter parsing. We probably want to improve that in future # or just use default django test command. This may be problematic, # knowing how testing in Django changes from version to version. if '-p' in sys.argv: try: pos =...
IndexError
dataset/ETHPy150Open bread-and-pepper/django-userena/userena/runtests/runtests.py/main
408
def _create(self, path): success = True parent = os.path.abspath(os.path.join(os.path.expanduser(path), os.pardir)) if not self._exists(parent): try: os.makedirs(parent) except __HOLE__: self._log.warning('Failed to create directory %s' % p...
OSError
dataset/ETHPy150Open anishathalye/dotbot/plugins/link.py/Link._create
409
def _delete(self, source, path, relative, force): success = True source = os.path.join(self._context.base_directory(), source) fullpath = os.path.expanduser(path) if relative: source = self._relative_path(source, fullpath) if ((self._is_link(path) and self._link_desti...
OSError
dataset/ETHPy150Open anishathalye/dotbot/plugins/link.py/Link._delete
410
def _link(self, source, link_name, relative): ''' Links link_name to source. Returns true if successfully linked files. ''' success = False destination = os.path.expanduser(link_name) absolute_source = os.path.join(self._context.base_directory(), source) ...
OSError
dataset/ETHPy150Open anishathalye/dotbot/plugins/link.py/Link._link
411
def get_form(self, *args, **kwargs): initial = self.get_form_kwargs() if 'ip_type' in self.request.GET and 'ip_str' in self.request.GET: ip_str = self.request.GET['ip_str'] ip_type = self.request.GET['ip_type'] network = calc_parent_str(ip_str, ip_type) if...
ObjectDoesNotExist
dataset/ETHPy150Open mozilla/inventory/mozdns/ptr/views.py/PTRCreateView.get_form
412
def render_html(self, request): """ Render the html code of the plugin. By default, calls the 'index_view' function. """ views = __import__('%s.views' % self._get_module_path(), fromlist=['']) try: return views.index_view(request, self) except __HOLE__...
AttributeError
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/plugin/models.py/AbstractPlugin.render_html
413
def get_admin_form(self): """ Returns the default admin form : `Plugin_PluginNameForm`. """ class_name = self.__class__.__name__ forms = __import__('%s.forms' % self._get_module_path(), fromlist=['']) try: return getattr(forms, '%sForm' % class_name) ...
AttributeError
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/plugin/models.py/AbstractPlugin.get_admin_form
414
def http_request(self, request): if not hasattr(request, "add_unredirected_header"): newrequest = Request(request.get_full_url(), request.data, request.headers) try: newrequest.origin_req_host = request.origin_req_host except AttributeError: p...
AttributeError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/samples-and-tests/i-am-a-developer/mechanize/_upgrade.py/HTTPRequestUpgradeProcessor.http_request
415
def dispatch(self, request, *args, **kwargs): if 'product_pk' in kwargs: try: self.product = Product.objects.get(pk=kwargs['product_pk']) except __HOLE__: messages.error( request, _("The requested product no longer exists")) ...
ObjectDoesNotExist
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/customer/wishlists/views.py/WishListCreateView.dispatch
416
def dispatch(self, request, *args, **kwargs): try: self.fetch_line(request.user, kwargs['key'], line_pk=kwargs['line_pk']) except (__HOLE__, MultipleObjectsReturned): raise Http404 return super(WishListMoveProductToAnotherWishList, self).dispat...
ObjectDoesNotExist
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/customer/wishlists/views.py/WishListMoveProductToAnotherWishList.dispatch
417
def parse_args_impl(parser, _args=None): global options, commands, arg_line (options, args) = parser.parse_args(args=_args) arg_line = args #arg_line = args[:] # copy # By default, 'waf' is equivalent to 'waf build' commands = {} for var in cmds: commands[var] = 0 if not args: commands['build'] = 1 args.a...
ValueError
dataset/ETHPy150Open appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/Options.py/parse_args_impl
418
def tool_options(self, *k, **kw): Utils.python_24_guard() if not k[0]: raise Utils.WscriptError('invalid tool_options call %r %r' % (k, kw)) tools = Utils.to_list(k[0]) # TODO waf 1.6 remove the global variable tooldir path = Utils.to_list(kw.get('tdir', kw.get('tooldir', tooldir))) for tool in tools:...
AttributeError
dataset/ETHPy150Open appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/Options.py/Handler.tool_options
419
@defer.inlineCallbacks def _background_reindex_search(self, progress, batch_size): target_min_stream_id = progress["target_min_stream_id_inclusive"] max_stream_id = progress["max_stream_id_exclusive"] rows_inserted = progress.get("rows_inserted", 0) INSERT_CLUMP_SIZE = 1000 ...
KeyError
dataset/ETHPy150Open matrix-org/synapse/synapse/storage/search.py/SearchStore._background_reindex_search
420
def lsb_release(): """ Get the linux distribution information and return in an attribute dict The following attributes should be available: base, distributor_id, description, release, codename For example Ubuntu Lucid would return base = debian distributor_id = Ubuntu descripti...
ValueError
dataset/ETHPy150Open bretth/woven/woven/linux.py/lsb_release
421
def port_is_open(): """ Determine if the default port and user is open for business. """ with settings(hide('aborts'), warn_only=True ): try: if env.verbosity: print "Testing node for previous installation on port %s:"% env.port distribution = lsb_release(...
KeyboardInterrupt
dataset/ETHPy150Open bretth/woven/woven/linux.py/port_is_open
422
def setUp(self): _test_c.COUNT = 0 try: shutil.rmtree(_test_c.TEST_DIR) except (__HOLE__, IOError, ), e: if e.errno != errno.ENOENT: raise e os.mkdir(_test_c.TEST_DIR, 00750) os.mkdir(_test_c.ROOT1, 00750) os.mkdir(_test_c.ROOT2, 00...
OSError
dataset/ETHPy150Open axialmarket/fsq/fsq/tests/FSQTestCase.py/FSQTestCase.setUp
423
def tearDown(self): _c.FSQ_ROOT = _test_c.ORIG_ROOT try: shutil.rmtree(_test_c.TEST_DIR) except(__HOLE__, IOError, ), e: if e.errno != errno.ENOENT: raise e sys.stderr.write('Total Tests Run: {0} ... '.format(_test_c.COUNT)) _test_c.TOTAL_C...
OSError
dataset/ETHPy150Open axialmarket/fsq/fsq/tests/FSQTestCase.py/FSQTestCase.tearDown
424
def __init__(self, path, data, command_line): """ It copies the content of self.path from the initialization routine of the :class:`Data <data.Data>` class, and defines a handful of useful methods, that every likelihood might need. If the nuisance parameters required to compute ...
AttributeError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood.__init__
425
def read_from_file(self, path, data, command_line): """ Extract the information from the log.param concerning this likelihood. If the log.param is used, check that at least one item for each likelihood is recovered. Otherwise, it means the log.param does not contain information ...
AttributeError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood.read_from_file
426
def need_cosmo_arguments(self, data, dictionary): """ Ensure that the arguments of dictionary are defined to the correct value in the cosmological code .. warning:: So far there is no way to enforce a parameter where `smaller is better`. A bigger value will alwa...
ValueError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood.need_cosmo_arguments
427
def read_contamination_spectra(self, data): for nuisance in self.use_nuisance: # read spectrum contamination (so far, assumes only temperature # contamination; will be trivial to generalize to polarization when # such templates will become relevant) setattr(self,...
AttributeError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood.read_contamination_spectra
428
def __init__(self, path, data, command_line): Likelihood.__init__(self, path, data, command_line) self.need_cosmo_arguments( data, {'lensing': 'yes', 'output': 'tCl lCl pCl'}) try: import clik except __HOLE__: raise io_mp.MissingLibraryError( ...
ImportError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood_clik.__init__
429
def __init__(self, path, data, command_line): Likelihood.__init__(self, path, data, command_line) # try and import pandas try: import pandas except __HOLE__: raise io_mp.MissingLibraryError( "This likelihood has a lot of IO manipulation. You have...
ImportError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood_sn.__init__
430
def read_configuration_file(self): """ Extract Python variables from the configuration file This routine performs the equivalent to the program "inih" used in the original c++ library. """ settings_path = os.path.join(self.data_directory, self.settings) with open...
ValueError
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihood_class.py/Likelihood_sn.read_configuration_file
431
def _import_module(mod_str): try: if mod_str.startswith('bin.'): imp.load_source(mod_str[4:], os.path.join('bin', mod_str[4:])) return sys.modules[mod_str[4:]] else: return importutils.import_module(mod_str) except __HOLE__ as ie: sys.stderr.write("%s\...
ImportError
dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/openstack/common/config/generator.py/_import_module
432
def _print_opt(opt): opt_name, opt_default, opt_help = opt.dest, opt.default, opt.help if not opt_help: sys.stderr.write('WARNING: "%s" is missing help string.\n' % opt_name) opt_type = None try: opt_type = OPTION_REGEX.search(str(type(opt))).group(0) except (__HOLE__, AttributeError...
ValueError
dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/openstack/common/config/generator.py/_print_opt
433
def load_source(srcfile): try: return ''.join(open(srcfile).readlines()) + '\n\n' except __HOLE__: print('Could not open', srcfile) return ''
IOError
dataset/ETHPy150Open milkbikis/powerline-shell/install.py/load_source
434
def fetch_url(url, useragent, referer=None, retries=1, dimension=False): cur_try = 0 nothing = None if dimension else (None, None) url = clean_url(url) if not url.startswith(('http://', 'https://')): return nothing response = None while True: try: response = requests...
IOError
dataset/ETHPy150Open codelucas/newspaper/newspaper/images.py/fetch_url
435
def thumbnail(self): """Identifies top image, trims out a thumbnail and also has a url """ image_url = self.largest_image_url() if image_url: content_type, image_str = fetch_url(image_url, referer=self.url) if image_str: image = str_to_image(image_...
IOError
dataset/ETHPy150Open codelucas/newspaper/newspaper/images.py/Scraper.thumbnail
436
def from_dtype(dtype): """ Return a Numba Type instance corresponding to the given Numpy *dtype*. NotImplementedError is raised on unsupported Numpy dtypes. """ if dtype.fields is None: try: return FROM_DTYPE[dtype] except __HOLE__: if dtype.char in 'SU': ...
KeyError
dataset/ETHPy150Open numba/numba/numba/numpy_support.py/from_dtype
437
def map_arrayscalar_type(val): if isinstance(val, numpy.generic): # We can't blindly call numpy.dtype() as it loses information # on some types, e.g. datetime64 and timedelta64. dtype = val.dtype else: try: dtype = numpy.dtype(type(val)) except __HOLE__: ...
TypeError
dataset/ETHPy150Open numba/numba/numba/numpy_support.py/map_arrayscalar_type
438
def supported_ufunc_loop(ufunc, loop): """Return whether the *loop* for the *ufunc* is supported -in nopython-. *loop* should be a UFuncLoopSpec instance, and *ufunc* a numpy ufunc. For ufuncs implemented using the ufunc_db, it is supported if the ufunc_db contains a lowering definition for 'loop' in ...
KeyError
dataset/ETHPy150Open numba/numba/numba/numpy_support.py/supported_ufunc_loop
439
def ufunc_find_matching_loop(ufunc, arg_types): """Find the appropriate loop to be used for a ufunc based on the types of the operands ufunc - The ufunc we want to check arg_types - The tuple of arguments to the ufunc, including any explicit output(s). return value - A ...
NotImplementedError
dataset/ETHPy150Open numba/numba/numba/numpy_support.py/ufunc_find_matching_loop
440
def import_by_path(dotted_path, error_prefix=''): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImproperlyConfigured if something goes wrong. Backported from Django 1.6. """ try: module_path, class_name = dotted_path.rs...
ValueError
dataset/ETHPy150Open jazzband/django-configurations/configurations/utils.py/import_by_path
441
def getargspec(func): """Like inspect.getargspec but supports functools.partial as well.""" if inspect.ismethod(func): func = func.__func__ if type(func) is partial: orig_func = func.func argspec = getargspec(orig_func) args = list(argspec[0]) ...
ValueError
dataset/ETHPy150Open jazzband/django-configurations/configurations/utils.py/getargspec
442
def getargspec(func): """Like inspect.getargspec but supports functools.partial as well.""" if inspect.ismethod(func): func = func.im_func parts = 0, () if type(func) is partial: keywords = func.keywords if keywords is None: keywords = ...
IndexError
dataset/ETHPy150Open jazzband/django-configurations/configurations/utils.py/getargspec
443
def removeStream(self, stream): '''Unregister *stream* from this circuit. Remove the stream from this circuit's stream map and send a RelayEndCell. If the number of streams on this circuit drops to zero, check with the circuit manager to see if this circuit should be destroyed. ...
KeyError
dataset/ETHPy150Open nskinkel/oppy/oppy/circuit/circuit.py/Circuit.removeStream
444
def _processRelayDataCell(self, cell, origin): '''Called when this circuit receives an incoming RelayData cell. Take the following actions: 1. Pass the relay payload in this cell to the stream with the stream_id contained in this RelayData cell. Drop the cell ...
KeyError
dataset/ETHPy150Open nskinkel/oppy/oppy/circuit/circuit.py/Circuit._processRelayDataCell
445
def _processRelayEndCell(self, cell, origin): '''Called when this circuit receives a RelayEndCell. Tear down the stream associated with the stream in the RelayEndCell if this circuit has a reference to it. Drop the cell if we have no reference to this stream. :param oppy.cell.r...
KeyError
dataset/ETHPy150Open nskinkel/oppy/oppy/circuit/circuit.py/Circuit._processRelayEndCell
446
def _processRelayConnectedCell(self, cell, origin): '''Called when this circuit receives a RelayConnectedCell. Notify the stream associated with this cell's stream id that it's now connected. Drop the cell if we have no reference to this stream id. :param oppy.cell.relay.RelayC...
KeyError
dataset/ETHPy150Open nskinkel/oppy/oppy/circuit/circuit.py/Circuit._processRelayConnectedCell
447
def _processRelaySendMeCell(self, cell, origin): '''Called when this circuit receives a RelaySendMeCell. If this is a circuit-level sendme cell (i.e. its stream id is zero) then increment this circuit's packaging window. If this circuit is currently in state CState.BUFFERING **and** rec...
KeyError
dataset/ETHPy150Open nskinkel/oppy/oppy/circuit/circuit.py/Circuit._processRelaySendMeCell
448
def import_entry_point(fullname): """Given a name import the class and return it.""" (module_name, classname) = partition(fullname) try: import_module(module_name) # This is done to ensure we get the right submodule module = __import__(module_name) for submodule in module_nam...
AttributeError
dataset/ETHPy150Open openstack/anvil/anvil/importer.py/import_entry_point
449
def import_module(module_name): try: LOG.debug("Importing module: %s", module_name) __import__(module_name) return sys.modules.get(module_name, None) except (__HOLE__, ValueError) as err: raise RuntimeError('Could not load module %s: %s' % (module_name,...
ImportError
dataset/ETHPy150Open openstack/anvil/anvil/importer.py/import_module
450
@click.command(help='A command to calculate and return the next steps for a ci build to run') @pass_config def next_step(config): step = 'dummy' # SolanoCI if config.build_vendor == 'SolanoCI': profile = os.environ.get('SOLANO_PROFILE_NAME') i_current_step = 0 if profile: ...
ValueError
dataset/ETHPy150Open SalesforceFoundation/CumulusCI/cli/cumulusci.py/next_step
451
def _set_souma_id(app): """ Sets the SOUMA_ID of the local souma in the configuration of app. Loads (or creates and loades) the secret key of the local souma and uses it to set the id of the local souma. Args: app: A flask app """ # Load/set secret key try: with open(app.c...
IOError
dataset/ETHPy150Open ciex/souma/nucleus/helpers.py/_set_souma_id
452
def reset_userdata(): """Reset all userdata files""" from web_ui import app for fileid in ["DATABASE", "SECRET_KEY_FILE", "PASSWORD_HASH_FILE"]: try: os.remove(app.config[fileid]) except __HOLE__: app.logger.warning("RESET: {} {} not found".format(fileid, app.config[...
OSError
dataset/ETHPy150Open ciex/souma/web_ui/helpers.py/reset_userdata
453
def watch_layouts(continuous=True): """Watch layout file and update layout definitions once they change Parameters: continuous (bool): Set False to only load definitions once Returns: dict: Layout definitions if `continuous` is False """ import json from web_ui import app ...
IOError
dataset/ETHPy150Open ciex/souma/web_ui/helpers.py/watch_layouts
454
def top_contributors(request, area): """Top contributors list view.""" try: page = int(request.GET.get('page', 1)) except __HOLE__: page = 1 page_size = 100 locale = _validate_locale(request.GET.get('locale')) product = request.GET.get('product') if product: product...
ValueError
dataset/ETHPy150Open mozilla/kitsune/kitsune/community/views.py/top_contributors
455
def write(self, distFolder, classFilter=None, callback="apiload", showInternals=False, showPrivates=False, printErrors=True, highlightCode=True): """ Writes API data generated from JavaScript into distFolder :param distFolder: Where to store the API data :param classFilter: Tuple of cla...
TypeError
dataset/ETHPy150Open zynga/jasy/jasy/js/api/Writer.py/ApiWriter.write
456
@get('/') def index(request): try: # Should raise an error. return 'What? Somehow found a remote user: %s' % request.REMOTE_USER except __HOLE__: pass return "Remote Addr: '%s' & GET name: '%s'" % (request.REMOTE_ADDR, request.GET.get('name', 'Not found'))
KeyError
dataset/ETHPy150Open toastdriven/itty/examples/auto_environ_access.py/index
457
def test_shell_background_support_setsid(both_debug_modes, setsid_enabled): """In setsid mode, dumb-init should suspend itself and its children when it receives SIGTSTP, SIGTTOU, or SIGTTIN. """ proc = Popen( ('dumb-init', sys.executable, '-m', 'tests.lib.print_signals'), stdout=PIPE, ...
AssertionError
dataset/ETHPy150Open Yelp/dumb-init/tests/shell_background_test.py/test_shell_background_support_setsid
458
def feed(request, url, feed_dict=None): if not feed_dict: raise Http404, "No feeds are registered." try: slug, param = url.split('/', 1) except ValueError: slug, param = url, '' try: f = feed_dict[slug] except __HOLE__: raise Http404, "Slug %r isn't register...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/syndication/views.py/feed
459
def interactive_authorize(self, consumer, app, **kwargs): from textwrap import fill # Suppress batchhttp.client's no-log-handler warning. class NullHandler(logging.Handler): def emit(self, record): pass logging.getLogger().addHandler(NullHandler()) i...
KeyboardInterrupt
dataset/ETHPy150Open typepad/python-typepad-api/typepad/tpclient.py/OAuthHttp.interactive_authorize
460
def _channel_id_to_PIL(channel_id, color_mode): if ChannelID.is_known(channel_id): if channel_id == ChannelID.TRANSPARENCY_MASK: return 'A' warnings.warn("Channel %s (%s) is not handled" % (channel_id, ChannelID.name_of(channel_id))) return None try: assert channel_i...
IndexError
dataset/ETHPy150Open psd-tools/psd-tools/src/psd_tools/user_api/pil_support.py/_channel_id_to_PIL
461
def __enter__(self): try: open(self.workdir) assert 0 except IOError: subprocess.call(["mkdir", "-p", '%s/db' % self.workdir]) proc_args = [ "mongod", "--dbpath=%s/db" % self.workdir, "--nojournal", ...
OSError
dataset/ETHPy150Open hyperopt/hyperopt/hyperopt/tests/test_mongoexp.py/TempMongo.__enter__
462
def generate_itemSimOnTypeSet(): prefs = {} result = {} try: with open(os.getcwd() + '//ml-100k' + '/u.item') as item: for line in item: typeVector = line.split('|')[5:24] itemId = line.split('|')[0] prefs[itemId] = typeVector ...
IOError
dataset/ETHPy150Open clasnake/recommender/tool.py/generate_itemSimOnTypeSet
463
def test_badcon(self): self.top.add("driver", FixedPointIterator()) self.top.add("simple", Simple2()) self.top.driver.workflow.add('simple') self.top.driver.add_constraint('simple.invar - simple.outvar = 0') self.top.driver.add_parameter('simple.invar') try: ...
RuntimeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/drivers/test/test_iterate.py/FixedPointIteratorTestCase.test_badcon
464
def test_check_config(self): self.top.add("driver", FixedPointIterator()) self.top.add("simple", Multi()) self.top.driver.workflow.add('simple') try: self.top.run() except __HOLE__, err: msg = "driver: FixedPointIterator requires a cyclic workflow, or a "...
RuntimeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/drivers/test/test_iterate.py/FixedPointIteratorTestCase.test_check_config
465
def start_pillows(pillows=None): """ Actual runner for running pillow processes. Use this to run pillows. """ run_pillows = pillows or get_all_pillow_instances() try: while True: jobs = [] print "[pillowtop] Starting pillow processes" for pillow_class in ...
KeyboardInterrupt
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/pillowtop/run_pillowtop.py/start_pillows
466
def upload_object_via_stream(self, iterator, container, object_name, extra=None): if isinstance(iterator, file): iterator = iter(iterator) data_hash = hashlib.md5() generator = read_in_chunks(iterator, CHUNK_SIZE, True) bytes_transferred = 0 ...
StopIteration
dataset/ETHPy150Open apache/libcloud/libcloud/storage/drivers/atmos.py/AtmosDriver.upload_object_via_stream
467
def test_set_vif_bandwidth_config_no_extra_specs(self): # Test whether test_set_vif_bandwidth_config_no_extra_specs fails when # its second parameter has no 'extra_specs' field. try: # The conf will never be user be used, so we can use 'None'. # An empty dictionary is fi...
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/libvirt/test_designer.py/DesignerTestCase.test_set_vif_bandwidth_config_no_extra_specs
468
def update(self, dispatch_fn): touchmap = self.touchmap while True: try: value = self.q.pop() except __HOLE__: return action, fid, x, y = value y = 1 - y if fid not in touchmap: touchmap[fid] = m...
IndexError
dataset/ETHPy150Open kivy/kivy/kivy/core/window/window_sdl2.py/SDL2MotionEventProvider.update
469
def _mainloop(self): EventLoop.idle() # for android/iOS, we don't want to have any event nor executing our # main loop while the pause is going on. This loop wait any event (not # handled by the event filter), and remove them from the queue. # Nothing happen during the pause on ...
ValueError
dataset/ETHPy150Open kivy/kivy/kivy/core/window/window_sdl2.py/WindowSDL._mainloop
470
def __getattr__(self, name): try: return self[name.replace('_', '-')] except __HOLE__ as error: raise AttributeError(str(error))
KeyError
dataset/ETHPy150Open letsencrypt/letsencrypt/acme/acme/messages.py/Directory.__getattr__
471
def __getitem__(self, name): try: return self._jobj[self._canon_key(name)] except __HOLE__: raise KeyError('Directory field not found')
KeyError
dataset/ETHPy150Open letsencrypt/letsencrypt/acme/acme/messages.py/Directory.__getitem__
472
@classmethod def from_json(cls, jobj): jobj['meta'] = cls.Meta.from_json(jobj.pop('meta', {})) try: return cls(jobj) except __HOLE__ as error: raise jose.DeserializationError(str(error))
ValueError
dataset/ETHPy150Open letsencrypt/letsencrypt/acme/acme/messages.py/Directory.from_json
473
def command(options=None, usage=None, name=None, shortlist=False, hide=False): '''Decorator to mark function to be used for command line processing. All arguments are optional: - ``options``: options in format described in docs. If not supplied, will be determined from function. - ``usage``: ...
StopIteration
dataset/ETHPy150Open kennethreitz-archive/argue/argue/core.py/command
474
def autocomplete(cmdtable, args): """Command and option completion. Enable by sourcing one of the completion shell scripts (bash or zsh). """ # Don't complete if user hasn't sourced bash_completion file. if not os.environ.has_key('ARGUE_AUTO_COMPLETE'): return cwords = os.environ['COMP...
IndexError
dataset/ETHPy150Open kennethreitz-archive/argue/argue/core.py/autocomplete
475
def read_stdout(self, num_bytes): # Obtain useful read-some-bytes function if self.using_pty: # Need to handle spurious OSErrors on some Linux platforms. try: data = os.read(self.parent_fd, num_bytes) except __HOLE__ as e: # Only eat th...
OSError
dataset/ETHPy150Open pyinvoke/invoke/invoke/runners.py/Local.read_stdout
476
def write_stdin(self, data): # NOTE: parent_fd from os.fork() is a read/write pipe attached to our # forked process' stdout/stdin, respectively. fd = self.parent_fd if self.using_pty else self.process.stdin.fileno() # Try to write, ignoring broken pipes if encountered (implies child ...
OSError
dataset/ETHPy150Open pyinvoke/invoke/invoke/runners.py/Local.write_stdin
477
def __getattr__(self, attr): try: return self._links[attr] except __HOLE__: raise AttributeError(attr)
KeyError
dataset/ETHPy150Open jacobian/valor/valor/resource.py/Resource.__getattr__
478
def _is_numeric(self, value): try: int(value) except __HOLE__: return False return True
ValueError
dataset/ETHPy150Open wooyek/flask-social-blueprint/example/gae/auth/models.py/AppEngineUserDatastore._is_numeric
479
def open(self): """Open a pre-existing on-disk database. @raise anydbm.error: If there's a problem opening the database. @raise ValueError: If the database is not of the right type. """ if not self.filename: raise ValueError("Can only open on-disk databases") ...
KeyError
dataset/ETHPy150Open kuri65536/python-for-android/python3-alpha/python-libs/gdata/tlslite/BaseDB.py/BaseDB.open
480
def get_current_log_level(self): """ Fetches the current log level, the level set to INFO by default if an unknown level given in the config Args: None Return: Log level Raise: None """ tr...
KeyError
dataset/ETHPy150Open linkedin/simoorg/src/simoorg/Logger.py/Logger.get_current_log_level
481
def is_verbose_logging_enabled(self): """ Check if verbose flag is set Args: None Return: True if verbose flag is set else False Raise: None """ try: if self.log_config['verbose']: ...
KeyError
dataset/ETHPy150Open linkedin/simoorg/src/simoorg/Logger.py/Logger.is_verbose_logging_enabled
482
def is_console_logging_enabled(self): """ Check if console logging is enabled Args: None Return: True if console logging is enabled else False Raise: None """ try: if self.log_config['cons...
KeyError
dataset/ETHPy150Open linkedin/simoorg/src/simoorg/Logger.py/Logger.is_console_logging_enabled
483
def is_file_logging_enabled(self): """ Check if file logging is enabled Args: None Return: True if console logging is enabled else False Raise: None """ try: if self.log_config['path']: ...
KeyError
dataset/ETHPy150Open linkedin/simoorg/src/simoorg/Logger.py/Logger.is_file_logging_enabled
484
def get_logger_file_path(self): """ Fetch the logger file path Args: None Return: Path to the log file Raise: None """ try: if self.log_config['path']: return self.log_conf...
KeyError
dataset/ETHPy150Open linkedin/simoorg/src/simoorg/Logger.py/Logger.get_logger_file_path
485
def init_log(log_level=WARNING, log_path=True, log_truncate=False, log_size=10000000, log_numbackups=1, log_color=True): formatter = Formatter( "%(asctime)s %(levelname)s %(name)s %(filename)s:%(funcName)s():L%(lineno)d %(message)s" ) # We'll always use a stream handler stream_hand...
TypeError
dataset/ETHPy150Open qtile/qtile/libqtile/log_utils.py/init_log
486
def inner_run(self, *args, **options): # If an exception was silenced in ManagementUtility.execute in order # to be raised in the child process, raise it now. # OPENSLIDES: We do not use the django autoreload command # autoreload.raise_last_exception() # OPENSLIDES: This line is...
KeyError
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/core/management/commands/runserver.py/Command.inner_run
487
def is_dir(path): try: return (040000 & (os.stat(path).st_mode)) > 0 except __HOLE__: return False
OSError
dataset/ETHPy150Open richo/groundstation/groundstation/utils/__init__.py/is_dir
488
def truncateletters(value, arg): """ Truncates a string after a certain number of letters Argument: Number of letters to truncate after """ from django_extensions.utils.text import truncate_letters try: length = int(arg) except __HOLE__: # invalid literal for int() return v...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/templatetags/truncate_letters.py/truncateletters
489
@classmethod def setUpClass(cls): cls.static_files = Files('static', css='styles.css') settings.STATICFILES_DIRS = [cls.static_files.directory] settings.WHITENOISE_USE_FINDERS = True settings.WHITENOISE_AUTOREFRESH = True # Clear cache to pick up new settings try: ...
AttributeError
dataset/ETHPy150Open evansd/whitenoise/tests/test_django_whitenoise.py/UseFindersTest.setUpClass
490
def _parse_ip(string, families=(socket.AF_INET, socket.AF_INET6)): for family in families: try: return socket.inet_ntop(family, socket.inet_pton(family, string)) except (__HOLE__, socket.error): pass return None
ValueError
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/cymruwhois.py/_parse_ip
491
@idiokit.stream def lookup(self, asn): try: asn = int(asn) except __HOLE__: idiokit.stop(()) results = self._cache.get(asn, None) if results is not None: idiokit.stop(results) try: txt_results = yield dns.txt( ...
ValueError
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/cymruwhois.py/ASNameLookup.lookup
492
def action_redis_server_disconnect(config): """ Disconnect one or more users from server """ log.warning(" - Trying to connect with redis server...") # Connection with redis con = redis.StrictRedis(host=config.target, port=config.port, db=config.db) clients = {x['addr']: x['addr'] for x in con.client_list()} ...
KeyError
dataset/ETHPy150Open cr0hn/enteletaor/enteletaor_lib/modules/redis/redis_disconnect.py/action_redis_server_disconnect
493
def lookup_failure(self, artifact_name): """Looks up a failure for the given artifact name.""" fn = self.get_filename(artifact_name) try: with open(fn, 'rb') as f: return BuildFailure(json.load(f)) except __HOLE__ as e: if e.errno != errno.ENOENT: ...
IOError
dataset/ETHPy150Open lektor/lektor-archive/lektor/buildfailures.py/FailureController.lookup_failure
494
def clear_failure(self, artifact_name): """Clears a stored failure.""" try: os.unlink(self.get_filename(artifact_name)) except __HOLE__ as e: if e.errno != errno.ENOENT: raise
OSError
dataset/ETHPy150Open lektor/lektor-archive/lektor/buildfailures.py/FailureController.clear_failure
495
def store_failure(self, artifact_name, exc_info): """Stores a failure from an exception info tuple.""" fn = self.get_filename(artifact_name) try: os.makedirs(os.path.dirname(fn)) except __HOLE__: pass with open(fn, 'wb') as f: json.dump(BuildFa...
OSError
dataset/ETHPy150Open lektor/lektor-archive/lektor/buildfailures.py/FailureController.store_failure
496
def _get_package_path(name): """Returns the path to a package or cwd if that cannot be found.""" try: return os.path.abspath(os.path.dirname(sys.modules[name].__file__)) except (KeyError, __HOLE__): return os.getcwd()
AttributeError
dataset/ETHPy150Open hhstore/flask-annotated/flask-0.5/flask/helpers.py/_get_package_path
497
def user_data(self, access_token, *args, **kwargs): """Return user data provided""" response = self.oauth_request( access_token, 'http://api.openstreetmap.org/api/0.6/user/details' ) try: dom = minidom.parseString(response.content) except __HOLE__: ...
ValueError
dataset/ETHPy150Open omab/python-social-auth/social/backends/openstreetmap.py/OpenStreetMapOAuth.user_data
498
@no_auto_transaction @collect_auth @must_be_valid_project(retractions_valid=True) def get_logs(auth, node, **kwargs): """ """ try: page = int(request.args.get('page', 0)) except __HOLE__: raise HTTPError(http.BAD_REQUEST, data=dict( message_long='Invalid value for "page".' ...
ValueError
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/project/views/log.py/get_logs
499
def _what(self, instance, level, depth): if level <= 1: if depth == 1: return Page.objects.toplevel_navigation() else: return Page.objects.in_navigation().filter(level__lt=depth) # mptt starts counting at 0, NavigationNode at 1; if we need the sub...
IndexError
dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/module/nav/templatetags/webcms_nav_tags.py/NavigationNode._what