Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
1,200 | def __fstat(self, dname, fname):
try:
fstat = os.stat(os.path.join(dname, fname)).st_mtime
except __HOLE__, e:
return False
else:
return fstat | OSError | dataset/ETHPy150Open zynga/hiccup/hiccup/FileWatcher.py/FileWatcher.__fstat |
1,201 | def next(self, iterateAbove=-1, bindingsLen=-1):
# iterate hyperspace bindings
if not self.hyperspaceBindings:
raise StopIteration
hsBsToReset = []
if bindingsLen == -1:
bindingsLen = len(self.hyperspaceBindings)
for iHsB in range(bindingsLen - 1,... | StopIteration | dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxContext.py/HyperspaceBindings.next |
1,202 | def next(self): # will raise StopIteration if no (more) facts or fallback
uncoveredAspectFacts = self.hyperspaceBindings.aspectBoundFacts
if self.yieldedFact is not None and self.hyperspaceBindings.aggregationNode is None:
for aspect, priorFact in self.evaluationContributedUncoveredAspects.i... | StopIteration | dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxContext.py/HyperspaceBinding.next |
1,203 | def next(self): # will raise StopIteration if no (more) facts or fallback
try:
self.yieldedValue = next(self.forIter)
# set next value here as well as in for node, because may be cleared above context of for node
self.sCtx.localVariables[self.node.name] = self.yieldedValue
... | StopIteration | dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/sphinx/SphinxContext.py/ForBinding.next |
1,204 | def get_petsc_dir():
try:
arch = '/' + env.get('PETSC_ARCH', '')
dir = env['PETSC_DIR']
return (dir, dir + arch)
except KeyError:
try:
import petsc
return (petsc.get_petsc_dir(), )
except __HOLE__:
sys.exit("""Error: Could not find PETS... | ImportError | dataset/ETHPy150Open OP2/PyOP2/setup.py/get_petsc_dir |
1,205 | def _dispatch_request(self, seq, raw_args):
try:
handler, args = raw_args
args = self._unbox(args)
res = self._HANDLERS[handler](self, *args)
except __HOLE__:
raise
except:
# need to catch old style exceptions too
t, v, tb =... | KeyboardInterrupt | dataset/ETHPy150Open sccn/SNAP/src/rpyc/core/protocol.py/Connection._dispatch_request |
1,206 | def serve_all(self):
"""Serves all requests and replies for as long as the connection is
alive."""
try:
try:
while True:
self.serve(0.1)
except (socket.error, select_error, __HOLE__):
if not self.closed:
... | IOError | dataset/ETHPy150Open sccn/SNAP/src/rpyc/core/protocol.py/Connection.serve_all |
1,207 | def _handle_cmp(self, oid, other):
# cmp() might enter recursive resonance... yet another workaround
#return cmp(self._local_objects[oid], other)
obj = self._local_objects[oid]
try:
return type(obj).__cmp__(obj, other)
except (AttributeError, __HOLE__):
re... | TypeError | dataset/ETHPy150Open sccn/SNAP/src/rpyc/core/protocol.py/Connection._handle_cmp |
1,208 | def _handle_buffiter(self, oid, count):
items = []
obj = self._local_objects[oid]
i = 0
try:
while i < count:
items.append(next(obj))
i += 1
except __HOLE__:
pass
return tuple(items) | StopIteration | dataset/ETHPy150Open sccn/SNAP/src/rpyc/core/protocol.py/Connection._handle_buffiter |
1,209 | def cache_scan(self):
try:
return len(self.transformations) - self.transformations[::-1].index(CACHE_T)
except __HOLE__:
return 0 | ValueError | dataset/ETHPy150Open EntilZha/PyFunctional/functional/lineage.py/Lineage.cache_scan |
1,210 | def simplify_ops(ops):
addDict = {}
deleteDict = {}
for op_count, op in enumerate(ops):
op.db_id = -op_count - 1
if op.vtType == 'add':
addDict[(op.db_what, op.db_objectId)] = op
elif op.vtType == 'delete':
try:
del addDict[(op.db_what, op.db_o... | KeyError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/services/action_chain.py/simplify_ops |
1,211 | def getCurrentOperationDict(actions, currentOperations=None):
if currentOperations is None:
currentOperations = {}
# note that this operation assumes unique ids for each operation's data
# any add adds to the dict, delete removes from the dict, and
# change replaces the current value in the dic... | KeyError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/services/action_chain.py/getCurrentOperationDict |
1,212 | def contour(x, y, z, data=None, marker=None, alpha=.5,
xscale='linear', yscale='linear', cmap=None,
ncontours=100, gridsize=100, colorbar=True, labels=False,
figsize=(12, 6), filled=True, fig=None, axes=None, cgrid=None,
axislabels=True, axisticks=True, **kwargs):
""... | ValueError | dataset/ETHPy150Open beltashazzer/jmpy/jmpy/plotting/contour.py/contour |
1,213 | def get_reconciler_content_type(op):
try:
return {
'put': 'application/x-put',
'delete': 'application/x-delete',
}[op.lower()]
except __HOLE__:
raise ValueError('invalid operation type %r' % op) | KeyError | dataset/ETHPy150Open openstack/swift/swift/container/reconciler.py/get_reconciler_content_type |
1,214 | def parse_raw_obj(obj_info):
"""
Translate a reconciler container listing entry to a dictionary
containing the parts of the misplaced object queue entry.
:param obj_info: an entry in an a container listing with the
required keys: name, content_type, and hash
:returns: a queue ... | KeyError | dataset/ETHPy150Open openstack/swift/swift/container/reconciler.py/parse_raw_obj |
1,215 | def test_raises_when_start_address_not_found(self):
text = 'aa bb cc'
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Start address was not found in data'
self.assertEqual(msg, str(exc)) | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_start_address_not_found |
1,216 | def test_raises_when_start_address_is_invalid(self):
text = 'oops: aa bb cc'
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Could not parse address: oops'
self.assertEqual(msg, str(exc)) | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_start_address_is_invalid |
1,217 | def test_raises_when_start_address_is_too_short(self):
text = '01: aa bb cc'
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Expected address to be 2 bytes, got 1'
self.assertEqual(msg, str(exc)) | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_start_address_is_too_short |
1,218 | def test_raises_when_start_address_is_too_long(self):
text = '010304: aa bb cc'
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Expected address to be 2 bytes, got 3'
self.assertEqual(msg, str(exc)) | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_start_address_is_too_long |
1,219 | def test_raises_when_next_address_is_unexpected(self):
text = "c000: aa\nc002: cc"
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Non-contigous block detected. Expected next ' \
'address to be $c001, label was $c002'
... | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_next_address_is_unexpected |
1,220 | def test_raises_when_data_is_invalid(self):
text = 'c000: foo'
try:
Loader(text)
self.fail()
except __HOLE__ as exc:
msg = 'Could not parse data: foo'
self.assertEqual(msg, str(exc)) | ValueError | dataset/ETHPy150Open mnaberez/py65/py65/tests/utils/test_hexdump.py/HexdumpLoaderTests.test_raises_when_data_is_invalid |
1,221 | def __str__(self):
try:
import cStringIO as StringIO
except __HOLE__:
import StringIO
output = StringIO.StringIO()
output.write(Exception.__str__(self))
# Check if we wrapped an exception and print that too.
if hasattr(self, 'exc_info'):
... | ImportError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/TemplateSyntaxError.__str__ |
1,222 | def __init__(self, template_string, origin=None, name='<Unknown Template>'):
try:
template_string = smart_unicode(template_string)
except __HOLE__:
raise TemplateEncodingError("Templates can only be constructed from unicode or UTF-8 strings.")
if settings.TEMPLATE_DEBUG a... | UnicodeDecodeError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/Template.__init__ |
1,223 | def parse(self, parse_until=None):
if parse_until is None: parse_until = []
nodelist = self.create_nodelist()
while self.tokens:
token = self.next_token()
if token.token_type == TOKEN_TEXT:
self.extend_nodelist(nodelist, TextNode(token.contents), token)
... | IndexError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/Parser.parse |
1,224 | def extend_nodelist(self, nodelist, node, token):
if node.must_be_first and nodelist:
try:
if nodelist.contains_nontext:
raise AttributeError
except __HOLE__:
raise TemplateSyntaxError("%r must be the first tag in the template." % node)... | AttributeError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/Parser.extend_nodelist |
1,225 | def args_check(name, func, provided):
provided = list(provided)
plen = len(provided)
# Check to see if a decorator is providing the real function.
func = getattr(func, '_decorated_function', func)
args, varargs, varkw, defaults = getargspec(func)
# First argument is filte... | IndexError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/FilterExpression.args_check |
1,226 | def __init__(self, var):
self.var = var
self.literal = None
self.lookups = None
self.translate = False
try:
# First try to treat this variable as a number.
#
# Note that this could cause an OverflowError here that we're not
# catch... | ValueError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/Variable.__init__ |
1,227 | def _resolve_lookup(self, context):
"""
Performs resolution of a real variable (i.e. not a literal) against the
given context.
As indicated by the method's name, this method is an implementation
detail and shouldn't be called by external code. Use Variable.resolve()
inst... | TypeError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/Variable._resolve_lookup |
1,228 | def render(self, context):
try:
output = force_unicode(self.filter_expression.resolve(context))
except __HOLE__:
# Unicode conversion can fail sometimes for reasons out of our
# control (e.g. exception rendering). In that case, we fail quietly.
return ''
... | UnicodeDecodeError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/VariableNode.render |
1,229 | def get_library(module_name):
lib = libraries.get(module_name, None)
if not lib:
try:
mod = __import__(module_name, {}, {}, [''])
except __HOLE__, e:
raise InvalidTemplateLibrary("Could not load template library from %s, %s" % (module_name, e))
try:
li... | ImportError | dataset/ETHPy150Open dcramer/django-compositepks/django/template/__init__.py/get_library |
1,230 | def clean(self, value):
super(LVPersonalCodeField, self).clean(value)
if value in EMPTY_VALUES:
return ''
match = re.match(idcode, value)
if not match:
raise ValidationError(self.error_messages['invalid_format'])
day, month, year, century, check = map(in... | ValueError | dataset/ETHPy150Open django/django-localflavor/localflavor/lv/forms.py/LVPersonalCodeField.clean |
1,231 | @staticmethod
def parse_bool(val, _states={
'1': True, 'yes': True, 'true': True, 'on': True,
'0': False, 'no': False, 'false': False, 'off': False }):
try: return _states[val.lower()]
except __HOLE__: raise ValueError(val) | KeyError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/Conf.parse_bool |
1,232 | def strip_noise_bytes( obj, replace=u'_', encoding='utf-8',
byte_errors='backslashreplace', unicode_errors='replace' ):
'''Converts obj to byte representation, making sure
there arent any random weird chars that dont belong to any alphabet.
Only ascii non-letters are allowed, as fancy symbols don't seem to work... | ValueError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/strip_noise_bytes |
1,233 | def _child_readline_poll(self):
'child.stdout.readline() that also reacts to signals.'
# One shitty ipc instead of another... good job!
line = None
while True:
if '\n' in self.line_buff: line, self.line_buff = self.line_buff.split('\n', 1)
if line is not None: return line
try: evs = self.poller.poll(se... | KeyboardInterrupt | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge._child_readline_poll |
1,234 | def _child_readline(self, wait_for_cid=None, one_signal=False, init_line=False):
ts0 = mono_time()
while True:
if wait_for_cid and wait_for_cid in self.child_calls:
# XXX: check for errors indicating that dbus is gone here?
line_ts, line = self.child_calls.pop(wait_for_cid)
if random.random() < self.... | ValueError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge._child_readline |
1,235 | def signal_handler(self, sig=None, frm=None):
log.debug('Signal handler triggered by: %s', sig)
if not self.child_sigs: self._child_readline(one_signal=True)
while True:
try: line = self.child_sigs.popleft()
except __HOLE__: break
self.signal_func(**line) | IndexError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge.signal_handler |
1,236 | def child_kill(self):
if self._child:
child, self._child = self._child, None
self._child_gc.add(child.pid)
try: child.kill() # no need to be nice here
except __HOLE__ as err:
log.debug('child_kill error: %s', err)
else:
log.debug('child_kill invoked with no child around') | OSError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge.child_kill |
1,237 | def child_check_restart(self, sig=None, frm=None):
if self._child_check: return # likely due to SIGCHLD from Popen
self._child_check = True
try:
if self._child_gc: # these are cleaned-up just to avoid keeping zombies around
for pid in list(self._child_gc):
try: res = os.waitpid(pid, os.WNOHANG)
e... | OSError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge.child_check_restart |
1,238 | @_glib_err_wrap
def _core_notify(self, _signal=False, **kws):
chunk = dict(**kws)
self.line_debug.append(('rpc-child(py) >> %s', chunk))
if self.log_pipes: log.debug(*self.line_debug[-1])
chunk = json.dumps(chunk)
assert '\n' not in chunk, chunk
try:
if _signal: os.kill(self.core_pid, self.signal)
se... | IOError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge._core_notify |
1,239 | @_glib_err_wrap
def _rpc_call(self, buff, stream=None, ev=None):
assert stream is self.stdin, [stream, self.stdin]
if ev is None: ev = self._glib.IO_IN
if ev & (self._glib.IO_ERR | self._glib.IO_HUP):
return self.loop.quit() # parent is gone, we're done too
elif ev & self._glib.IO_IN:
while True:
tr... | IOError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge._rpc_call |
1,240 | def child_run(self):
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
import dbus
def excepthook(t, v, tb, hook=sys.excepthook):
time.sleep(0.2) # to dump parent/child tracebacks non-interleaved
return hook(t, v, tb)
sys.excepthook = excepthook
self._dbus, self._glib = dbu... | KeyboardInterrupt | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerDBusBridge.child_run |
1,241 | def _get_name_descriptive(self):
'Can probably fail with KeyError if something is really wrong with stream/device props.'
ext, props = None, dict(
(force_bytes(k), strip_noise_bytes(v, self.conf.broken_chars_replace))
for k,v in self.props.viewitems() )
if self.t == 'stream':
if self.conf.use_media_name... | KeyError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerMenuItem._get_name_descriptive |
1,242 | def _run(self, stdscr):
c, self.c_stdscr = self.c, stdscr
key_match = lambda key,*choices: key in map(self.c_key, choices)
c.curs_set(0)
c.use_default_colors()
win = self.c_win_init()
self.conf.adjust_step /= 100.0
while True:
try:
# XXX: full refresh on every keypress is a bit excessive
ite... | ValueError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/PAMixerUI._run |
1,243 | def watchdog_run(conf, args):
signal.signal(signal.SIGUSR2, watchdog_run_pong)
proc = proc_poller = None
proc_pongs = 0
while True:
if not proc:
r, w = os.pipe()
proc_opts = list(args) + [
'--parent-pid-do-not-use', 'w{}-{}'.format(os.getpid(), w) ]
proc = subprocess.Popen(self_exec_cmd(*proc_opts))... | OSError | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/watchdog_run |
1,244 | def main(args=None):
conf = Conf()
conf_file = os.path.expanduser('~/.pulseaudio-mixer-cli.cfg')
try: conf_file = open(conf_file)
except (OSError, IOError) as err: pass
else: update_conf_from_file(conf, conf_file)
import argparse
parser = argparse.ArgumentParser(description='Command-line PulseAudio mixer tool.'... | KeyboardInterrupt | dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/main |
1,245 | def children(self):
"""
List the children of this path object.
@raise OSError: If an error occurs while listing the directory. If the
error is 'serious', meaning that the operation failed due to an access
violation, exhaustion of some kind of resource (file descriptors or
... | OSError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/filepath.py/_PathHelper.children |
1,246 | def restat(self, reraise=True):
"""
Re-calculate cached effects of 'stat'. To refresh information on this path
after you know the filesystem may have changed, call this method.
@param reraise: a boolean. If true, re-raise exceptions from
L{os.stat}; otherwise, mark this path a... | OSError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/filepath.py/FilePath.restat |
1,247 | def touch(self):
try:
self.open('a').close()
except __HOLE__:
pass
utime(self.path, None) | IOError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/filepath.py/FilePath.touch |
1,248 | def moveTo(self, destination, followLinks=True):
"""
Move self to destination - basically renaming self to whatever
destination is named. If destination is an already-existing directory,
moves all children to destination if destination is empty. If
destination is a non-empty di... | OSError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/filepath.py/FilePath.moveTo |
1,249 | def remove(self):
logger.debug('Removing pth entries from %s:', self.file)
with open(self.file, 'rb') as fh:
# windows uses '\r\n' with py3k, but uses '\n' with py2.x
lines = fh.readlines()
self._saved_lines = lines
if any(b'\r\n' in line for line in lines):
... | ValueError | dataset/ETHPy150Open anzev/hedwig/build/pip/pip/req/req_uninstall.py/UninstallPthEntries.remove |
1,250 | def _log_func_exception(self, data, stat, event=None):
try:
# For backwards compatibility, don't send event to the
# callback unless the send_event is set in constructor
if not self._ever_called:
self._ever_called = True
try:
result... | TypeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/kazoo-2.0/kazoo/recipe/watchers.py/DataWatch._log_func_exception |
1,251 | def __init__(self, *args, **kwargs):
try:
self.retry_after = int(kwargs.pop('retry_after'))
except (__HOLE__, ValueError):
self.retry_after = 0
super(RequestEntityTooLarge, self).__init__(*args, **kwargs) | KeyError | dataset/ETHPy150Open openstack/python-solumclient/solumclient/openstack/common/apiclient/exceptions.py/RequestEntityTooLarge.__init__ |
1,252 | def from_response(response, method, url):
"""Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request
"""
req_id = response.headers.get("x-opensta... | KeyError | dataset/ETHPy150Open openstack/python-solumclient/solumclient/openstack/common/apiclient/exceptions.py/from_response |
1,253 | def _to_key_pair(self, data):
try:
pubkey = data['ssh_pub_key']
except __HOLE__:
pubkey = None
return KeyPair(data['name'], public_key=pubkey, fingerprint=None,
driver=self, private_key=None, extra={'id': data['id']}) | KeyError | dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/digitalocean.py/DigitalOcean_v1_NodeDriver._to_key_pair |
1,254 | def _mkdir_p(path):
"""Creates all non-existing directories encountered in the passed in path
Args:
path (str):
Path containing directories to create
Raises:
OSError:
If some underlying error occurs when calling :func:`os.makedirs`,
that is not errno.EEX... | OSError | dataset/ETHPy150Open jmagnusson/Flask-Resize/flask_resize/__init__.py/_mkdir_p |
1,255 | def strformat(self):
try:
# Try to get a relative path
path = os.path.relpath(self.filename)
except __HOLE__:
# Fallback to absolute path if error occured in getting the
# relative path.
# This may happen on windows if the drive is different
... | ValueError | dataset/ETHPy150Open numba/numba/numba/ir.py/Loc.strformat |
1,256 | def get(self, name):
try:
return self._con[name]
except __HOLE__:
raise NotDefinedError(name) | KeyError | dataset/ETHPy150Open numba/numba/numba/ir.py/VarMap.get |
1,257 | def clear(self):
try:
shutil.rmtree(self.root)
except __HOLE__, e:
pass | OSError | dataset/ETHPy150Open douban/dpark/dpark/cache.py/DiskCache.clear |
1,258 | def __init__(self, motor_config):
"""Initialize a set of DMCCs and their associated motors
:param motor_config: Config entry mapping motor names to DMCC ids and
motor indices
Dictionary entries are in the format:
<motor_name>: { board_num: [0-3], motor_num: [1-2] }
... | KeyError | dataset/ETHPy150Open IEEERobotics/bot/bot/hardware/dmcc_motor.py/DMCCMotorSet.__init__ |
1,259 | def test_3_ensure_va_kwa(self):
a = A()
try:
assert a.hello(1,2,3,4,5,*('extra va1','extra va2')) == 0, 'should throw TypeError'
except __HOLE__:
pass
a.hello = introspect.ensure_va_kwa(a.hello)
expected = self.expect_hello_info.copy()
expected['varargs'] = True
expected['varkw']... | TypeError | dataset/ETHPy150Open rsms/smisk/lib/smisk/test/util/introspect.py/IntrospectTests.test_3_ensure_va_kwa |
1,260 | @task(ignore_results=True)
def process_feed(feed_url, owner_id=None, create=False, category_title=None):
"""
Stores a feed, its related data, its entries and their related data.
If create=True then it creates the feed, otherwise it only stores new
entries and their related data.
"""
print("[pr... | AttributeError | dataset/ETHPy150Open matagus/django-planet/planet/tasks.py/process_feed |
1,261 | def finished(experiment_name, reset=True):
"""
Track a conversion.
:param experiment_name: Name of the experiment.
:param reset: If set to `True` current user's session is reset so that they
may start the test again in the future. If set to `False` the user
will always see the alternat... | KeyError | dataset/ETHPy150Open jpvanhal/flask-split/flask_split/core.py/finished |
1,262 | def check_all(self, modname):
names = {}
try:
exec "import %s" % modname in names
except __HOLE__:
# Silent fail here seems the best route since some modules
# may not be available in all environments.
return
verify(hasattr(sys.modules[modn... | ImportError | dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test___all__.py/AllTest.check_all |
1,263 | def test_all(self):
if not sys.platform.startswith('java'):
# In case _socket fails to build, make this test fail more gracefully
# than an AttributeError somewhere deep in CGIHTTPServer.
import _socket
self.check_all("BaseHTTPServer")
self.check_all("Bastion... | ImportError | dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test___all__.py/AllTest.test_all |
1,264 | def set_password(self, value):
if value:
try:
self._password = FERNET.encrypt(bytes(value, 'utf-8')).decode()
self.is_encrypted = True
except __HOLE__:
self._password = value
self.is_encrypted = False | NameError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/Connection.set_password |
1,265 | def set_extra(self, value):
if value:
try:
self._extra = FERNET.encrypt(bytes(value, 'utf-8')).decode()
self.is_extra_encrypted = True
except __HOLE__:
self._extra = value
self.is_extra_encrypted = False | NameError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/Connection.set_extra |
1,266 | @provide_session
def run(
self,
verbose=True,
ignore_dependencies=False, # Doesn't check for deps, just runs
ignore_depends_on_past=False, # Ignore depends_on_past but respect
# other deps
force=False, # Disr... | KeyboardInterrupt | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/TaskInstance.run |
1,267 | def __hash__(self):
hash_components = [type(self)]
for c in self._comps:
val = getattr(self, c, None)
try:
hash(val)
hash_components.append(val)
except __HOLE__:
hash_components.append(repr(val))
return hash(tupl... | TypeError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/BaseOperator.__hash__ |
1,268 | def _set_relatives(self, task_or_task_list, upstream=False):
try:
task_list = list(task_or_task_list)
except __HOLE__:
task_list = [task_or_task_list]
for t in task_list:
if not isinstance(t, BaseOperator):
raise AirflowException(
... | TypeError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/BaseOperator._set_relatives |
1,269 | def __hash__(self):
hash_components = [type(self)]
for c in self._comps:
val = getattr(self, c, None)
try:
hash(val)
hash_components.append(val)
except __HOLE__:
hash_components.append(repr(val))
return hash(tupl... | TypeError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/DAG.__hash__ |
1,270 | def set_val(self, value):
if value:
try:
self._val = FERNET.encrypt(bytes(value, 'utf-8')).decode()
self.is_encrypted = True
except __HOLE__:
self._val = value
self.is_encrypted = False | NameError | dataset/ETHPy150Open airbnb/airflow/airflow/models.py/Variable.set_val |
1,271 | def disconnect(self, token):
'''
Unregisters a callback for an event topic.
@param token: Token of the callback to unregister
@type token: dict
'''
topic = token['topic']
try:
arr = self._connects[topic]
except __HOLE__:
return
... | KeyError | dataset/ETHPy150Open parente/pyttsx/pyttsx/engine.py/Engine.disconnect |
1,272 | def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except __HOLE__:
return '' | IOError | dataset/ETHPy150Open mlavin/sickmuse/setup.py/read_file |
1,273 | def Attach(self):
"""Attach to an existing extstorage device.
This method maps the extstorage volume that matches our name with
a corresponding block device and then attaches to this device.
"""
self.attached = False
# Call the External Storage's attach script,
# to attach an existing Vol... | OSError | dataset/ETHPy150Open ganeti/ganeti/lib/storage/extstorage.py/ExtStorageDevice.Attach |
1,274 | def do_start(self, arg):
"""Starts an ActorSystem. The first optional argument is the
SystemBase. The remainder of the line (if any) is parsed
as the capabilities dictionary to pass to the
ActorSystem.
"""
if self.system:
print ('Shutting down previ... | ImportError | dataset/ETHPy150Open godaddy/Thespian/thespian/shell.py/ThespianShell.do_start |
1,275 | def do_set_thesplog(self, arg):
'Updates the Thespian thesplog internal call functionality. The first argument is the Actor number, the second argument is the logging threshold (e.g. "debug", "warning", etc.), the third argument is true or false to specify the forwarding of thesplog calls to python logging, an... | ImportError | dataset/ETHPy150Open godaddy/Thespian/thespian/shell.py/ThespianShell.do_set_thesplog |
1,276 | @check_event_permissions
def create_or_edit_event(request, calendar_slug, event_id=None, next=None,
template_name='event/edit.html', form_class = EventForm):
date = coerce_date_dict(request.GET)
initial_data = None
if date:
try:
start = datetime.datetime(**date)
initial_d... | TypeError | dataset/ETHPy150Open ustream/openduty/openduty/events.py/create_or_edit_event |
1,277 | def run_from_argv(self, argv):
"""
Changes the option_list to use the options from the wrapped command.
Adds schema parameter to specify which schema will be used when
executing the wrapped command.
"""
# load the command object.
if len(argv) <= 2:
ret... | KeyError | dataset/ETHPy150Open tomturner/django-tenants/django_tenants/management/commands/tenant_command.py/Command.run_from_argv |
1,278 | def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/localflavor/it/util.py/ssn_check_digit |
1,279 | def generate(api, setUp=None):
""" Generates a set of tests for every Resource"""
if setUp is None:
def user_setUp(*args, **kwargs):
return
else:
user_setUp = setUp
class UnderResources(MultiTestCase):
""" Generates a set of tests for every Resource """
@s... | AttributeError | dataset/ETHPy150Open mozilla/inventory/vendor-local/src/django-tastytools/tastytools/test/definitions/resources.py/generate |
1,280 | def metadata(id, sleep_time=1):
solr ="http://chinkapin.pti.indiana.edu:9994/solr/meta/select/?q=id:%s" % id
solr += "&wt=json" ## retrieve JSON results
# TODO: exception handling
if sleep_time:
sleep(sleep_time) ## JUST TO MAKE SURE WE ARE THROTTLED
try:
data = json.load(urlopen(sol... | ValueError | dataset/ETHPy150Open inpho/topic-explorer/topicexplorer/lib/hathitrust.py/metadata |
1,281 | @override_settings(TEST_ARTICLE_MODEL='swappable_models.article')
def test_case_insensitive(self):
"Model names are case insensitive. Check that model swapping honors this."
try:
Article.objects.all()
except __HOLE__:
self.fail('Swappable model names should be case in... | AttributeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/swappable_models/tests.py/SwappableModelTests.test_case_insensitive |
1,282 | def _connect(self, **kwargs):
self.status_code = 'Unknown'
self.timeout = kwargs.get('timeout', 5.0)
self.proxies = kwargs.get('proxies', '')
try:
r = self.rate_limited_get(
self.url,
params=self.params,
headers=self.headers,
... | SystemExit | dataset/ETHPy150Open DenisCarriere/geocoder/geocoder/base.py/Base._connect |
1,283 | def getfeature(self, typename=None, filter=None, bbox=None, featureid=None,
featureversion=None, propertyname='*', maxfeatures=None,
srsname=None, outputFormat=None, method='Get',
startindex=None):
"""Request and return feature data as a file-like object.... | StopIteration | dataset/ETHPy150Open geopython/OWSLib/owslib/feature/wfs110.py/WebFeatureService_1_1_0.getfeature |
1,284 | def add_from_path(envname, dirs):
try:
dirs.extend(os.environ[envname].split(os.pathsep))
except __HOLE__:
pass | KeyError | dataset/ETHPy150Open PyTables/PyTables/setup.py/add_from_path |
1,285 | def find_runtime_path(self, locations=default_runtime_dirs):
"""
returns True if the runtime can be found
returns None otherwise
"""
# An explicit path can not be provided for runtime libraries.
# (The argument is accepted for compatibility with previous methods.)
... | OSError | dataset/ETHPy150Open PyTables/PyTables/setup.py/Package.find_runtime_path |
1,286 | @staticmethod
def _get_mtimes(filenames):
filename_to_mtime = {}
for filename in filenames:
try:
filename_to_mtime[filename] = os.path.getmtime(filename)
except __HOLE__ as e:
# Ignore deleted includes.
if e.errno != errno.ENOENT:
raise
return filename_to_mtim... | OSError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/application_configuration.py/ServerConfiguration._get_mtimes |
1,287 | def get_list(self):
try:
return self.__list
except __HOLE__:
self.__list = self.split('\n')
return self.__list | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/LSString.get_list |
1,288 | def get_spstr(self):
try:
return self.__spstr
except __HOLE__:
self.__spstr = self.replace('\n',' ')
return self.__spstr | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/LSString.get_spstr |
1,289 | def get_paths(self):
try:
return self.__paths
except __HOLE__:
self.__paths = [path(p) for p in self.split('\n') if os.path.exists(p)]
return self.__paths | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/LSString.get_paths |
1,290 | def get_spstr(self):
try:
return self.__spstr
except __HOLE__:
self.__spstr = ' '.join(self)
return self.__spstr | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.get_spstr |
1,291 | def get_nlstr(self):
try:
return self.__nlstr
except __HOLE__:
self.__nlstr = '\n'.join(self)
return self.__nlstr | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.get_nlstr |
1,292 | def get_paths(self):
try:
return self.__paths
except __HOLE__:
self.__paths = [path(p) for p in self if os.path.exists(p)]
return self.__paths | AttributeError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.get_paths |
1,293 | def grep(self, pattern, prune = False, field = None):
""" Return all strings matching 'pattern' (a regex or callable)
This is case-insensitive. If prune is true, return all items
NOT matching the pattern.
If field is specified, the match must occur in the specified
whitespace-s... | IndexError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.grep |
1,294 | def fields(self, *fields):
""" Collect whitespace-separated fields from string list
Allows quick awk-like usage of string lists.
Example data (in var a, created by 'a = !ls -l')::
-rwxrwxrwx 1 ville None 18 Dec 14 2006 ChangeLog
drwxrwxrwx+ 6 ville None 0 O... | IndexError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.fields |
1,295 | def sort(self,field= None, nums = False):
""" sort by specified fields (see fields())
Example::
a.sort(1, nums = True)
Sorts a by second field, in numerical order (so that 21 > 3)
"""
#decorate, sort, undecorate
if field is not None:
dsu = [[S... | ValueError | dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/text.py/SList.sort |
1,296 | def override_subcommand(section_name, section_items, args):
"""
Given a specific section in the configuration file that maps to
a subcommand (except for the global section) read all the keys that are
actual argument flags and slap the values for that one subcommand.
Return the altered ``args`` obje... | AttributeError | dataset/ETHPy150Open ceph/ceph-deploy/ceph_deploy/conf/cephdeploy.py/override_subcommand |
1,297 | def get_year(self):
"""
Return the year for which this view should display data.
"""
year = self.year
if year is None:
try:
year = self.kwargs['year']
except __HOLE__:
try:
year = self.request.GET['year']... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/YearMixin.get_year |
1,298 | def get_month(self):
"""
Return the month for which this view should display data.
"""
month = self.month
if month is None:
try:
month = self.kwargs['month']
except __HOLE__:
try:
month = self.request.GET... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/MonthMixin.get_month |
1,299 | def get_day(self):
"""
Return the day for which this view should display data.
"""
day = self.day
if day is None:
try:
day = self.kwargs['day']
except __HOLE__:
try:
day = self.request.GET['day']
... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/generic/dates.py/DayMixin.get_day |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.