Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
2,200
def deep_getattr(obj, pathname): """Returns a tuple of the form (value, restofpath), if restofpath is None, value is the actual desired value, else it's the closest containing object in this process, and restofpath will contain the string that would resolve the desired object within the containing o...
AttributeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/index.py/deep_getattr
2,201
def setUp(self): try: import jirafs_list_table # noqa except __HOLE__: raise SkipTest( "Push command macropatch tests require the " "jira-list-table package to be installed." ) super(TestPushCommandWithMacropatch, self).setUp()...
ImportError
dataset/ETHPy150Open coddingtonbear/jirafs/tests/commands/test_push.py/TestPushCommandWithMacropatch.setUp
2,202
@login_manager.user_loader def load_user(userid): try: return models.user.User.query.get(int(userid)) except (TypeError, __HOLE__): pass
ValueError
dataset/ETHPy150Open omab/python-social-auth/examples/flask_example/__init__.py/load_user
2,203
@app.context_processor def inject_user(): try: return {'user': g.user} except __HOLE__: return {'user': None}
AttributeError
dataset/ETHPy150Open omab/python-social-auth/examples/flask_example/__init__.py/inject_user
2,204
def __init__(self, parent): parent.title = "Volume Probe" parent.categories = ["Wizards"] parent.dependencies = [] parent.contributors = ["Alex Yarmarkovich"] # replace with "Firstname Lastname (Org)" parent.helpText = """ """ parent.helpText = string.Template(""" This module helps organ...
AttributeError
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/VolumeProbe/VolumeProbe.py/VolumeProbe.__init__
2,205
def onReload(self,moduleName="VolumeProbe"): """Generic reload method for any scripted module. ModuleWizard will subsitute correct default moduleName. """ import imp, sys, os, slicer widgetName = moduleName + "Widget" # reload the source code # - set source file path # - load the modul...
AttributeError
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/VolumeProbe/VolumeProbe.py/VolumeProbeWidget.onReload
2,206
def __getitem__(self, key): try: return dict.__getitem__(self, key) except __HOLE__: return self.__missing__(key)
KeyError
dataset/ETHPy150Open YelpArchive/python-gearman/gearman/compat.py/defaultdict.__getitem__
2,207
def get_psd(self, data, NFFT, FS): """By calling 'psd' within axes, it both calculates and plots the spectrum""" try: Pxx, freqs = self.axes.psd(data, NFFT = NFFT, Fs = FS) self.need_refresh = True except __HOLE__ as err_re: print("Warning:", err_re) ...
RuntimeError
dataset/ETHPy150Open ericgibert/supersid/supersid/tksidviewer.py/tkSidViewer.get_psd
2,208
def refresh_psd(self, z=None): """redraw the graphic PSD plot if needed i.e.new data have been given to get_psd""" if self.need_refresh: try: self.canvas.draw() self.need_refresh = False except __HOLE__ as err_idx: print("Warning:",...
IndexError
dataset/ETHPy150Open ericgibert/supersid/supersid/tksidviewer.py/tkSidViewer.refresh_psd
2,209
def test_b_before_a(): os.environ['CONF'] = sample('b.yaml') sys.argv = sys.argv[0:1] + ['--conf-mysql', 'host: localhost', '--conf', sample('a.yaml')] try: waiter() except __HOLE__: pass
SystemExit
dataset/ETHPy150Open EverythingMe/click-config/click_config/test/test_inotify.py/test_b_before_a
2,210
def test_a_before_b(): os.environ['CONF'] = sample('a.yaml') sys.argv = sys.argv[0:1] + ['--conf-mysql', 'host: localhost', '--conf', sample('b.yaml'), '--expected-port', '777'] try: passer() except __HOLE__: pass
SystemExit
dataset/ETHPy150Open EverythingMe/click-config/click_config/test/test_inotify.py/test_a_before_b
2,211
def test_overrides(): os.environ['CONF'] = sample('a.yaml') sys.argv = sys.argv[0:1] + ['--conf-mysql', 'host: localhost\nport: 888', '--conf', sample('b.yaml'), '--expected-port', '888'] try: passer() except __HOLE__: pass
SystemExit
dataset/ETHPy150Open EverythingMe/click-config/click_config/test/test_inotify.py/test_overrides
2,212
def to_html(self, image_file, image_url, center=True): """ Return the HTML code that should be uesd to display this graph (including a client-side image map). :param image_url: The URL of the image file for this graph; this should be generated separately with the `wr...
UnicodeDecodeError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/Legacy/epydoc-3.0.1/epydoc/docwriter/dotgraph.py/DotGraph.to_html
2,213
def _run_dot(self, *options): try: result, err = run_subprocess((DOT_COMMAND,)+options, self.to_dotfile()) if err: log.warning("Graphviz dot warning(s):\n%s" % err) except __HOLE__, e: log.warning("Unable to render Graphviz dot...
OSError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/Legacy/epydoc-3.0.1/epydoc/docwriter/dotgraph.py/DotGraph._run_dot
2,214
def uml_class_tree_graph(class_doc, linker, context=None, **options): """ Return a `DotGraph` that graphically displays the class hierarchy for the given class, using UML notation. Options: - max_attributes - max_operations - show_private_vars - show_magic_vars - link_attribu...
ValueError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/Legacy/epydoc-3.0.1/epydoc/docwriter/dotgraph.py/uml_class_tree_graph
2,215
def get_dot_version(): global _dot_version if _dot_version is None: try: out, err = run_subprocess([DOT_COMMAND, '-V']) version_info = err or out m = _DOT_VERSION_RE.match(version_info) if m: _dot_version = [int(x) for x in m.group(1).split...
OSError
dataset/ETHPy150Open QuantSoftware/QuantSoftwareToolkit/Legacy/epydoc-3.0.1/epydoc/docwriter/dotgraph.py/get_dot_version
2,216
def write_csv(rows, delim): writer = csv.writer(click.get_text_stream('stdout'), delimiter=delim) try: [writer.writerow(row) for row in rows] except (OSError, __HOLE__): sys.stderr.close()
IOError
dataset/ETHPy150Open learntextvis/textkit/textkit/utils.py/write_csv
2,217
def output(line): try: click.echo(line) except (__HOLE__, IOError): sys.stderr.close()
OSError
dataset/ETHPy150Open learntextvis/textkit/textkit/utils.py/output
2,218
def error_reason(self, workername, response): "extracts error message from response" for r in response: try: return r[workername].get('error', 'Unknown reason') except __HOLE__: pass logger.error("Failed to extract error reason from '%s'", ...
KeyError
dataset/ETHPy150Open mher/flower/flower/api/control.py/ControlHandler.error_reason
2,219
@classmethod def init_table(cls, key, method): cls.method = None if method == 'table' else method.lower() cls.key = key if cls.method: try: __import__('M2Crypto') except __HOLE__: logger.error( 'M2Crypto is required ...
ImportError
dataset/ETHPy150Open mrknow/filmkodi/plugin.video.mrknow/lib/test/test.py/Crypto.init_table
2,220
def ContentGenerator(csv_file, batch_size, create_csv_reader=csv.reader, create_csv_writer=csv.writer): """Retrieves CSV data up to a batch size at a time. Args: csv_file: A file-like object for reading CSV data. batch_size: Maximum number of C...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/bulkload_client.py/ContentGenerator
2,221
def PostEntities(host_port, uri, cookie, kind, content): """Posts Entity records to a remote endpoint over HTTP. Args: host_port: String containing the "host:port" pair; the port is optional. uri: Relative URI to access on the remote host (e.g., '/bulkload'). cookie: String containing the Cookie header to...
IOError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/bulkload_client.py/PostEntities
2,222
def postOptions(self): # Mandatory parameters # Validate image if self['image'] is None: raise usage.UsageError( "image parameter must be provided" ) # Validate mountpoint if self['mountpoint'] is None: raise usage.UsageError("m...
ValueError
dataset/ETHPy150Open ClusterHQ/flocker/benchmark/cluster_containers_setup.py/ContainerOptions.postOptions
2,223
def _conditional_import_module(self, module_name): """Import a module and return a reference to it or None on failure.""" try: exec('import '+module_name) except __HOLE__ as error: if self._warn_on_extension_import: warnings.warn('Did a C extension fail to...
ImportError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_hashlib.py/HashLibTestCase._conditional_import_module
2,224
def test_get_builtin_constructor(self): get_builtin_constructor = hashlib.__dict__[ '__get_builtin_constructor'] self.assertRaises(ValueError, get_builtin_constructor, 'test') try: import _md5 except __HOLE__: pass # This forces an ImportEr...
ImportError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_hashlib.py/HashLibTestCase.test_get_builtin_constructor
2,225
def handle(self, *args, **options): if options['devices']: devices = Device.objects.filter(is_active=True) self.stdout.write("Devices list:\n") for device in devices: self.stdout.write("(#%s) %s\n" % (device.id, device.name)) self.stdout.write("\...
IndexError
dataset/ETHPy150Open bogdal/django-gcm/gcm/management/commands/gcm_messenger.py/Command.handle
2,226
def serve(self): self.trans.listen() while not self.closed: try: client = self.trans.accept() t = threading.Thread(target=self.handle, args=(client,)) t.setDaemon(self.daemon) t.start() except __HOLE__: ...
KeyboardInterrupt
dataset/ETHPy150Open eleme/thriftpy/thriftpy/server.py/TThreadedServer.serve
2,227
def Run(self): """Utility main loop. """ while True: self._AddPendingToQueue() # Collect all active daemon names daemons = self._GetActiveDaemonNames(self._queue) if not daemons: break # Collection daemon status data data = self._CollectDaemonStatus(self._lu, d...
KeyError
dataset/ETHPy150Open ganeti/ganeti/lib/masterd/instance.py/ImportExportLoop.Run
2,228
def CheckRemoteExportHandshake(cds, handshake): """Checks the handshake of a remote import/export. @type cds: string @param cds: Cluster domain secret @type handshake: sequence @param handshake: Handshake sent by remote peer """ try: (version, hmac_digest, hmac_salt) = handshake except (__HOLE__, ...
TypeError
dataset/ETHPy150Open ganeti/ganeti/lib/masterd/instance.py/CheckRemoteExportHandshake
2,229
def CheckRemoteExportDiskInfo(cds, disk_index, disk_info): """Verifies received disk information for an export. @type cds: string @param cds: Cluster domain secret @type disk_index: number @param disk_index: Index of disk (included in hash) @type disk_info: sequence @param disk_info: Disk information sen...
TypeError
dataset/ETHPy150Open ganeti/ganeti/lib/masterd/instance.py/CheckRemoteExportDiskInfo
2,230
def tile(A, reps): """Construct an array by repeating A the number of times given by reps. Args: A (cupy.ndarray): Array to transform. reps (int or tuple): The number of repeats. Returns: cupy.ndarray: Transformed array with repeats. .. seealso:: :func:`numpy.tile` """ ...
TypeError
dataset/ETHPy150Open pfnet/chainer/cupy/manipulation/tiling.py/tile
2,231
def simpleFunction1(): try: raise TypeError, (3,x,x,x) except __HOLE__: pass
TypeError
dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/Referencing_2.py/simpleFunction1
2,232
def simpleFunction6(): def nested_args_function((a,b), c): return a, b, c try: nested_args_function((1,), 3) except __HOLE__: pass
ValueError
dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/Referencing_2.py/simpleFunction6
2,233
def simpleFunction7(): def nested_args_function((a,b), c): return a, b, c try: nested_args_function((1, 2, 3), 3) except __HOLE__: pass # These need stderr to be wrapped.
ValueError
dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/Referencing_2.py/simpleFunction7
2,234
def get_exemplar_from_file(cldr_file_path): try: return exemplar_from_file_cache[cldr_file_path] except __HOLE__: pass data_file = path.join(CLDR_DIR, cldr_file_path) try: root = ElementTree.parse(data_file).getroot() except IOError: exemplar_from_file_cache[cldr_fil...
KeyError
dataset/ETHPy150Open googlei18n/nototools/nototools/generate_website_data.py/get_exemplar_from_file
2,235
def get_language_name_from_file(language, cldr_file_path): cache_key = (language, cldr_file_path) try: return language_name_from_file_cache[cache_key] except KeyError: pass data_file = path.join(CLDR_DIR, cldr_file_path) try: root = ElementTree.parse(data_file).getroot() ...
IOError
dataset/ETHPy150Open googlei18n/nototools/nototools/generate_website_data.py/get_language_name_from_file
2,236
def get_native_language_name(lang_scr): """Get the name of a language in its own locale.""" try: return extra_locale_data.NATIVE_NAMES[lang_scr] except __HOLE__: pass if '-' in lang_scr: language = lang_scr.split('-')[0] else: language = lang_scr locl = lang_scr...
KeyError
dataset/ETHPy150Open googlei18n/nototools/nototools/generate_website_data.py/get_native_language_name
2,237
def get_english_language_name(lang_scr): try: return english_language_name[lang_scr] except __HOLE__: lang, script = lang_scr.split('-') name = '%s (%s script)' % ( english_language_name[lang], english_script_name[script]) print "Constructing name '%s' for...
KeyError
dataset/ETHPy150Open googlei18n/nototools/nototools/generate_website_data.py/get_english_language_name
2,238
def create_langs_object(): langs = {} for lang_scr in sorted(set(written_in_scripts) | all_used_lang_scrs): lang_object = {} if '-' in lang_scr: language, script = lang_scr.split('-') else: language = lang_scr try: script = find_likely_...
KeyError
dataset/ETHPy150Open googlei18n/nototools/nototools/generate_website_data.py/create_langs_object
2,239
def _get_open_fds(): fds = set() for fd in range(3,resource.getrlimit(resource.RLIMIT_NOFILE)[0]): try: flags = fcntl.fcntl(fd, fcntl.F_GETFD) except __HOLE__: continue fds.add(fd) return fds
IOError
dataset/ETHPy150Open natduca/quickopen/src/test_runner.py/_get_open_fds
2,240
def writeRecord(self,dn,entry): """ dn string-representation of distinguished name entry dictionary holding the LDAP entry {attr:data} """ # Write line dn: first self._output_file.write( '%s<dsml:entry dn="%s">\n' % ( self._indent*2,replace_char(dn) ) ...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/python-ldap-2.3.13/Lib/dsml.py/DSMLWriter.writeRecord
2,241
def ordinal(value): """ Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc. Works for any integer. """ try: value = int(value) except __HOLE__: return value t = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/humanize/templatetags/humanize.py/ordinal
2,242
def apnumber(value): """ For numbers 1-9, returns the number spelled out. Otherwise, returns the number. This follows Associated Press style. """ try: value = int(value) except __HOLE__: return value if not 0 < value < 10: return value return (_('one'), _('two'), ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/humanize/templatetags/humanize.py/apnumber
2,243
def edge_connectivity(G, s=None, t=None, flow_func=None): r"""Returns the edge connectivity of the graph or digraph G. The edge connectivity is equal to the minimum number of edges that must be removed to disconnect G or render it trivial. If source and target nodes are provided, this function returns ...
IndexError
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/connectivity/connectivity.py/edge_connectivity
2,244
def setUp(self): """Use the same server for all tests.""" global _server if not _server: _server = Server() _server.start() wait = 5 running = False while not running and wait > 0: try: urlopen(WebGu...
IOError
dataset/ETHPy150Open pympler/pympler/test/gui/test_web.py/WebGuiTest.setUp
2,245
def get(self, url, status=200): conn = HTTPConnection(self.defaulthost) conn.request("GET", url) response = conn.getresponse() body = response.read() conn.close() self.assertEqual(response.status, status) try: body = body.decode() except __HOLE...
UnicodeDecodeError
dataset/ETHPy150Open pympler/pympler/test/gui/test_web.py/WebGuiTest.get
2,246
def _check_cloudera_manager_started(self, manager): try: conn = telnetlib.Telnet(manager.management_ip, CM_API_PORT) conn.close() return True except __HOLE__: return False
IOError
dataset/ETHPy150Open openstack/sahara/sahara/plugins/cdh/plugin_utils.py/AbstractPluginUtils._check_cloudera_manager_started
2,247
def run(self, edit): self._setup_cmd() import os, subprocess, sys try: print "*** Executing command is : " + self.CMD + self.view.file_name() retcode = subprocess.call(self.CMD+self.view.file_name(), shell=True) if retcode < 0: print >>sys.stderr, "Aborted : ", -retcode else:...
OSError
dataset/ETHPy150Open ikeike443/Sublime-Scalariform/Scalariform.py/ScalariformCommand.run
2,248
def run(self): """ runs fdmnes """ self.wfdmfile() # write fdmfile.txt self.wconvfile() # write convfile.txt try: subprocess.call('fdmnes', shell=True) except __HOLE__: print("check 'fdmnes' executable exists!")
OSError
dataset/ETHPy150Open xraypy/xraylarch/plugins/math/convolution1D.py/FdmnesConv.run
2,249
@record def test_update_page_fail(self): # Arrange blob_name = self._create_blob(2048) data = self.get_random_bytes(512) resp1 = self.bs.update_page(self.container_name, blob_name, data, 0, 511) # Act try: self.bs.update_page(self.container_name, blob...
ValueError
dataset/ETHPy150Open Azure/azure-storage-python/tests/test_page_blob.py/StoragePageBlobTest.test_update_page_fail
2,250
def create_capture(source = 0): '''source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]' ''' source = str(source).strip() chunks = source.split(':') # hanlde drive letter ('c:', ...) if len(chunks) > 1 and len(chunks[0]) == 1 and chunks[0].isalpha(): chunks[1] = chunks...
ValueError
dataset/ETHPy150Open bluquar/cubr/color.py/create_capture
2,251
def __call__(self, query, maxresult, catcherrors, normalize): swipl_fid = PL_open_foreign_frame() swipl_head = PL_new_term_ref() swipl_args = PL_new_term_refs(2) swipl_goalCharList = swipl_args swipl_bindingList = swipl_args + 1 PL_put_list_chars...
AttributeError
dataset/ETHPy150Open yuce/pyswip/pyswip/prolog.py/Prolog._QueryWrapper.__call__
2,252
@classmethod def _checkaxis(cls, axis=None, shape=None, **kwargs): """ Check and expand a tuple of axis on Array, >>> A = Array(1, shape=(3, 3, 3)) >>> print A.formated() [[[1, 1, 1], [1, 1, 1], [1, 1, 1]], <BLANKLINE> ...
IndexError
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/arrays.py/Array._checkaxis
2,253
def get_index(array, key, default=None): try: return array.index(key) except __HOLE__: return default
ValueError
dataset/ETHPy150Open redhat-cip/software-factory/image/edeploy/mngids.py/get_index
2,254
def main(): uids = {} gids = {} debug('ORIG %s' % str(sys.argv)) IDS = '/etc/ids.tables' try: exec(open(IDS).read()) except __HOLE__: pass parse(open('/etc/passwd').read(), uids) parse(open('/etc/group').read(), gids, True) parse_cmdline(sys.argv, uids, gids) #...
IOError
dataset/ETHPy150Open redhat-cip/software-factory/image/edeploy/mngids.py/main
2,255
def getSRS(self, srsname, typename): """Returns None or Crs object for given name @param typename: feature name @type typename: String """ if not isinstance(srsname, Crs): srs = Crs(srsname) else: srs = srsname try: index = ...
ValueError
dataset/ETHPy150Open geopython/OWSLib/owslib/feature/__init__.py/WebFeatureService_.getSRS
2,256
def _TearDown(self): """Performs operations to clean things up after performing diagnostics.""" if not self.teardown_completed: temp_file_dict.clear() try: for fpath in self.temporary_files: os.remove(fpath) if self.delete_directory: os.rmdir(self.directory) ...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._TearDown
2,257
def _GetTcpStats(self): """Tries to parse out TCP packet information from netstat output. Returns: A dictionary containing TCP information, or None if netstat is not available. """ # netstat return code is non-zero for -s on Linux, so don't raise on error. try: netstat_output = ...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._GetTcpStats
2,258
def _CollectSysInfo(self): """Collects system information.""" sysinfo = {} # All exceptions that might be raised from socket module calls. socket_errors = ( socket.error, socket.herror, socket.gaierror, socket.timeout) # Find out whether HTTPS is enabled in Boto. sysinfo['boto_https_en...
IOError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._CollectSysInfo
2,259
def _DisplayResults(self): """Displays results collected from diagnostic run.""" print print '=' * 78 print 'DIAGNOSTIC RESULTS'.center(78) print '=' * 78 if 'latency' in self.results: print print '-' * 78 print 'Latency'.center(78) print '-' * 78 print ('Operation...
TypeError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._DisplayResults
2,260
def _ParsePositiveInteger(self, val, msg): """Tries to convert val argument to a positive integer. Args: val: The value (as a string) to convert to a positive integer. msg: The error message to place in the CommandException on an error. Returns: A valid positive integer. Raises: ...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._ParsePositiveInteger
2,261
def _ParseArgs(self): """Parses arguments for perfdiag command.""" # From -n. self.num_objects = 5 # From -c. self.processes = 1 # From -k. self.threads = 1 # From -p self.parallel_strategy = None # From -y self.num_slices = 4 # From -s. self.thru_filesize = 1048576 ...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._ParseArgs
2,262
@jinja2.contextfunction @library.global_function def breadcrumbs(context, items=list(), add_default=True, id=None): """ Show a list of breadcrumbs. If url is None, it won't be a link. Accepts: [(url, label)] """ if add_default: first_crumb = u'Home' crumbs = [(reverse('home'), _lazy...
TypeError
dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/templatetags/jinja_helpers.py/breadcrumbs
2,263
@jinja2.contextfunction @library.global_function def datetimeformat(context, value, format='shortdatetime'): """ Returns a formatted date/time using Babel's locale settings. Uses the timezone from settings.py, if the user has not been authenticated. """ if not isinstance(value, datetime.datetime): ...
AttributeError
dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/templatetags/jinja_helpers.py/datetimeformat
2,264
@library.global_function def static(path): """Generate a URL for the specified static file.""" try: return django_static(path) except __HOLE__ as err: log.error('Static helper error: %s' % err) return ''
ValueError
dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/templatetags/jinja_helpers.py/static
2,265
def _module_exists(self, module_name): """ Returns True iff module_name exists (but isn't necessarily importable). """ # imp.find_module doesn't handle hierarchical module names, so we split # on full stops and keep feeding it the path it returns until we run # out of mo...
ImportError
dataset/ETHPy150Open mollyproject/mollyproject/molly/conf/settings.py/Application._module_exists
2,266
def test_get_raises_exception_with_full_traceback(self): exc_class_get = None exc_class_set = None exc_instance_get = None exc_instance_set = None exc_traceback_get = None exc_traceback_set = None future = self.future_class() try: raise NameEr...
NameError
dataset/ETHPy150Open jodal/pykka/tests/future_test.py/FutureTest.test_get_raises_exception_with_full_traceback
2,267
def push_message(parsed_message): """ Spawned as a greenlet to push parsed messages through ZeroMQ. """ try: # This will be the representation to send to the Announcers. json_str = unified.encode_to_json(parsed_message) except __HOLE__: logger.error('Unable to serialize a par...
TypeError
dataset/ETHPy150Open gtaylor/EVE-Market-Data-Relay/emdr/daemons/gateway/order_pusher.py/push_message
2,268
@classmethod def run(cls, command, cwd=".", **kwargs): """ Make a subprocess call, collect its output and returncode. Returns CommandResult instance as ValueObject. """ assert isinstance(command, six.string_types) command_result = CommandResult() command_resul...
OSError
dataset/ETHPy150Open behave/behave/behave4cmd0/command_shell.py/Command.run
2,269
def seq_arrival(self, seq_num): ''' returns the packet in which the specified sequence number first arrived. ''' try: return self.arrival_data.find_le(seq_num)[1] except __HOLE__: return None
ValueError
dataset/ETHPy150Open andrewf/pcap2har/pcap2har/tcp/direction.py/Direction.seq_arrival
2,270
@classmethod def Open(cls, **kwargs): """See IterOpen, but raises if multiple or no matches found.""" handle_iter = cls.IterOpen(**kwargs) try: handle = next(handle_iter) except StopIteration: # No matching interface, raise. raise usb_exceptions.DeviceNotFoundError( 'Open ...
StopIteration
dataset/ETHPy150Open google/openhtf/openhtf/plugs/usb/local_usb.py/LibUsbHandle.Open
2,271
@click.command() @click.option('--config', help="Path to configuration file. Default: ~/.curator/curator.yml", type=click.Path(exists=True), default=CONFIG_FILE ) @click.option('--dry-run', is_flag=True, help='Do not perform any changes.') @click.argument('action_file', type=click.Path(exists=True), nargs=1) @c...
KeyError
dataset/ETHPy150Open elastic/curator/curator/cli.py/cli
2,272
@cached_property def has_ddl_transactions(self): """ Tests the database using feature detection to see if it has transactional DDL support. """ self._possibly_initialise() connection = self._get_connection() if hasattr(connection.features, "confirm") and not c...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.has_ddl_transactions
2,273
def lookup_constraint(self, db_name, table_name, column_name=None): """ return a set() of constraints for db_name.table_name.column_name """ def _lookup(): table = self._constraint_cache[db_name][table_name] if table is INVALID: raise INVALID elif colu...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.lookup_constraint
2,274
def _set_cache(self, table_name, column_name=None, value=INVALID): db_name = self._get_setting('NAME') try: if column_name is not None: self._constraint_cache[db_name][table_name][column_name] = value else: self._constraint_cache[db_name][table_nam...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._set_cache
2,275
def _is_valid_cache(self, db_name, table_name): # we cache per-table so if the table is there it is valid try: return self._constraint_cache[db_name][table_name] is not INVALID except __HOLE__: return False
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._is_valid_cache
2,276
def _is_multidb(self): try: from django.db import connections connections # Prevents "unused import" warning except __HOLE__: return False else: return True
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._is_multidb
2,277
def _has_setting(self, setting_name): """ Existence-checking version of _get_setting. """ try: self._get_setting(setting_name) except (__HOLE__, AttributeError): return False else: return True
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._has_setting
2,278
def _get_schema_name(self): try: return self._get_setting('schema') except (KeyError, __HOLE__): return self.default_schema_name
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._get_schema_name
2,279
def _db_type_for_alter_column(self, field): """ Returns a field's type suitable for ALTER COLUMN. By default it just returns field.db_type(). To be overriden by backend specific subclasses @param field: The field to generate type for """ try: return fi...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations._db_type_for_alter_column
2,280
@invalidate_table_constraints def alter_column(self, table_name, name, field, explicit_name=True, ignore_constraints=False): """ Alters the given column name so it will match the given field. Note that conversion between the two by the database must be possible. Will not automaticall...
ValueError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.alter_column
2,281
def column_sql(self, table_name, field_name, field, tablespace='', with_name=True, field_prepared=False): """ Creates the SQL snippet for a column. Used by add_column and add_table. """ # If the field hasn't already been told its attribute name, do so. if not field_prepared: ...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.column_sql
2,282
def create_index_name(self, table_name, column_names, suffix=""): """ Generate a unique name for the index """ # If there is just one column in the index, use a default algorithm from Django if len(column_names) == 1 and not suffix: try: _hash = self....
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.create_index_name
2,283
def send_pending_create_signals(self, verbosity=0, interactive=False): # Group app_labels together signals = SortedDict() for (app_label, model_names) in self.pending_create_signals: try: signals[app_label].extend(model_names) except __HOLE__: ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/generic.py/DatabaseOperations.send_pending_create_signals
2,284
def create(self, request, *args, **kwargs): try: token = Token.objects.get(key=request.DATA["service_key"]) serviceToken = ServiceTokens.objects.get(token_id=token) service = serviceToken.service_id except ServiceTokens.DoesNotExist: return Response({}, st...
KeyError
dataset/ETHPy150Open ustream/openduty/openduty/incidents.py/IncidentViewSet.create
2,285
@login_required() @require_http_methods(["POST"]) def update_type(request): event_type = request.POST['event_type'] event_types = ('acknowledge', 'resolve') incident_ids = request.POST.getlist('selection', None) if not event_type: messages.error(request, 'Invalid event modification!') r...
ValidationError
dataset/ETHPy150Open ustream/openduty/openduty/incidents.py/update_type
2,286
@login_required() @require_http_methods(["POST"]) def forward_incident(request): try: with transaction.atomic(): incident = Incident.objects.get(id=request.POST['id']) user = User.objects.get(id=request.POST['user_id']) ScheduledNotification.remove_all_for_incident(incide...
ValidationError
dataset/ETHPy150Open ustream/openduty/openduty/incidents.py/forward_incident
2,287
def __getattr__(self, key): try: return self[key] except __HOLE__ as e: raise AttributeError(e)
KeyError
dataset/ETHPy150Open dask/dask/dask/dataframe/groupby.py/DataFrameGroupBy.__getattr__
2,288
def _set_metadata(self): context = self._config.context config = self._config.plugins[self.full_name] log.debug('Populating snapshot and ami metadata for tagging and naming') creator = context.ami.get('creator', config.get('creator', 'aminator')) context.ami.tags.creator = creat...
KeyError
dataset/ETHPy150Open Netflix/aminator/aminator/plugins/finalizer/tagging_base.py/TaggingBaseFinalizerPlugin._set_metadata
2,289
def _scrub_checklist_input(self, indices, tags): # pylint: disable=no-self-use """Validate input and transform indices to appropriate tags. :param list indices: input :param list tags: Original tags of the checklist :returns: valid tags the user selected :rtype: :class:...
ValueError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/display/util.py/FileDisplay._scrub_checklist_input
2,290
def _get_valid_int_ans(self, max_): """Get a numerical selection. :param int max: The maximum entry (len of choices), must be positive :returns: tuple of the form (`code`, `selection`) where `code` - str display exit code ('ok' or cancel') `selection` - int user's selec...
ValueError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/display/util.py/FileDisplay._get_valid_int_ans
2,291
def t4(): a = [] try: with open(os.getcwd() + '//ml-100k' + '/u.item') as item: for line in item: a = line.split('|')[5:24] print a #(itemId,title)=line.split('|')[0:2] #movies[itemId]=title except __HOLE__ as err: ...
IOError
dataset/ETHPy150Open clasnake/recommender/test.py/t4
2,292
def get_handler(self, name): try: return self.handlers[name] except __HOLE__: raise DataError("No keyword handler with name '%s' found" % name)
KeyError
dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/common/libraries.py/BaseLibrary.get_handler
2,293
def __normalize(self, event=None): ew = event.widget contents = ew.get() icursor = ew.index(INSERT) if contents and contents[0] in 'xX' and self.__hexp.get(): contents = '0' + contents # Figure out the contents in the current base. try: if ...
ValueError
dataset/ETHPy150Open Southpaw-TACTIC/TACTIC/src/context/client/tactic-api-python-4.0.api04/Tools/pynche/TypeinViewer.py/TypeinViewer.__normalize
2,294
def validate(self, value): """ Validate value. If value is valid, returns `True` and `False` otherwise. :param value: Value to validate """ # useful for filters with date conversions, see if conversion in clean() raises ValueError try...
ValueError
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/model/filters.py/BaseFilter.validate
2,295
def validate(self, value): try: value = [datetime.datetime.strptime(range, '%Y-%m-%d').date() for range in value.split(' to ')] # if " to " is missing, fail validation # sqlalchemy's .between() will not work if end date is before start date if...
ValueError
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/model/filters.py/BaseDateBetweenFilter.validate
2,296
def validate(self, value): try: value = [datetime.datetime.strptime(range, '%Y-%m-%d %H:%M:%S') for range in value.split(' to ')] if (len(value) == 2) and (value[0] <= value[1]): return True else: return False excep...
ValueError
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/model/filters.py/BaseDateTimeBetweenFilter.validate
2,297
def validate(self, value): try: timetuples = [time.strptime(range, '%H:%M:%S') for range in value.split(' to ')] if (len(timetuples) == 2) and (timetuples[0] <= timetuples[1]): return True else: return False ex...
ValueError
dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/model/filters.py/BaseTimeBetweenFilter.validate
2,298
def do_GET(self): (scm, netloc, path, params, query, fragment) = urlparse.urlparse( self.path, 'http') if scm not in ('http', 'ftp') or fragment or not netloc: self.send_error(400, "bad url %s" % self.path) return soc = None try: if scm == ...
ValueError
dataset/ETHPy150Open splunk/splunk-sdk-python/examples/handlers/tiny-proxy.py/ProxyHandler.do_GET
2,299
def test_build(self): fault = None try: raise TypeError("Unknown type") except __HOLE__: fault = amf0.build_fault(*sys.exc_info()) self.assertTrue(isinstance(fault, remoting.ErrorFault)) self.assertEqual(fault.level, 'error') self.assertEqual(fau...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/tests/test_gateway.py/FaultTestCase.test_build