Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
9,100
def has_key(self, key): try: value = self[key] except __HOLE__: return False return True
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob_0_9/webob/util/dictmixin.py/DictMixin.has_key
9,101
def setdefault(self, key, default=None): try: return self[key] except __HOLE__: self[key] = default return default
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob_0_9/webob/util/dictmixin.py/DictMixin.setdefault
9,102
def pop(self, key, *args): if len(args) > 1: raise TypeError, "pop expected at most 2 arguments, got "\ + repr(1 + len(args)) try: value = self[key] except __HOLE__: if args: return ...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob_0_9/webob/util/dictmixin.py/DictMixin.pop
9,103
def popitem(self): try: k, v = self.iteritems().next() except __HOLE__: raise KeyError, 'container is empty' del self[k] return (k, v)
StopIteration
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob_0_9/webob/util/dictmixin.py/DictMixin.popitem
9,104
def get(self, key, default=None): try: return self[key] except __HOLE__: return default
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webob_0_9/webob/util/dictmixin.py/DictMixin.get
9,105
def changed(self, originally_changed): Specification.changed(self, originally_changed) try: del self._v_attrs except __HOLE__: pass
AttributeError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/zope/zope/interface/declarations.py/Declaration.changed
9,106
def implementedByFallback(cls): """Return the interfaces implemented for a class' instances The value returned is an IDeclaration. for example: >>> from zope.interface import Interface >>> class I1(Interface): pass ... >>> class I2(I1): pass ... >>> cla...
AttributeError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/zope/zope/interface/declarations.py/implementedByFallback
9,107
def __call__(self, ob): if isinstance(ob, DescriptorAwareMetaClasses): classImplements(ob, *self.interfaces) return ob spec = Implements(*self.interfaces) try: ob.__implemented__ = spec except __HOLE__: raise TypeError(...
AttributeError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/zope/zope/interface/declarations.py/implementer.__call__
9,108
def getObjectSpecification(ob): provides = getattr(ob, '__provides__', None) if provides is not None: if isinstance(provides, SpecificationBase): return provides try: cls = ob.__class__ except __HOLE__: # We can't get the class, so just consider provides ret...
AttributeError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/zope/zope/interface/declarations.py/getObjectSpecification
9,109
def providedBy(ob): # Here we have either a special object, an old-style declaration # or a descriptor # Try to get __providedBy__ try: r = ob.__providedBy__ except AttributeError: # Not set yet. Fall back to lower-level thing that computes it return getObjectSpecification(...
AttributeError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/zope/zope/interface/declarations.py/providedBy
9,110
def find_reverse(self, string, region): new_regions = (r for r in reversed(self.view.find_all(string)) if r.begin() < region.end()) try: if sys.version_info < (3,0,0) : new_region = new_regions.next() else : new_region = next(new_region...
StopIteration
dataset/ETHPy150Open Pephers/Super-Calculator/Super Calculator.py/SuperCalculatorCommand.find_reverse
9,111
def main(logfile): p = hotshot.Profile(logfile) benchtime, stones = p.runcall(test.pystone.pystones) p.close() print "Pystone(%s) time for %d passes = %g" % \ (test.pystone.__version__, test.pystone.LOOPS, benchtime) print "This machine benchmarks at %g pystones/second" % stones ...
IOError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/hotshot/stones.py/main
9,112
def _request_while(self, option_name, options, kls, default_option, one_line_options=False): str_list_options = "" if options: str_list_options = "(/o list options)" while True: #logger.debug("Request to user...") str_ = '' if not default_option: ...
AttributeError
dataset/ETHPy150Open biicode/client/shell/userio.py/UserIO._request_while
9,113
def new_frame(self, *args): # args must be filename, firstlineno, funcname # our code objects are cached since we don't need to create # new ones every time try: code = self._code[args] except __HOLE__: code = FakeCode(*args) self._code...
KeyError
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/hotshot/stats.py/StatsLoader.new_frame
9,114
def daemonize(self): ''' do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 ''' try: pid = os.fork() if pid > 0: ...
OSError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/Daemon.daemonize
9,115
def start(self): ''' Start the daemon ''' # Check for a pidfile to see if the daemon already runs try: pidf = file(self.pidfile, 'r') pid = int(pidf.read().strip()) pidf.close() except __HOLE__: pid = None if pid: ...
IOError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/Daemon.start
9,116
def stop(self, signal, frame): ''' We override stop() to brake our main loop and have a pretty log message ''' log.info("Received signal {0}".format(signal)) # if we have running workers, run through all and join() the ones # that have finished. if we still have ...
OSError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/SaltEventsDaemon.stop
9,117
def listen(self): ''' The main event loop where we receive the events and start the workers that dump our data into the database ''' # log on to saltstacks event-bus event = salt.utils.event.SaltEvent( self.node, self.sock_dir, ) #...
KeyboardInterrupt
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/SaltEventsDaemon.listen
9,118
def _get_pid(self): ''' Get our current pid from the pidfile and fall back to os.getpid() if pidfile not present (in foreground mode) ''' pid = None try: pidf = file(self.pidfile, 'r') pid = int(pidf.read().strip()) pidf.close() ...
IOError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/SaltEventsDaemon._get_pid
9,119
def _write_state(self): ''' Writes a current status to the defined status-file this includes the current pid, events received/handled and threads created/joined ''' ev_hdl_per_s = float((float(self.events_han - self.stat_hdl_count)) / float(self.state_timer_intrvl)) ...
AttributeError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/SaltEventsDaemon._write_state
9,120
def _init_events(self, events={}): ''' Creates a dict of precompiled regexes for all defined events from config for maximum performance. ''' self.event_map = events # we precompile all regexes log.info("Initialising events...") for key in events.keys(): ...
KeyError
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/daemon.py/SaltEventsDaemon._init_events
9,121
def param_rischDE(fa, fd, G, DE): """ Solve a Parametric Risch Differential Equation: Dy + f*y == Sum(ci*Gi, (i, 1, m)). """ _, (fa, fd) = weak_normalizer(fa, fd, DE) a, (ba, bd), G, hn = prde_normal_denom(ga, gd, G, DE) A, B, G, hs = prde_special_denom(a, ba, bd, G, DE) g = gcd(A, B) A,...
NotImplementedError
dataset/ETHPy150Open sympy/sympy/sympy/integrals/prde.py/param_rischDE
9,122
def _initialize_testr(self): if not os.path.isdir(self.path(".testrepository")): LOG.debug("Initialization of 'testr'.") cmd = ["testr", "init"] if self.venv_wrapper: cmd.insert(0, self.venv_wrapper) try: check_output(cmd, cwd=self....
OSError
dataset/ETHPy150Open openstack/rally/rally/verification/tempest/tempest.py/Tempest._initialize_testr
9,123
def setup_server_socket(self, interface='localhost', port=5050): """Sets up the socket listener. Args: interface: String name of which interface this socket will listen on. port: Integer TCP port number the socket will listen on. """ self.socket ...
IOError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/bcp_server.py/BCPServer.setup_server_socket
9,124
def sending_loop(self): """Sending loop which transmits data from the sending queue to the remote socket. This method is run as a thread. """ try: while not self.done: msg = self.sending_queue.get() if not msg.startswith('dmd_frame'):...
AttributeError
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/bcp_server.py/BCPServer.sending_loop
9,125
def exists(self, name): # Try to retrieve file info. Return true on success, false on failure. remote_path = self._remote_path(name) try: self.sftp.stat(remote_path) return True except __HOLE__: return False
IOError
dataset/ETHPy150Open jschneier/django-storages/storages/backends/sftpstorage.py/SFTPStorage.exists
9,126
def str_encode(value, encoder='base64'): ''' .. versionadded:: 2014.7.0 value The value to be encoded. encoder : base64 The encoder to use on the subsequent string. CLI Example: .. code-block:: bash salt '*' random.str_encode 'I am a new string' base64 ''' tr...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/modules/mod_random.py/str_encode
9,127
def _iter_filter(root_dir, data_dict): root_fragment = os.path.join(root_dir, 'pex/') pex_fragment = '/%s/_pex/' % PEXBuilder.BOOTSTRAP_DIR for filename, records in data_dict.items(): # already acceptable coverage if filename.startswith(root_fragment): yield (filename, dict((record, None) for recor...
ValueError
dataset/ETHPy150Open pantsbuild/pex/scripts/combine_coverage.py/_iter_filter
9,128
def fix_attachlist(font): """Fix duplicate attachment points in GDEF table.""" modified = False try: attach_points = font['GDEF'].table.AttachList.AttachPoint except (__HOLE__, AttributeError): attach_points = [] for attach_point in attach_points: points = sorted(set(attach_...
KeyError
dataset/ETHPy150Open googlei18n/nototools/nototools/autofix_for_release.py/fix_attachlist
9,129
def get_converter(convertor): """function for decoration of convert """ def decorator_selector(data_type, data): convert = None if data_type in LITERAL_DATA_TYPES: if data_type == 'string': convert = convert_string elif data_type == 'integer': ...
ValueError
dataset/ETHPy150Open geopython/pywps/pywps/inout/literaltypes.py/get_converter
9,130
def ServeFromZipFile(self, zipfilename, name): """Helper for the GET request handler. This serves the contents of file 'name' from zipfile 'zipfilename', logging a message and returning a 404 response if either the zipfile cannot be opened or the named file cannot be read from it. Args: ...
RuntimeError
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/zipserve/__init__.py/ZipHandler.ServeFromZipFile
9,131
def read( self, line ): """read gff entry from line. <seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments] """ data = line[:-1].split("\t") try: (self.contig, self.source, self.feature, self.start, ...
ValueError
dataset/ETHPy150Open CGATOxford/cgat/obsolete/GFF.py/Entry.read
9,132
def __parseInfo( self, attributes, line ): """parse attributes. """ # remove comments attributes = attributes.split( "#" )[0] # separate into fields fields = map( lambda x: x.strip(), attributes.split(";")[:-1]) self.mAttributes = {} for f in fields: ...
TypeError
dataset/ETHPy150Open CGATOxford/cgat/obsolete/GFF.py/Entry.__parseInfo
9,133
def do_X(self, callbackMethod, *args, **kwargs): if self.path == '/': callback = SupyIndex() elif self.path in ('/robots.txt',): callback = Static('text/plain; charset=utf-8') elif self.path in ('/default.css',): callback = Static('text/css') elif self...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/src/httpserver.py/SupyHTTPRequestHandler.do_X
9,134
def doGetOrHead(self, handler, path, write_content): response = None file_path = conf.supybot.servers.http.favicon() if file_path: try: icon = open(file_path, 'rb') response = icon.read() except __HOLE__: pass fi...
IOError
dataset/ETHPy150Open ProgVal/Limnoria/src/httpserver.py/Favicon.doGetOrHead
9,135
def _timestamp_from_dirname(self, dir_name): if not os.path.isdir(dir_name): raise Skip('its not a build directory', dir_name) try: # Parse the timestamp from the directory name date_str = os.path.basename(dir_name) time_tuple = time.strptime(date_str, se...
ValueError
dataset/ETHPy150Open serverdensity/sd-agent/checks.d/jenkins.py/Jenkins._timestamp_from_dirname
9,136
def _get_build_metadata(self, dir_name, watermark): if os.path.exists(os.path.join(dir_name, 'jenkins_build.tar.gz')): raise Skip('the build has already been archived', dir_name) timestamp = self._timestamp_from_dirname(dir_name) # This is not the latest build if timestamp is...
ValueError
dataset/ETHPy150Open serverdensity/sd-agent/checks.d/jenkins.py/Jenkins._get_build_metadata
9,137
def _get_build_results(self, instance_key, job_dir): job_name = os.path.basename(job_dir) try: dirs = glob(os.path.join(job_dir, 'builds', '*_*')) # Before Jenkins v1.597 the build folders were named with a timestamp (eg: 2015-03-10_19-59-29) # Starting from Jenkins v...
ValueError
dataset/ETHPy150Open serverdensity/sd-agent/checks.d/jenkins.py/Jenkins._get_build_results
9,138
def main(): setupLogging() args = parseArguments() # read the config file try: with open(args.file, "r") as config_file: config = json.load(config_file) except __HOLE__: print "Error opening file " + args.file return # default start date is N...
IOError
dataset/ETHPy150Open prelert/engine-python/elk_connector/elk_connector.py/main
9,139
def is_running(pid): try: kill(pid, 0) except __HOLE__ as error: if error.errno == ESRCH: return False return True
OSError
dataset/ETHPy150Open circuits/circuits/tests/core/test_signals.py/is_running
9,140
def upsidedown_game(g, smallmap=False, flipbuttons=False, flipsounds=False): """Turn a game upside down. This modifies the game in-place. Args: g: The Game to turn upside down. smallmap: True if the gfx/map shared region is used as gfx, False otherwise. flipbuttons: If True, reve...
StopIteration
dataset/ETHPy150Open dansanderson/picotool/pico8/demos/upsidedown.py/upsidedown_game
9,141
def __getattr__(self, key): try: return object.__getattr__(self, key) except AttributeError: try: return super(Leaf, self).__getitem__(self._get_key(key)) except __HOLE__: raise AttributeError()
KeyError
dataset/ETHPy150Open gsi-upm/senpy/senpy/models.py/Leaf.__getattr__
9,142
def __setattr__(self, key, value): try: object.__getattr__(self, key) object.__setattr__(self, key, value) except AttributeError: key = self._get_key(key) if key == "@context": value = self.get_context(value) elif key == "@id": ...
KeyError
dataset/ETHPy150Open gsi-upm/senpy/senpy/models.py/Leaf.__setattr__
9,143
@staticmethod def get_context(context): if isinstance(context, list): contexts = [] for c in context: contexts.append(Response.get_context(c)) return contexts elif isinstance(context, dict): return context elif isinstance(contex...
IOError
dataset/ETHPy150Open gsi-upm/senpy/senpy/models.py/Leaf.get_context
9,144
def __getstate__(self): state = styles.Versioned.__getstate__(self) for k in ('client', '_isOnline', '_isConnecting'): try: del state[k] except __HOLE__: pass return state
KeyError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/im/basesupport.py/AbstractAccount.__getstate__
9,145
def get_module_callables(mod, ignore=None): """Returns two maps of (*types*, *funcs*) from *mod*, optionally ignoring based on the :class:`bool` return value of the *ignore* callable. *mod* can be a string name of a module in :data:`sys.modules` or the module instance itself. """ if isinstance(m...
AttributeError
dataset/ETHPy150Open mahmoud/boltons/boltons/funcutils.py/get_module_callables
9,146
def __get__(self, obj, obj_type): # These assignments could've been in __init__, but there was # no simple way to do it without breaking one of PyPy or Py3. self.__name__ = None self.__doc__ = self.func.__doc__ self.__module__ = self.func.__module__ name = self.__name__ ...
KeyError
dataset/ETHPy150Open mahmoud/boltons/boltons/funcutils.py/CachedInstancePartial.__get__
9,147
def __init__(self, config): super(AuthAction, self).__init__(config) try: ikey = self.config['auth']['ikey'] skey = self.config['auth']['skey'] host = self.config['auth']['host'] except __HOLE__: raise ValueError("Duo config not found in config.")...
KeyError
dataset/ETHPy150Open StackStorm/st2contrib/packs/duo/actions/lib/actions.py/AuthAction.__init__
9,148
def _parse(self, body, action): try: body = body[action] group_name = body['name'] except TypeError: msg = _("Missing parameter dict") raise webob.exc.HTTPBadRequest(explanation=msg) except __HOLE__: msg = _("Security group not specifie...
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/security_groups.py/SecurityGroupActionController._parse
9,149
def _extend_servers(self, req, servers): # TODO(arosen) this function should be refactored to reduce duplicate # code and use get_instance_security_groups instead of get_db_instance. if not len(servers): return key = "security_groups" context = _authorize_context(req)...
ValueError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/security_groups.py/SecurityGroupsOutputController._extend_servers
9,150
def get_data(self): json_string = self.get_json() try: data = json.loads(json_string) except (__HOLE__, TypeError): self.log.exception("Error parsing json from postfix-stats") return None return data
ValueError
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/postfix/postfix.py/PostfixCollector.get_data
9,151
@internationalizeDocstring def list(self, irc, msg, args, optlist, glob): """[--capability=<capability>] [<glob>] Returns the valid registered usernames matching <glob>. If <glob> is not given, returns all registered usernames. """ predicates = [] for (option, arg) ...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.list
9,152
@internationalizeDocstring def register(self, irc, msg, args, name, password): """<name> <password> Registers <name> with the given password <password> and the current hostmask of the person registering. You shouldn't register twice; if you're not recognized as a user but you've al...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.register
9,153
@internationalizeDocstring def unregister(self, irc, msg, args, user, password): """<name> [<password>] Unregisters <name> from the user database. If the user giving this command is an owner user, the password is not necessary. """ try: caller = ircdb.users.getU...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.unregister
9,154
@internationalizeDocstring def changename(self, irc, msg, args, user, newname, password): """<name> <new name> [<password>] Changes your current user database name to the new name given. <password> is only necessary if the user isn't recognized by hostmask. This message must be sent...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.changename
9,155
@internationalizeDocstring def password(self, irc, msg, args, user, password, newpassword): """[<name>] <old password> <new password> Sets the new password for the user specified by <name> to <new password>. Obviously this message must be sent to the bot privatel...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.set.password
9,156
@internationalizeDocstring def username(self, irc, msg, args, hostmask): """<hostmask|nick> Returns the username of the user specified by <hostmask> or <nick> if the user is registered. """ if ircutils.isNick(hostmask): try: hostmask = irc.state.n...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.username
9,157
@internationalizeDocstring def list(self, irc, msg, args, name): """[<name>] Returns the hostmasks of the user specified by <name>; if <name> isn't specified, returns the hostmasks of the user calling the command. """ def getHostmasks(user...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.hostmask.list
9,158
@internationalizeDocstring def add(self, irc, msg, args, user, hostmask, password): """[<name>] [<hostmask>] [<password>] Adds the hostmask <hostmask> to the user specified by <name>. The <password> may only be required if the user is not recognized by hostmask....
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.hostmask.add
9,159
@internationalizeDocstring def remove(self, irc, msg, args, user, hostmask, password): """[<name>] [<hostmask>] [<password>] Removes the hostmask <hostmask> from the record of the user specified by <name>. If the hostmask given is 'all' then all hostmasks will b...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.hostmask.remove
9,160
@internationalizeDocstring def capabilities(self, irc, msg, args, user): """[<name>] Returns the capabilities of the user specified by <name>; if <name> isn't specified, returns the capabilities of the user calling the command. """ try: u = ircdb.users.ge...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.capabilities
9,161
@internationalizeDocstring def identify(self, irc, msg, args, user, password): """<name> <password> Identifies the user as <name>. This command (and all other commands that include a password) must be sent to the bot privately, not in a channel. """ if user.checkPass...
ValueError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.identify
9,162
@internationalizeDocstring def whoami(self, irc, msg, args): """takes no arguments Returns the name of the user calling the command. """ try: user = ircdb.users.getUser(msg.prefix) irc.reply(user.name) except __HOLE__: irc.reply(_('I don\'...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.whoami
9,163
@internationalizeDocstring def stats(self, irc, msg, args): """takes no arguments Returns some statistics on the user database. """ users = 0 owners = 0 admins = 0 hostmasks = 0 for user in ircdb.users.values(): users += 1 host...
KeyError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/User/plugin.py/User.stats
9,164
def run_test(args, i, t): out = {} outdir = None if args.force_test_tool: t["tool"] = args.force_test_tool if t["tool"].split("/")[-1] != re.sub("\-test\.yaml$", ".cwl",args.test.split("/")[-1]): raise CompareFail("%s != %s" % (t["tool"].split("/")[-1],re.sub("\-test\.yaml$",".cwl",args...
ValueError
dataset/ETHPy150Open common-workflow-language/workflows/test/cwltest.py/run_test
9,165
@utils.accept_singleton(basestring) @utils.empty_arg_shortcircuit(return_code='{}') def upload(self, filepaths, transcode_quality='320k', enable_matching=False): """Uploads the given filepaths. All non-mp3 files will be transcoded before being uploaded. This is a limitation of Google's ...
ValueError
dataset/ETHPy150Open simon-weber/gmusicapi/gmusicapi/clients/musicmanager.py/Musicmanager.upload
9,166
def configure_cache_backend(self, value): if value is None: # DEFAULT_CACHE_ALIAS doesn't exist in Django<=1.2 try: from django.core.cache import DEFAULT_CACHE_ALIAS as default_cache_alias except ImportError: default_cache_alias = 'default' ...
ImportError
dataset/ETHPy150Open matthewwithanm/django-imagekit/imagekit/conf.py/ImageKitConf.configure_cache_backend
9,167
def cache_authenticate(self): cookie = "" try: f = open(".rt_cache", "r") cookie = f.read().strip() except __HOLE__: return None if not(self.cert_check(RTConnect.RT_URL,443)): print "SSL Failed! Something is wrong!" return 0 ...
IOError
dataset/ETHPy150Open maxburkhardt/nessus-parser/util/rt.py/RTConnect.cache_authenticate
9,168
def process_record(self, new, old=None): """Validate records against collection schema, if any.""" new = super(Record, self).process_record(new, old) schema = self._collection.get('schema') settings = self.request.registry.settings schema_validation = 'experimental_collection_sc...
AttributeError
dataset/ETHPy150Open Kinto/kinto/kinto/views/records.py/Record.process_record
9,169
def store(self, response): """ Takes an HTTP response object and stores it in the cache according to RFC 2616. Returns a boolean value indicating whether the response was cached or not. :param response: Requests :class:`Response <Response>` object to cache. """ #...
KeyError
dataset/ETHPy150Open Lukasa/httpcache/httpcache/cache.py/HTTPCache.store
9,170
def handle_304(self, response): """ Given a 304 response, retrieves the cached entry. This unconditionally returns the cached entry, so it can be used when the 'intelligent' behaviour of retrieve() is not desired. Returns None if there is no entry in the cache. :param r...
KeyError
dataset/ETHPy150Open Lukasa/httpcache/httpcache/cache.py/HTTPCache.handle_304
9,171
def retrieve(self, request): """ Retrieves a cached response if possible. If there is a response that can be unconditionally returned (e.g. one that had a Cache-Control header set), that response is returned. If there is one that can be conditionally returned (if a 304 is return...
KeyError
dataset/ETHPy150Open Lukasa/httpcache/httpcache/cache.py/HTTPCache.retrieve
9,172
def detach_volume(self, connection_info, instance, mountpoint, encryption=None): """Detach the disk attached to the instance.""" try: del self._mounts[instance.name][mountpoint] except __HOLE__: pass
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/fake.py/FakeDriver.detach_volume
9,173
def detach_interface(self, instance, vif): try: del self._interfaces[vif['id']] except __HOLE__: raise exception.InterfaceDetachFailed( instance_uuid=instance.uuid)
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/fake.py/FakeDriver.detach_interface
9,174
def stop(self): """ Tells the ChromeDriver to stop and cleans up the process """ #If its dead dont worry if self.process is None: return #Tell the Server to die! try: from urllib import request as url_request except __HOLE__: ...
ImportError
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/selenium/webdriver/chrome/service.py/Service.stop
9,175
@logging_level.setter def logging_level(self, value): if value is None: value = self._default_logging_level if isinstance(value, (bytes, unicode)): try: level = _levelNames[value.upper()] except __HOLE__: raise ValueError('Unrecogni...
KeyError
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand.logging_level
9,176
@property def search_results_info(self): """ Returns the search results info for this command invocation. The search results info object is created from the search results info file associated with the command invocation. :return: Search results info:const:`None`, if the search res...
AttributeError
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand.search_results_info
9,177
@property def service(self): """ Returns a Splunk service object for this command invocation or None. The service object is created from the Splunkd URI and authentication token passed to the command invocation in the search results info file. This data is not passed to a command invocation...
AttributeError
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand.service
9,178
def _prepare_protocol_v1(self, argv, ifile, ofile): debug = environment.splunklib_logger.debug # Provide as much context as possible in advance of parsing the command line and preparing for execution self._input_header.read(ifile) self._protocol_version = 1 self._map_metadata(...
AttributeError
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand._prepare_protocol_v1
9,179
def _process_protocol_v1(self, argv, ifile, ofile): debug = environment.splunklib_logger.debug class_name = self.__class__.__name__ debug('%s.process started under protocol_version=1', class_name) self._record_writer = RecordWriterV1(ofile) # noinspection PyBroadException ...
ValueError
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand._process_protocol_v1
9,180
def _process_protocol_v2(self, argv, ifile, ofile): """ Processes records on the `input stream optionally writing records to the output stream. :param ifile: Input file object. :type ifile: file or InputType :param ofile: Output file object. :type ofile: file or OutputType ...
SystemExit
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand._process_protocol_v2
9,181
def _records_protocol_v1(self, ifile): reader = csv.reader(ifile, dialect=CsvDialect) try: fieldnames = reader.next() except __HOLE__: return mv_fieldnames = {name: name[len('__mv_'):] for name in fieldnames if name.startswith('__mv_')} if len(mv_field...
StopIteration
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand._records_protocol_v1
9,182
def _records_protocol_v2(self, ifile): while True: result = self._read_chunk(ifile) if not result: return metadata, body = result action = getattr(metadata, 'action', None) if action != 'execute': raise RuntimeError(...
StopIteration
dataset/ETHPy150Open splunk/splunk-sdk-python/splunklib/searchcommands/search_command.py/SearchCommand._records_protocol_v2
9,183
def get_covariance_matrix(cosmo, data, command_line): """ Compute the covariance matrix, from an input file or from an existing matrix. Reordering of the names and scaling take place here, in a serie of potentially hard to read methods. For the sake of clarity, and to avoid confusions, the code...
IndexError
dataset/ETHPy150Open baudren/montepython_public/montepython/sampler.py/get_covariance_matrix
9,184
def compute_lkl(cosmo, data): """ Compute the likelihood, given the current point in parameter space. This function now performs a test before calling the cosmological model (**new in version 1.2**). If any cosmological parameter changed, the flag :code:`data.need_cosmo_update` will be set to :code...
KeyboardInterrupt
dataset/ETHPy150Open baudren/montepython_public/montepython/sampler.py/compute_lkl
9,185
def test_tb_across_threads(self): if not test_support.is_jython: return # http://bugs.jython.org/issue1533624 class PyRunnable(Runnable): def run(self): raise TypeError('this is only a test') try: EventQueue.invokeAndWait(PyRunnable())...
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_traceback_jy.py/TracebackTestCase.test_tb_across_threads
9,186
def test_except_around_raising_call(self): """[ #452526 ] traceback lineno is the except line""" from test import except_in_raising_code try: except_in_raising_code.foo() except __HOLE__: tb = sys.exc_info()[2] self.assertEquals(6, tb.tb_next.tb_lineno...
NameError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_traceback_jy.py/TracebackTestCase.test_except_around_raising_call
9,187
def _bindSocket(self): log.msg("%s starting on %s"%(self.protocol.__class__, self.interface)) try: fd, name = opentuntap(name=self.interface, ethernet=self.ethernet, packetinfo=0) except __HOLE__, e: rais...
OSError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/pair/tuntap.py/TuntapPort._bindSocket
9,188
def doRead(self): """Called when my socket is ready for reading.""" read = 0 while read < self.maxThroughput: try: data = os.read(self.fd, self.maxPacketSize) read += len(data) # pkt = TuntapPacketInfo(data) self.protocol...
IOError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/pair/tuntap.py/TuntapPort.doRead
9,189
def write(self, datagram): """Write a datagram.""" # header = makePacketInfo(0, 0) try: return os.write(self.fd, datagram) except __HOLE__, e: if e.errno == errno.EINTR: return self.write(datagram) elif e.errno == errno.EMSGSIZE: ...
IOError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/pair/tuntap.py/TuntapPort.write
9,190
def _scan(self): plugins = [] dirs = [] # initial pass, read for name in os.listdir(self.root): if name in (".", "..",): continue path = os.path.join(self.root, name) if (os.path.isdir(path) and os.path.isfile(os.p...
OSError
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/plugins.py/PluginDir._scan
9,191
def restart_apps(self, config, loop, manager): if not os.path.isdir(config.plugin_dir): # the new plugin dir isn't found logging.error("config error plugging dir %r not found" % config.plugin_dir) if self.plugin_dir != config.plugin_dir: l...
RuntimeError
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/plugins.py/PluginManager.restart_apps
9,192
def run(args): """ Prepares models from specified module for partitioning. :param dictionary args: (required). Dictionary of command arguments. """ names = [] module = args['module'][:-3] if args['module'].endswith('.py') else args['module'] try: module_clss = filter(lambda obj: is...
ImportError
dataset/ETHPy150Open maxtepkeev/architect/architect/commands/partition.py/run
9,193
def __init__(self, request, domain, export_id=None, minimal=False): self.request = request self.domain = domain self.presave = False self.transform_dates = False self.creating_new_export = not bool(export_id) self.minimal = minimal if export_id: self....
AssertionError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/export/custom_export_helpers.py/CustomExportHelper.__init__
9,194
def isinstance(obj, type_or_seq): try: return _isinstance(obj, type_or_seq) except __HOLE__: for t in type_or_seq: if _isinstance(obj, t): return 1 return 0
TypeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/xml/dom/minicompat.py/isinstance
9,195
def __getattr__(self, key): if key.startswith("_"): raise AttributeError, key try: get = getattr(self, "_get_" + key) except __HOLE__: raise AttributeError, key return get()
AttributeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/xml/dom/minicompat.py/GetattrMagic.__getattr__
9,196
def ValidateAndLog(self, log): """Validates an @ time spec line and logs any errors and warnings. Args: log: A LogCounter instance to record issues. """ self._CheckTimeField(log) # User checks. if self.user in USER_WHITELIST: return elif len(self.user) > 31: log.LineError...
KeyError
dataset/ETHPy150Open lyda/chkcrontab/chkcrontab_lib.py/CronLineTimeAction.ValidateAndLog
9,197
def get_last_update_of_model(self, model, **kwargs): """ Return the last time a given model's items were updated. Returns the epoch if the items were never updated. """ qs = self.get_for_model(model) if kwargs: qs = qs.filter(**kwargs) try: ...
IndexError
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/managers.py/ItemManager.get_last_update_of_model
9,198
def __from__(path): try: _import = path.split('.')[-1] _from = u".".join(path.split('.')[:-1]) return getattr(__import__(_from, fromlist=[_import]), _import) except __HOLE__: return object
TypeError
dataset/ETHPy150Open mining/mining/mining/utils/__init__.py/__from__
9,199
def check_auth(users, encrypt=None, realm=None): """If an authorization header contains credentials, return True, else False.""" request = cherrypy.serving.request if 'authorization' in request.headers: # make sure the provided credentials are correctly set ah = httpauth.parseAuthorization(r...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/lib/auth.py/check_auth