Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
8,100
def version(self): com_list = [self.xmlsec, "--version"] pof = Popen(com_list, stderr=PIPE, stdout=PIPE) try: return pof.stdout.read().split(" ")[1] except __HOLE__: return ""
IndexError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/CryptoBackendXmlSec1.version
8,101
def validate_signature(self, signedtext, cert_file, cert_type, node_name, node_id, id_attr): """ Validate signature on XML document. :param signedtext: The XML document as a string :param cert_file: The public key that was used to sign the document :pa...
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/CryptoBackendXmlSec1.validate_signature
8,102
def security_context(conf, debug=None): """ Creates a security context based on the configuration :param conf: The configuration :return: A SecurityContext instance """ if not conf: return None if debug is None: try: debug = conf.debug except AttributeError:...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/security_context
8,103
def _check_signature(self, decoded_xml, item, node_name=NODE_NAME, origdoc=None, id_attr="", must=False, only_valid_cert=False): #print item try: issuer = item.issuer.text.strip() except __HOLE__: issuer = None # ...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/SecurityContext._check_signature
8,104
def correctly_signed_message(self, decoded_xml, msgtype, must=False, origdoc=None, only_valid_cert=False): """Check if a request is correctly signed, if we have metadata for the entity that sent the info use that, if not use the key that are in the message if any...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/SecurityContext.correctly_signed_message
8,105
def test_constants_only(): try: from pants.constants_only.constants import VALID_IDENTIFIERS # noqa except __HOLE__ as e: assert False, 'Failed to correctly generate python package: %s' % e
ImportError
dataset/ETHPy150Open pantsbuild/pants/testprojects/tests/python/pants/constants_only/test_constants_only.py/test_constants_only
8,106
def test_foreign_key_cross_database_protection(self): "Foreign keys can cross databases if they two databases have a common source" # Create a book and author on the default database pro = Book.objects.using('default').create(title="Pro Django", ...
ValueError
dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/RouterTestCase.test_foreign_key_cross_database_protection
8,107
def test_m2m_cross_database_protection(self): "M2M relations can cross databases if the database share a source" # Create books and authors on the inverse to the usual database pro = Book.objects.using('other').create(pk=1, title="Pro Django", pub...
ValueError
dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/RouterTestCase.test_m2m_cross_database_protection
8,108
def test_o2o_cross_database_protection(self): "Operations that involve sharing FK objects across databases raise an error" # Create a user and profile on the default database alice = User.objects.db_manager('default').create_user('alice', '[email protected]') # Create a user and profile...
ValueError
dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/RouterTestCase.test_o2o_cross_database_protection
8,109
def test_generic_key_cross_database_protection(self): "Generic Key operations can span databases if they share a source" # Create a book and author on the default database pro = Book.objects.using( 'default').create(title="Pro Django", published=datetime.date(2008, 12, 16)) ...
ValueError
dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/RouterTestCase.test_generic_key_cross_database_protection
8,110
def get_owtf_transactions(self, hash_list): transactions_dict = None target_list = self.target.GetIndexedTargets() if target_list: # If there are no targets in db, where are we going to add. OMG transactions_dict = {} host_list = self.target.GetAllInScope('host_name') ...
KeyError
dataset/ETHPy150Open owtf/owtf/framework/http/proxy/transaction_logger.py/TransactionLogger.get_owtf_transactions
8,111
def pseudo_run(self): try: while self.poison_q.empty(): if glob.glob(os.path.join(self.cache_dir, "*.rd")): hash_list = self.get_hash_list(self.cache_dir) transactions_dict = self.get_owtf_transactions(hash_list) if transact...
KeyboardInterrupt
dataset/ETHPy150Open owtf/owtf/framework/http/proxy/transaction_logger.py/TransactionLogger.pseudo_run
8,112
def realize(self, args=None, doc=None, progname=None, raise_getopt_errs=True): """Realize a configuration. Optional arguments: args -- the command line arguments, less the program name (default is sys.argv[1:]) doc -- usage message (default...
ValueError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/Options.realize
8,113
def process_config_file(self, do_usage=True): """Process config file.""" if not hasattr(self.configfile, 'read'): self.here = os.path.abspath(os.path.dirname(self.configfile)) set_here(self.here) try: self.read_config(self.configfile) except __HOLE__, ...
ValueError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/Options.process_config_file
8,114
def get_plugins(self, parser, factory_key, section_prefix): factories = [] for section in parser.sections(): if not section.startswith(section_prefix): continue name = section.split(':', 1)[1] factory_spec = parser.saneget(section, factory_key, None) ...
ImportError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/Options.get_plugins
8,115
def read_config(self, fp): # Clear parse warnings, since we may be re-reading the # config a second time after a reload. self.parse_warnings = [] section = self.configroot.supervisord if not hasattr(fp, 'read'): try: fp = open(fp, 'r') exc...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.read_config
8,116
def process_groups_from_parser(self, parser): groups = [] all_sections = parser.sections() homogeneous_exclude = [] get = parser.saneget # process heterogeneous groups for section in all_sections: if not section.startswith('group:'): continue ...
ValueError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.process_groups_from_parser
8,117
def server_configs_from_parser(self, parser): configs = [] inet_serverdefs = self._parse_servernames(parser, 'inet_http_server') for name, section in inet_serverdefs: config = {} get = parser.saneget config.update(self._parse_username_and_password(parser, sect...
TypeError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.server_configs_from_parser
8,118
def daemonize(self): # To daemonize, we need to become the leader of our own session # (process) group. If we do not, signals sent to our # parent process will also be sent to us. This might be bad because # signals such as SIGINT can be sent to our parent process during # nor...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.daemonize
8,119
def write_pidfile(self): pid = os.getpid() try: f = open(self.pidfile, 'w') f.write('%s\n' % pid) f.close() except (IOError, __HOLE__): self.logger.critical('could not write pidfile %s' % self.pidfile) else: self.logger.info('su...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.write_pidfile
8,120
def write_subproc_pidfile(self): if not self.subprocpidfile: return try: f = open(self.subprocpidfile, 'w') for pid, process in self.pidhistory.iteritems(): f.write('%s %d %d\n' % (process.config.name, pid, process.laststart)) f...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.write_subproc_pidfile
8,121
def load_subproc_pidfile(self, process_groups): if not self.subprocpidfile: return resumed_processes = {} try: f = open(self.subprocpidfile, 'r') for line in f: process_name, pid, laststart = line.split() pid = int(pid) last...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.load_subproc_pidfile
8,122
def cleanup(self): try: for config, server in self.httpservers: if config['family'] == socket.AF_UNIX: if self.unlink_socketfiles: socketname = config['file'] try: os.unlink(socketname) ...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.cleanup
8,123
def openhttpservers(self, supervisord): try: self.httpservers = self.make_http_servers(supervisord) except socket.error, why: if why[0] == errno.EADDRINUSE: self.usage('Another program is already listening on ' 'a port that one of our HT...
ValueError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.openhttpservers
8,124
def clear_autochildlogdir(self): # must be called after realize() childlogdir = self.childlogdir fnre = re.compile(r'.+?---%s-\S+\.log\.{0,1}\d{0,4}' % self.identifier) try: filenames = os.listdir(childlogdir) except (__HOLE__, OSError): self.logger.warn('...
IOError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.clear_autochildlogdir
8,125
def cleanup_fds(self): # try to close any leaked file descriptors (for reload) start = 5 for x in range(start, self.minfds): try: os.close(x) except __HOLE__: pass
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.cleanup_fds
8,126
def dropPrivileges(self, user): # Drop root privileges if we have them if user is None: return "No user specified to setuid to!" if os.getuid() != 0: return "Can't drop privilege as nonroot user" try: uid = int(user) except ValueError: ...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.dropPrivileges
8,127
def waitpid(self): # firstly send a signal to all resumed processes to check if they are # still running. resumed process is NOT spawned child process of # supervisord, so the os.waitpid doesn't work. for pid in self.resumed_pids: try: os.kill(pid, 0) ...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.waitpid
8,128
def set_rlimits(self): limits = [] if hasattr(resource, 'RLIMIT_NOFILE'): limits.append( { 'msg':('The minimum number of file descriptors required ' 'to run this process is %(min)s as per the "minfds" ' 'command-li...
ValueError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.set_rlimits
8,129
def close_fd(self, fd): try: os.close(fd) except __HOLE__: pass
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.close_fd
8,130
def readfd(self, fd): try: data = os.read(fd, 2 << 16) # 128K except __HOLE__, why: if why[0] not in (errno.EWOULDBLOCK, errno.EBADF, errno.EINTR): raise data = '' return data
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.readfd
8,131
def make_pipes(self, stderr=True): """ Create pipes for parent to child stdin/stdout/stderr communications. Open fd in nonblocking mode so we can read them in the mainloop without blocking. If stderr is False, don't create a pipe for stderr. """ pipes = {'child_stdin':None, ...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ServerOptions.make_pipes
8,132
def read_config(self, fp): section = self.configroot.supervisorctl if not hasattr(fp, 'read'): self.here = os.path.dirname(normalize_path(fp)) try: fp = open(fp, 'r') except (IOError, __HOLE__): raise ValueError("could not find config f...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/ClientOptions.read_config
8,133
def readFile(filename, offset, length): """ Read length bytes from the file named by filename starting at offset """ absoffset = abs(offset) abslength = abs(length) try: f = open(filename, 'rb') if absoffset != offset: # negative offset returns offset bytes from tail of...
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/readFile
8,134
def tailFile(filename, offset, length): """ Read length bytes from the file named by filename starting at offset, automatically increasing offset and setting overflow flag if log size has grown beyond (offset + length). If length bytes are not available, as many bytes as are available are returned....
OSError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/tailFile
8,135
def expand(s, expansions, name): try: return s % expansions except __HOLE__: raise ValueError( 'Format string %r for %r contains names which cannot be ' 'expanded' % (s, name)) except: raise ValueError( 'Format string %r for %r is badly formatted' ...
KeyError
dataset/ETHPy150Open XiaoMi/minos/supervisor/supervisor/options.py/expand
8,136
def ProcessMessage(self, message): """Begins an enrollment flow for this client. Args: message: The Certificate sent by the client. Note that this message is not authenticated. """ cert = rdf_crypto.Certificate(message.payload) queue = self.well_known_session_id.Queue() client...
KeyError
dataset/ETHPy150Open google/grr/grr/lib/flows/general/ca_enroller.py/Enroler.ProcessMessage
8,137
def getExecutorInfo(self): frameworkDir = os.path.abspath(os.path.dirname(sys.argv[0])) executorPath = os.path.join(frameworkDir, "executor.py") execInfo = mesos_pb2.ExecutorInfo() execInfo.executor_id.value = "default" execInfo.command.value = executorPath v = execInfo....
OSError
dataset/ETHPy150Open douban/dpark/tools/scheduler.py/BaseScheduler.getExecutorInfo
8,138
def unsub_sig(): cherrypy.log("unsubsig: %s" % cherrypy.config.get('unsubsig', False)) if cherrypy.config.get('unsubsig', False): cherrypy.log("Unsubscribing the default cherrypy signal handler") cherrypy.engine.signal_handler.unsubscribe() try: from signal import signal, SIGTERM ...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/test/_test_states_demo.py/unsub_sig
8,139
def _find_all(self, name, attrs, text, limit, generator, **kwargs): "Iterates over a generator looking for things that match." if isinstance(name, SoupStrainer): strainer = name else: strainer = SoupStrainer(name, attrs, text, **kwargs) if text is None and not l...
StopIteration
dataset/ETHPy150Open socketubs/pyhn/pyhn/lib/bs4_py3/element.py/PageElement._find_all
8,140
def select(self, selector, _candidate_generator=None): """Perform a CSS selection operation on the current element.""" tokens = selector.split() current_context = [self] if tokens[-1] in self._selector_combinators: raise ValueError( 'Final combinator "%s" is ...
StopIteration
dataset/ETHPy150Open socketubs/pyhn/pyhn/lib/bs4_py3/element.py/Tag.select
8,141
def handle(self, *args, **options): filings_to_process = new_filing.objects.filter(data_is_processed=True, body_rows_superceded=True).exclude(ie_rows_processed=True).order_by('filing_number') for this_filing in filings_to_process: lines_present = this_filing.lines_present has_ske...
KeyError
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/formdata/management/commands/process_skede_lines.py/Command.handle
8,142
def tokenize_single_comma(val): # XXX we match twice the same string (here and at the caller level). It is # stupid, but it is easier for now... m = r_comattrval.match(val) if m: try: name = m.group(1).strip() type = m.group(2).strip() except __HOLE__: ...
IndexError
dataset/ETHPy150Open scipy/scipy/scipy/io/arff/arffread.py/tokenize_single_comma
8,143
def tokenize_single_wcomma(val): # XXX we match twice the same string (here and at the caller level). It is # stupid, but it is easier for now... m = r_wcomattrval.match(val) if m: try: name = m.group(1).strip() type = m.group(2).strip() except __HOLE__: ...
IndexError
dataset/ETHPy150Open scipy/scipy/scipy/io/arff/arffread.py/tokenize_single_wcomma
8,144
def _loadarff(ofile): # Parse the header file try: rel, attr = read_header(ofile) except __HOLE__ as e: msg = "Error while parsing header, error was: " + str(e) raise ParseArffError(msg) # Check whether we have a string attribute (not supported yet) hasstr = False for na...
ValueError
dataset/ETHPy150Open scipy/scipy/scipy/io/arff/arffread.py/_loadarff
8,145
def _id_from_path(path): try: return path.strip('/').split('/')[-1] except __HOLE__: return ''
IndexError
dataset/ETHPy150Open lektor/lektor/lektor/sourcesearch.py/_id_from_path
8,146
def __new__(cls, name, bases, d): state = d.get('initial_state') if state == None: for base in bases: try: state = base.initial_state break except AttributeError: pass before, after = [], []...
AttributeError
dataset/ETHPy150Open kyleconroy/statemachine/statemachine.py/MetaMachine.__new__
8,147
def create_transition(attr, from_state, to_state): def wrapper(f): try: getattr(f, attr).append((from_state, to_state)) except __HOLE__: setattr(f, attr, [(from_state, to_state)]) return f return wrapper
AttributeError
dataset/ETHPy150Open kyleconroy/statemachine/statemachine.py/create_transition
8,148
def get_mod_class(plugin): """ Converts 'lifestream.plugins.FeedPlugin' to ['lifestream.plugins', 'FeedPlugin'] """ try: dot = plugin.rindex('.') except __HOLE__: return plugin, '' return plugin[:dot], plugin[dot+1:]
ValueError
dataset/ETHPy150Open IanLewis/django-lifestream/lifestream/feeds.py/get_mod_class
8,149
def decodable(seq, encoding): try: u = seq.decode(encoding) except __HOLE__: return False else: return True
UnicodeDecodeError
dataset/ETHPy150Open thomasballinger/curtsies/curtsies/events.py/decodable
8,150
def get_key(bytes_, encoding, keynames='curtsies', full=False): """Return key pressed from bytes_ or None Return a key name or None meaning it's an incomplete sequence of bytes (more bytes needed to determine the key pressed) encoding is how the bytes should be translated to unicode - it should ma...
UnicodeDecodeError
dataset/ETHPy150Open thomasballinger/curtsies/curtsies/events.py/get_key
8,151
def try_keys(): print('press a bunch of keys (not at the same time, but you can hit them pretty quickly)') import tty import termios import fcntl import os from .termhelpers import Cbreak def ask_what_they_pressed(seq, Normal): print('Unidentified character sequence!') with ...
OSError
dataset/ETHPy150Open thomasballinger/curtsies/curtsies/events.py/try_keys
8,152
def main(args): usage = "%prog [-s setupfile] [-o output_file_path] scriptfile [arg] ..." parser = optparse.OptionParser(usage=usage, version="%prog 1.0b2") parser.allow_interspersed_args = False parser.add_option('-l', '--line-by-line', action='store_true', help="Use the line-by-line profiler f...
SystemExit
dataset/ETHPy150Open certik/line_profiler/kernprof.py/main
8,153
@staticmethod def fromphases(p): for scm, phasename in p: try: parserforphase = inputparser.fromphase(phasename) if parserforphase.scm() == scm: return parserforphase else: continue except __HOLE_...
NotImplementedError
dataset/ETHPy150Open charignon/hooklib/hooklib_input.py/inputparser.fromphases
8,154
@staticmethod def fromphase(phase): """Factory method to return an appropriate input parser For example if the phase is 'post-update' and that the git env variables are set, we infer that we need a git postupdate inputparser""" phasemapping = { None: dummyinputpar...
KeyError
dataset/ETHPy150Open charignon/hooklib/hooklib_input.py/inputparser.fromphase
8,155
@register.tag(name='change_currency') def change_currency(parser, token): try: tag_name, current_price, new_currency = token.split_contents() except __HOLE__: tag_name = token.contents.split()[0] raise template.TemplateSyntaxError('%r tag requires exactly two arguments' % (tag_name)) ...
ValueError
dataset/ETHPy150Open panosl/django-currencies/currencies/templatetags/currency.py/change_currency
8,156
def load_template_source(template_name, template_dirs=None): """ Give capability to load template from specific directory """ try: return open(template_name).read(), template_name except __HOLE__: raise TemplateDoesNotExist, template_name
IOError
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/libraries/adlibre/freeloader.py/load_template_source
8,157
def __call__(self, values): """Runs through each value and transform it with a mapped function.""" values = product(values, self._map) for value in map(self._mapped_func, filter(self._cmp_filter, values)): if isinstance(value, tuple) and len(value) == 2: yield value ...
TypeError
dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/plugin/api/mapper.py/StreamMapper.__call__
8,158
def _get_fibre_image(network, cpores, vox_len, fibre_rad): r""" Produce image by filling in voxels along throat edges using Bresenham line Then performing distance transform on fibre voxels to erode the pore space """ cthroats = network.find_neighbor_throats(pores=cpores) # Below method copied...
IndexError
dataset/ETHPy150Open PMEAL/OpenPNM/OpenPNM/Geometry/models/pore_volume.py/_get_fibre_image
8,159
def in_hull_volume(network, geometry, fibre_rad, vox_len=1e-6, **kwargs): r""" Work out the voxels inside the convex hull of the voronoi vertices of each pore """ Np = network.num_pores() geom_pores = geometry.map_pores(network, geometry.pores()) volume = _sp.zeros(Np) pore_vox = _sp.zer...
KeyError
dataset/ETHPy150Open PMEAL/OpenPNM/OpenPNM/Geometry/models/pore_volume.py/in_hull_volume
8,160
def get(name): try: return registry[name] except __HOLE__: raise KeyError( "Object named '{}' is not registered in ramses " "registry".format(name))
KeyError
dataset/ETHPy150Open ramses-tech/ramses/ramses/registry.py/get
8,161
@rest_api.post('/imagefactory/<image_collection>') @rest_api.post('/imagefactory/base_images/<base_image_id>/<image_collection>') @rest_api.post('/imagefactory/base_images/<base_image_id>/target_images/<target_image_id>/<image_collection>') @rest_api.post('/imagefactory/target_images/<target_image_id>/<image_collection...
KeyError
dataset/ETHPy150Open redhat-imaging/imagefactory/imgfac/rest/RESTv2.py/create_image
8,162
@rest_api.get('/imagefactory/<collection_type>/<image_id>') @rest_api.get('/imagefactory/base_images/<base_image_id>/<collection_type>/<image_id>') @rest_api.get('/imagefactory/base_images/<base_image_id>/target_images/<target_image_id>/<collection_type>/<image_id>') @rest_api.get('/imagefactory/target_images/<target_i...
IndexError
dataset/ETHPy150Open redhat-imaging/imagefactory/imgfac/rest/RESTv2.py/image_with_id
8,163
def set_indent(self, indent): try: self._indent = int(indent) except __HOLE__: raise ValueError("Cannot convert indent value '%s' to an integer" % indent)
ValueError
dataset/ETHPy150Open ombre42/robotframework-sudslibrary/src/SudsLibrary/soaplogging.py/_SoapLogger.set_indent
8,164
def mkdirs(path): if not os.path.isdir(path): try: os.makedirs(path) except __HOLE__ as err: if err.errno != errno.EEXIST or not os.path.isdir(path): raise
OSError
dataset/ETHPy150Open zerovm/zerovm-cli/zvshlib/tests/functional/tests.py/mkdirs
8,165
def safe_decode(text, incoming=None, errors='strict'): """Decodes incoming str using `incoming` if they're not already unicode. :param incoming: Text's current encoding :param errors: Errors handling policy. See here for valid values http://docs.python.org/2/library/codecs.html :returns: text o...
UnicodeDecodeError
dataset/ETHPy150Open openstack/python-monascaclient/monascaclient/openstack/common/strutils.py/safe_decode
8,166
def get_price_filters(category, product_filter, price_filter, manufacturer_filter): """ Creates price filter based on the min and max prices of the category's products """ # If a price filter is set we return just this. if price_filter: return { "show_reset": True, ...
TypeError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/utils.py/get_price_filters
8,167
def get_product_filters(category, product_filter, price_filter, manufacturer_filter, sorting): """Returns the next product filters based on products which are in the given category and within the result set of the current filters. """ mapping_manager = MappingCache() properties_mapping = get_proper...
TypeError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/utils.py/get_product_filters
8,168
def _calculate_steps(product_ids, property, min, max): """Calculates filter steps. **Parameters** product_ids The product_ids for which the steps are calculated. List of ids. property The property for which the steps are calculated. Instance of Property. min / max The min...
IndexError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/utils.py/_calculate_steps
8,169
def get_client(hub=None, **kwargs): hub = hub or get_event_loop() try: return hub._current_http_client except __HOLE__: client = hub._current_http_client = Client(hub, **kwargs) return client
AttributeError
dataset/ETHPy150Open celery/kombu/kombu/async/http/__init__.py/get_client
8,170
def _get_win_folder_with_pywin32(csidl_name): from win32com.shell import shellcon, shell dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0) # Try to make this a unicode path because SHGetFolderPath does # not return unicode strings when there is unicode data in the # path. try: ...
ImportError
dataset/ETHPy150Open ODM2/ODMToolsPython/odmtools/lib/Appdirs/appdirs.py/_get_win_folder_with_pywin32
8,171
def draw_title(self, universe, game_state): self.score.delete("title") if not game_state: return center = self.mesh_graph.screen_width // 2 try: team_time = game_state["team_time"] except (KeyError, TypeError): team_time = [0, 0] lef...
TypeError
dataset/ETHPy150Open ASPP/pelita/pelita/ui/tk_canvas.py/UiCanvas.draw_title
8,172
def draw_maze(self, universe): if not self.size_changed: return self.canvas.delete("wall") for position, wall in universe.maze.items(): model_x, model_y = position if wall: wall_item = Wall(self.mesh_graph, model_x, model_y) wal...
IndexError
dataset/ETHPy150Open ASPP/pelita/pelita/ui/tk_canvas.py/UiCanvas.draw_maze
8,173
def _after(self, delay, fun, *args): """ Execute fun(*args) after delay milliseconds. # Patched to quit after `KeyboardInterrupt`s. """ def wrapped_fun(): try: fun(*args) except __HOLE__: _logger.info("Detected KeyboardInterrupt. E...
KeyboardInterrupt
dataset/ETHPy150Open ASPP/pelita/pelita/ui/tk_canvas.py/TkApplication._after
8,174
def _check_speed_button_state(self): try: # self.ui_canvas.button_game_speed_faster # may not be available yet (or may be None). # If this is the case, we’ll do nothing at all. if self._delay <= self._min_delay: self.ui_canvas.button_game_speed_fas...
AttributeError
dataset/ETHPy150Open ASPP/pelita/pelita/ui/tk_canvas.py/TkApplication._check_speed_button_state
8,175
def _get_storage_path(path, app_id): """Returns a path to the directory where stub data can be stored.""" _, _, app_id = app_id.replace(':', '_').rpartition('~') if path is None: for path in _generate_storage_paths(app_id): try: os.mkdir(path, 0700) except __HOLE__, e: if e.errno =...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/_get_storage_path
8,176
def __call__(self, value): try: port = int(value) except __HOLE__: raise argparse.ArgumentTypeError('Invalid port: %r' % value) if port < self._min_port or port >= (1 << 16): raise argparse.ArgumentTypeError('Invalid port: %d' % port) return port
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/PortParser.__call__
8,177
def parse_per_module_option( value, value_type, value_predicate, single_bad_type_error, single_bad_predicate_error, multiple_bad_type_error, multiple_bad_predicate_error, multiple_duplicate_module_error): """Parses command line options that may be specified per-module. Args: value: A str contai...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/parse_per_module_option
8,178
def _clear_datastore_storage(datastore_path): """Delete the datastore storage file at the given path.""" # lexists() returns True for broken symlinks, where exists() returns False. if os.path.lexists(datastore_path): try: os.remove(datastore_path) except __HOLE__, e: logging.warning('Failed to...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/_clear_datastore_storage
8,179
def _clear_prospective_search_storage(prospective_search_path): """Delete the perspective search storage file at the given path.""" # lexists() returns True for broken symlinks, where exists() returns False. if os.path.lexists(prospective_search_path): try: os.remove(prospective_search_path) except ...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/_clear_prospective_search_storage
8,180
def _clear_search_indexes_storage(search_index_path): """Delete the search indexes storage file at the given path.""" # lexists() returns True for broken symlinks, where exists() returns False. if os.path.lexists(search_index_path): try: os.remove(search_index_path) except __HOLE__, e: logging...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/devappserver2.py/_clear_search_indexes_storage
8,181
def delete(self, name): try: del self.values[name] except __HOLE__: pass else: self.mutated()
KeyError
dataset/ETHPy150Open topazproject/topaz/topaz/celldict.py/CellDict.delete
8,182
def render(self, context): from django.utils.text import normalize_newlines import base64 context.push() if self.obj_id_lookup_var is not None: try: self.obj_id = template.resolve_variable(self.obj_id_lookup_var, context) except template.VariableDo...
ObjectDoesNotExist
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/templatetags/comments.py/CommentFormNode.render
8,183
def __call__(self, parser, token): tokens = token.contents.split() if len(tokens) < 4: raise template.TemplateSyntaxError, "%r tag requires at least 3 arguments" % tokens[0] if tokens[1] != 'for': raise template.TemplateSyntaxError, "Second argument in %r tag must be 'for...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/templatetags/comments.py/DoCommentForm.__call__
8,184
def __call__(self, parser, token): tokens = token.contents.split() # Now tokens is a list like this: # ['get_comment_list', 'for', 'lcom.eventtimes', 'event.id', 'as', 'comment_list'] if len(tokens) != 6: raise template.TemplateSyntaxError, "%r tag requires 5 arguments" % tok...
ObjectDoesNotExist
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/templatetags/comments.py/DoCommentCount.__call__
8,185
def __call__(self, parser, token): tokens = token.contents.split() # Now tokens is a list like this: # ['get_comment_list', 'for', 'lcom.eventtimes', 'event.id', 'as', 'comment_list'] if not len(tokens) in (6, 7): raise template.TemplateSyntaxError, "%r tag requires 5 or 6 ar...
ObjectDoesNotExist
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/templatetags/comments.py/DoGetCommentList.__call__
8,186
def __call__(self, admin_class, request, queryset): errors = defaultdict(list) successfully_executed = [] for instance in queryset: try: self.validate(instance) except __HOLE__ as e: errors[str(e)].append(instance) else: ...
ValidationError
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/core/admin.py/ExecutorAdminAction.__call__
8,187
def doPrivmsg(self, irc, msg): if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg): return if irc.isChannel(msg.args[0]): channel = msg.args[0] said = ircmsgs.prettyPrint(msg) self.db.update(channel, msg.nick, said) self.anydb.update(channel, ...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen.doPrivmsg
8,188
def doPart(self, irc, msg): channel = msg.args[0] said = ircmsgs.prettyPrint(msg) self.anydb.update(channel, msg.nick, said) try: id = ircdb.users.getUserId(msg.prefix) self.anydb.update(channel, id, said) except __HOLE__: pass # Not in the dat...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen.doPart
8,189
def doQuit(self, irc, msg): said = ircmsgs.prettyPrint(msg) try: id = ircdb.users.getUserId(msg.prefix) except __HOLE__: id = None # Not in the database. for channel in msg.tagged('channels'): self.anydb.update(channel, msg.nick, said) if i...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen.doQuit
8,190
def doMode(self, irc, msg): # Filter out messages from network Services if msg.nick: try: id = ircdb.users.getUserId(msg.prefix) except __HOLE__: id = None # Not in the database. channel = msg.args[0] said = ircmsgs.prettyPr...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen.doMode
8,191
def _seen(self, irc, channel, name, any=False): if any: db = self.anydb else: db = self.db try: results = [] if '*' in name: if (len(name.replace('*', '')) < self.registryValue('minimumNonWildcard', channel))...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen._seen
8,192
def _last(self, irc, channel, any=False): if any: db = self.anydb else: db = self.db try: (when, said) = db.seen(channel, '<last>') reply = format(_('Someone was last seen in %s %s ago'), channel, utils.timeElapsed(time...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen._last
8,193
def _user(self, irc, channel, user, any=False): if any: db = self.anydb else: db = self.db try: (when, said) = db.seen(channel, user.id) reply = format(_('%s was last seen in %s %s ago'), user.name, channel, ...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Seen/plugin.py/Seen._user
8,194
def AppendSource(self, type_indicator, attributes): """Appends a source. If you want to implement your own source type you should create a subclass in source_type.py and change the AppendSource method to handle the new subclass. This function raises FormatError if an unsupported source type indicat...
TypeError
dataset/ETHPy150Open ForensicArtifacts/artifacts/artifacts/artifact.py/ArtifactDefinition.AppendSource
8,195
def find_duplicates(files): primary = files[0] others = files[1:len(files)] for package in primary['packages'].copy(): for other in others: otherpacks = other['packages'] try: dupe = otherpacks[package] except __HOLE__: pass ...
KeyError
dataset/ETHPy150Open hactar-is/olaf/olaf/cli.py/find_duplicates
8,196
def add_installed(files, unreqed): unique = [dict(y) for y in set(tuple(x.items()) for x in unreqed)] for package_d in unique: for package, version in package_d.items(): # import pdb; pdb.set_trace() click.echo( u'{} is installed but not in any requirements file'....
IndexError
dataset/ETHPy150Open hactar-is/olaf/olaf/cli.py/add_installed
8,197
def jam(filename): packages = {} try: with open(filename, 'r') as infile: infile.seek(0) for line in infile.readlines(): if line.startswith(u'-e '): package, version = (line.strip(), '') packages[package] = version ...
IOError
dataset/ETHPy150Open hactar-is/olaf/olaf/cli.py/jam
8,198
def rewrite(req): try: with open(req['name'], 'w') as outfile: outfile.seek(0) outfile.truncate() packages = collections.OrderedDict( sorted(req['packages'].items(), key=lambda t: str(t[0])) ) for k, v in packages.items(): ...
IOError
dataset/ETHPy150Open hactar-is/olaf/olaf/cli.py/rewrite
8,199
def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured(__opts__, __active_provider_name__ or 'vsp...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/vsphere.py/create