Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
7,200 | def update(self, recursive=False, init=True, to_latest_revision=False, progress=None, dry_run=False,
force=False, keep_going=False):
"""Update the repository of this submodule to point to the checkout
we point at with the binsha of this instance.
:param recursive: if True, we wil... | IndexError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.update |
7,201 | @unbare_repo
def move(self, module_path, configuration=True, module=True):
"""Move the submodule to a another module path. This involves physically moving
the repository at our current path, changing the configuration, as well as
adjusting our index entry accordingly.
:param module_... | KeyError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.move |
7,202 | @unbare_repo
def remove(self, module=True, force=False, configuration=True, dry_run=False):
"""Remove this submodule from the repository. This will remove our entry
from the .gitmodules file and the entry in the .git/config file.
:param module: If True, the module checkout we point to will ... | KeyError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.remove |
7,203 | def set_parent_commit(self, commit, check=True):
"""Set this instance to use the given commit whose tree is supposed to
contain the .gitmodules blob.
:param commit:
Commit'ish reference pointing at the root_tree, or None to always point to the
most recent commit
... | KeyError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.set_parent_commit |
7,204 | def exists(self):
"""
:return: True if the submodule exists, False otherwise. Please note that
a submodule may exist (in the .gitmodules file) even though its module
doesn't exist on disk"""
# keep attributes for later, and restore them if we have no valid data
# ... | ValueError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.exists |
7,205 | @classmethod
def iter_items(cls, repo, parent_commit='HEAD'):
""":return: iterator yielding Submodule instances available in the given repository"""
pc = repo.commit(parent_commit) # parent commit instance
try:
parser = cls._config_parser(repo, pc, read_only=True)
... | KeyError | dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/base.py/Submodule.iter_items |
7,206 | def get_result_and_row_class(cl, field_name, result):
if django.VERSION >= (1, 9):
empty_value_display = cl.model_admin.get_empty_value_display()
else:
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
empty_value_display = EMPTY_CHANGELIST_VALUE
row_classes = ['fiel... | ObjectDoesNotExist | dataset/ETHPy150Open tabo/django-treebeard/treebeard/templatetags/admin_tree.py/get_result_and_row_class |
7,207 | def find_in_migration(self, anchor, needles, terminus='\n', distance=None):
"""Assert the presence of the given anchor in the output.
Once the anchor is found, assert the presence of *each* provided
needle within bounds. If `terminus` is provided, each needle must
appear before the next... | ValueError | dataset/ETHPy150Open lukesneeringer/django-pgfields/tests/south_migrations/tests.py/MigrationCreationSuite.find_in_migration |
7,208 | def get_url(self, urlbase, *args, **kw):
#~ kw[constants.URL_PARAM_USER_LANGUAGE] = self.language
if self.ar.bound_action.action.action_name == 'detail':
if len(args) == 0:
try:
args = [str(iter(self.ar).next().pk)]
except __HOLE__:
... | StopIteration | dataset/ETHPy150Open lsaffre/lino/lino/utils/screenshots.py/Screenshot.get_url |
7,209 | def subtopics(store, folders, folder_id, subfolder_id, ann_id=None):
'''Yields an unordered generator of subtopics in a subfolder.
Each item of the generator is a 4-tuple of ``content_id``,
``subtopic_id``, ``subtopic_type`` and ``data``. Subtopic type
is one of the following Unicode strings: ``text``,... | KeyError | dataset/ETHPy150Open dossier/dossier.models/dossier/models/subtopic.py/subtopics |
7,210 | def runloop(self):
while self.keep_going:
eventlet.sleep(0.1)
## Only start the number of children we need
number = self.num_processes - self.children_count()
if number > 0:
self.log.debug('Should start %d new children', number)
sel... | OSError | dataset/ETHPy150Open rtyler/Spawning/spawning/spawning_controller.py/Controller.runloop |
7,211 | def kill_children(self):
for pid, child in self.children.items():
try:
os.write(child.kill_pipe, 'k')
child.active = False
# all maintenance of children's membership happens in runloop()
# as children die and os.wait() gets results
... | OSError | dataset/ETHPy150Open rtyler/Spawning/spawning/spawning_controller.py/Controller.kill_children |
7,212 | def run(self):
self.log.info('(%s) *** Controller starting at %s' % (self.controller_pid,
time.asctime()))
if self.config.get('pidfile'):
with open(self.config.get('pidfile'), 'w') as fd:
fd.write('%s\n' % self.controller_pid)
spawning.setproctitle("... | KeyboardInterrupt | dataset/ETHPy150Open rtyler/Spawning/spawning/spawning_controller.py/Controller.run |
7,213 | def main():
current_directory = os.path.realpath('.')
if current_directory not in sys.path:
sys.path.append(current_directory)
parser = optparse.OptionParser(description="Spawning is an easy-to-use and flexible wsgi server. It supports graceful restarting so that your site finishes serving any old ... | OSError | dataset/ETHPy150Open rtyler/Spawning/spawning/spawning_controller.py/main |
7,214 | def clean_and_validate(self, cleaned_data):
file = cleaned_data.get('file')
if file:
# check extension of the data file
_, fname, ext = split_filename(file.name)
if not ext.lower() in [".nii.gz", ".nii", ".img"]:
self._errors["file"] = self.error_clas... | OSError | dataset/ETHPy150Open NeuroVault/NeuroVault/neurovault/apps/statmaps/forms.py/ImageValidationMixin.clean_and_validate |
7,215 | def save_afni_slices(self, commit):
try:
orig_img = self.instance
for n, (label, brick) in enumerate(self.afni_subbricks):
brick_fname = os.path.split(brick)[-1]
mfile = memory_uploadfile(brick, brick_fname, orig_img.file)
brick_img = Stat... | OSError | dataset/ETHPy150Open NeuroVault/NeuroVault/neurovault/apps/statmaps/forms.py/StatisticMapForm.save_afni_slices |
7,216 | def _get_current_user():
session = web.cookies(session="").session
try:
email, login_time, digest = session.split(',')
except __HOLE__:
return
if check_salted_hash(email + "," + login_time, digest):
return User.find(email=email) | ValueError | dataset/ETHPy150Open anandology/broadgauge/broadgauge/account.py/_get_current_user |
7,217 | def _setup_environment(environ):
import platform
# Cygwin requires some special voodoo to set the environment variables
# properly so that Oracle will see them.
if platform.system().upper().startswith('CYGWIN'):
try:
import ctypes
except __HOLE__, e:
from django.c... | ImportError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/db/backends/oracle/base.py/_setup_environment |
7,218 | def _cursor(self):
cursor = None
if not self._valid_connection():
conn_string = convert_unicode(self._connect_string())
self.connection = Database.connect(conn_string, **self.settings_dict['OPTIONS'])
cursor = FormatStylePlaceholderCursor(self.connection)
... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/db/backends/oracle/base.py/DatabaseWrapper._cursor |
7,219 | def executemany(self, query, params=None):
try:
args = [(':arg%d' % i) for i in range(len(params[0]))]
except (IndexError, __HOLE__):
# No params given, nothing to do
return None
# cx_Oracle wants no trailing ';' for SQL statements. For PL/SQL, it
# i... | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/db/backends/oracle/base.py/FormatStylePlaceholderCursor.executemany |
7,220 | def __init__(self, table, params):
BaseCache.__init__(self, params)
self._table = table
max_entries = params.get('max_entries', 300)
try:
self._max_entries = int(max_entries)
except (ValueError, TypeError):
self._max_entries = 300
cull_frequency = ... | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/core/cache/backends/db.py/CacheClass.__init__ |
7,221 | def enheap(self, i):
try:
item = next(i)
heappush(self.collection, (item, i))
except __HOLE__:
return | StopIteration | dataset/ETHPy150Open chango/inferno/inferno/lib/sorted_iterator.py/SortedIterator.enheap |
7,222 | def next(self):
removes = []
reinsert = None
rval = None
for stream in self.collection:
try:
rval = stream.next()
reinsert = stream
break
except __HOLE__:
removes.append(stream)
if rval:
... | StopIteration | dataset/ETHPy150Open chango/inferno/inferno/lib/sorted_iterator.py/AltSortedIterator.next |
7,223 | def _key(self, stream):
try:
key, value = stream.peek()
return tuple(key)
except __HOLE__:
return tuple() | StopIteration | dataset/ETHPy150Open chango/inferno/inferno/lib/sorted_iterator.py/AltSortedIterator._key |
7,224 | @classmethod
def _new_aspaths (cls, data, asn4, klass=None):
as_set = []
as_seq = []
as_cset = []
as_cseq = []
backup = data
unpacker = {
False: '!H',
True: '!L',
}
size = {
False: 2,
True: 4,
}
as_choice = {
ASPath.AS_SEQUENCE: as_seq,
ASPath.AS_SET: as_set,
ASPath.AS... | IndexError | dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/bgp/message/update/attribute/aspath.py/ASPath._new_aspaths |
7,225 | def __init__(self, *args, **kw):
from django.conf import settings
gettext_module.GNUTranslations.__init__(self, *args, **kw)
# Starting with Python 2.4, there's a function to define
# the output charset. Before 2.4, the output charset is
# identical with the translation file char... | AttributeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/translation/trans_real.py/DjangoTranslation.__init__ |
7,226 | def translation(language):
"""
Returns a translation object.
This translation object will be constructed out of multiple GNUTranslations
objects by merging their catalogs. It will construct a object for the
requested language and add a fallback to the default language, if it's
different from th... | IOError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/translation/trans_real.py/translation |
7,227 | def get_language():
"Returns the currently selected language."
t = _active.get(currentThread(), None)
if t is not None:
try:
return to_language(t.language())
except __HOLE__:
pass
# If we don't have a real translation object, assume it's the default language.
... | AttributeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/translation/trans_real.py/get_language |
7,228 | def get_value(self):
basetype = _libsmi.SmiValue_basetype_get(self)
rawval = _libsmi.SmiValue_value_get(self)
try:
return Value._BASIC[basetype](rawval)
except __HOLE__:
return Value._SPECIAL[basetype](rawval, _libsmi.SmiValue_len_get(self)) | KeyError | dataset/ETHPy150Open kdart/pycopia/SMI/pycopia/SMI/SMI.py/Value.get_value |
7,229 | def merge_spans(spans):
"""
Merge spans *in-place* within parent doc so that each takes up a single token.
Args:
spans (iterable(``spacy.Span``))
"""
for span in spans:
try:
span.merge(span.root.tag_, span.text, span.root.ent_type_)
except __HOLE__ as e:
... | IndexError | dataset/ETHPy150Open chartbeat-labs/textacy/textacy/spacy_utils.py/merge_spans |
7,230 | def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir', 'mode', 'bufsize', 'delete' are all
ignored.
Returns an object with a file-like interface; the name ... | OSError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/dist/tempfile.py/NamedTemporaryFile |
7,231 | def testGetModelClass(self):
"""Test GetModelClass()."""
try:
gaeserver.Auth1ServerDatastoreSession.GetModelClass()
self.fail('GetModelClass() did not raise NotImplementedError')
except __HOLE__:
pass | NotImplementedError | dataset/ETHPy150Open google/simian/src/tests/simian/auth/gaeserver_test.py/Auth1ServerDatastoreSessionTest.testGetModelClass |
7,232 | def _get_disk_allocation_ratio(self, host_state, spec_obj):
aggregate_vals = utils.aggregate_values_from_key(
host_state,
'disk_allocation_ratio')
try:
ratio = utils.validate_num_values(
aggregate_vals, host_state.disk_allocation_ratio,
... | ValueError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/scheduler/filters/disk_filter.py/AggregateDiskFilter._get_disk_allocation_ratio |
7,233 | def clean(self, require_validation=True):
key_attr = self.key.replace('-', '_')
# aa stands for auxilarary attribute.
if (not hasattr(self, key_attr) and
not hasattr(self, "_aa_" + key_attr)):
# ??? Do we want this?
if self.force_validation and require_val... | TypeError | dataset/ETHPy150Open rtucker-mozilla/mozilla_inventory/core/keyvalue/models.py/KeyValue.clean |
7,234 | def index(self, req):
"""Return a list of available DNS domains."""
context = req.environ['nova.context']
authorize(context)
try:
domains = self.network_api.get_dns_domains(context)
except __HOLE__:
msg = _("Unable to get dns domain")
raise web... | NotImplementedError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSDomainController.index |
7,235 | def update(self, req, id, body):
"""Add or modify domain entry."""
context = req.environ['nova.context']
authorize(context)
# NOTE(shaohe-feng): back-compatible with db layer hard-code
# admin permission checks.
nova_context.require_admin_context(context)
fqdomain... | KeyError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSDomainController.update |
7,236 | def delete(self, req, id):
"""Delete the domain identified by id."""
context = req.environ['nova.context']
authorize(context)
# NOTE(shaohe-feng): back-compatible with db layer hard-code
# admin permission checks.
nova_context.require_admin_context(context)
domain... | NotImplementedError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSDomainController.delete |
7,237 | def show(self, req, domain_id, id):
"""Return the DNS entry that corresponds to domain_id and id."""
context = req.environ['nova.context']
authorize(context)
domain = _unquote_domain(domain_id)
floating_ip = None
# Check whether id is a valid ipv4/ipv6 address.
i... | NotImplementedError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSEntryController.show |
7,238 | def update(self, req, domain_id, id, body):
"""Add or modify dns entry."""
context = req.environ['nova.context']
authorize(context)
domain = _unquote_domain(domain_id)
name = id
try:
entry = body['dns_entry']
address = entry['ip']
dns_t... | KeyError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSEntryController.update |
7,239 | def delete(self, req, domain_id, id):
"""Delete the entry identified by req and id."""
context = req.environ['nova.context']
authorize(context)
domain = _unquote_domain(domain_id)
name = id
try:
self.network_api.delete_dns_entry(context, name, domain)
... | NotImplementedError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py/FloatingIPDNSEntryController.delete |
7,240 | def checkDerivedCatch():
class A(BaseException):
pass
class B(A):
def __init__(self):
pass
a = A()
b = B()
try:
raise A, b
except B, v:
print("Caught B", v)
except A, v:
print("Didn't catch as B, but as A, Python3 does that", v)
else:... | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/checkDerivedCatch |
7,241 | def checkNonCatch1():
print("Testing if the else branch is executed in the optimizable case:")
try:
0
except __HOLE__:
print("Should not catch")
else:
print("Executed else branch correctly") | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/checkNonCatch1 |
7,242 | def checkNonCatch2():
try:
print("Testing if the else branch is executed in the non-optimizable case:")
except __HOLE__:
print("Should not catch")
else:
print("Executed else branch correctly") | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/checkNonCatch2 |
7,243 | def unpackingCatcher():
try:
raise ValueError(1,2)
except __HOLE__ as (a,b):
print("Unpacking caught exception and unpacked", a, b) | ValueError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/unpackingCatcher |
7,244 | def yieldExceptionInteraction():
def yield_raise():
print("Yield finds at generator entry", sys.exc_info()[0])
try:
raise KeyError("caught")
except __HOLE__:
yield sys.exc_info()[0]
yield sys.exc_info()[0]
yield sys.exc_info()[0]
g = yield_rai... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/yieldExceptionInteraction |
7,245 | def yieldExceptionInteraction2():
def yield_raise():
print("Yield finds at generator entry", sys.exc_info()[0])
try:
raise ValueError("caught")
except __HOLE__:
yield sys.exc_info()[0]
yield sys.exc_info()[0]
yield sys.exc_info()[0]
try:
... | ValueError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/yieldExceptionInteraction2 |
7,246 | def clearingException():
def clearit():
try:
if sys.version_info[0] < 3:
sys.exc_clear()
except __HOLE__:
pass
try:
raise KeyError
except:
print("Before clearing, it's", sys.exc_info())
clearit()
print("After clearing,... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/clearingException |
7,247 | def raiseWithFinallyNotCorruptingLineNumber():
try:
try:
raising()
finally:
not_raising()
except __HOLE__:
print("Traceback is in tried block line", sys.exc_info()[2].tb_lineno) | ValueError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/raiseWithFinallyNotCorruptingLineNumber |
7,248 | def checkReraiseAfterNestedTryExcept():
def reraise():
try:
raise TypeError("outer")
except Exception:
try:
raise KeyError("nested")
except __HOLE__:
print("Current exception inside nested handler", sys.exc_info())
... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/tests/basics/ExceptionRaising.py/checkReraiseAfterNestedTryExcept |
7,249 | def get_extractor(coarse, fine):
log.debug("getting fine extractor for '{}: {}'".format(coarse, fine))
try:
extractor = importlib.import_module(__package__+'.'+question_types[fine])
except (ImportError, __HOLE__):
log.warn("Extractor for fine type '{}: {}' not implemented".format(coarse, fin... | KeyError | dataset/ETHPy150Open jcelliott/inquire/inquire/extraction/numeric/extractors.py/get_extractor |
7,250 | def unix_getpass(prompt='Password: ', stream=None):
"""Prompt for a password, with echo turned off.
Args:
prompt: Written on stream to ask for the input. Default: 'Password: '
stream: A writable file object to display the prompt. Defaults to
the tty. If no tty is available defaults... | ValueError | dataset/ETHPy150Open ctxis/canape/CANAPE.Scripting/Lib/getpass.py/unix_getpass |
7,251 | def do_tag_cloud_for_model(parser, token):
"""
Retrieves a list of ``Tag`` objects for a given model, with tag
cloud attributes set, and stores them in a context variable.
Usage::
{% tag_cloud_for_model [model] as [varname] %}
The model is specified in ``[appname].[modelname]`` format.
... | ValueError | dataset/ETHPy150Open hzlf/openbroadcast/website/tagging_ng/templatetags/tagging_tags.py/do_tag_cloud_for_model |
7,252 | def run(self):
self.socket.setblocking(1)
pool = Pool(self.worker_connections)
self.server_class.base_env['wsgi.multiprocess'] = (self.cfg.workers > 1)
server = self.server_class(self.socket, application=self.wsgi,
spawn=pool, handler_class=self.wsgi_handler,
... | KeyboardInterrupt | dataset/ETHPy150Open abourget/pyramid_socketio/pyramid_socketio/gunicorn/workers.py/GeventSocketIOBaseWorker.run |
7,253 | def isIPAddress(addr):
"""
Determine whether the given string represents an IPv4 address.
@type addr: C{str}
@param addr: A string which may or may not be the decimal dotted
representation of an IPv4 address.
@rtype: C{bool}
@return: C{True} if C{addr} represents an IPv4 address, C{False}
... | ValueError | dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/abstract.py/isIPAddress |
7,254 | def isIPv6Address(addr):
"""
Determine whether the given string represents an IPv6 address.
@param addr: A string which may or may not be the hex
representation of an IPv6 address.
@type addr: C{str}
@return: C{True} if C{addr} represents an IPv6 address, C{False}
otherwise.
@r... | ValueError | dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/abstract.py/isIPv6Address |
7,255 | def _expect_success(self, command, text):
try:
stdout, stderr, status = self._execute_raw(command, text)
if not self.expected_returns or status in self.expected_returns:
return stdout.decode('UTF-8')
except __HOLE__ as e:
stdout, stderr, status = (None... | OSError | dataset/ETHPy150Open tylerl/FilterPipes/filterpipes.py/FilterPipesProcessCommand._expect_success |
7,256 | def AllocMem_to_kB(AllocMem):
"""Convert the AllocMem string to bytes, an int.
AllocMem is a string from `scontrol show node'. Since, comparing to
/proc/meminfo, RealMemory MB is 10**3 kB (and NOT 2**10 kB), this assumes
slurm is treating AllocMem the same.
"""
try:
return int(AllocMem)*1000
except (ValueEr... | TypeError | dataset/ETHPy150Open fasrc/slurmmon/lib/python/site-packages/slurmmon/__init__.py/AllocMem_to_kB |
7,257 | def __init__(self):
self._revivers = _revivers = {}
def loads(text):
return JSON.parse(text, _reviver)
def saves(obj):
return JSON.stringify(obj, _replacer)
def add_reviver(type_name, func):
assert isinstance(type_name, str)
... | AttributeError | dataset/ETHPy150Open zoofIO/flexx/flexx/app/serialize.py/Serializer.__init__ |
7,258 | def find_edges(states, relname):
"""
Use find() to recursively find objects at keys matching
relname, yielding a node name for every result.
"""
try:
deps = find(states, relname)
for dep in deps:
for dep_type, dep_name in dep.items():
yield make_node_name(... | AttributeError | dataset/ETHPy150Open ceralena/salt-state-graph/salt_state_graph/__init__.py/find_edges |
7,259 | @internationalizeDocstring
def nicks(self, irc, msg, args, channel):
"""[<channel>]
Returns the nicks of the people in the channel on the various networks
the bot is connected to. <channel> is only necessary if the message
isn't sent on the channel itself.
"""
realI... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Relay/plugin.py/Relay.nicks |
7,260 | def doTopic(self, irc, msg):
irc = self._getRealIrc(irc)
(channel, newTopic) = msg.args
if channel not in self.registryValue('channels'):
return
network = self._getIrcName(irc)
if self.registryValue('topicSync', channel):
m = ircmsgs.topic(channel, newTopi... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Relay/plugin.py/Relay.doTopic |
7,261 | def get_xlwt():
try:
return py_import('xlwt', {
'pip': 'xlwt',
'linux-debian': 'python-xlwt',
'linux-ubuntu': 'python-xlwt',
'linux-fedora': 'python-xlwt'},
True)
... | ImportError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/tabledata/write/write_excel.py/get_xlwt |
7,262 | @classmethod
def installed(cls):
"""
Used in ``mezzanine.pages.views.page`` to ensure
``PageMiddleware`` or a subclass has been installed. We cache
the result on the ``PageMiddleware._installed`` to only run
this once. Short path is to just check for the dotted path to
... | AttributeError | dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/middleware.py/PageMiddleware.installed |
7,263 | def process_view(self, request, view_func, view_args, view_kwargs):
"""
Per-request mechanics for the current page object.
"""
# Load the closest matching page by slug, and assign it to the
# request object. If none found, skip all further processing.
slug = path_to_slug... | TypeError | dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/middleware.py/PageMiddleware.process_view |
7,264 | def __init__(self, config, batchSystem):
"""
:type config: Config
:type batchSystem: AbstractBatchSystem
"""
super(AWSProvisioner, self).__init__()
self.batchSystem = batchSystem
ami, instanceType = ':'.split(config.nodeOptions)
preemptableAmi, preemptable... | KeyError | dataset/ETHPy150Open BD2KGenomics/toil/src/toil/provisioners/aws/provisioner.py/AWSProvisioner.__init__ |
7,265 | def test_compat():
# test we have compat with our version of nu
from pandas.computation import _NUMEXPR_INSTALLED
try:
import numexpr as ne
ver = ne.__version__
if ver == LooseVersion('2.4.4'):
assert not _NUMEXPR_INSTALLED
elif ver < LooseVersion('2.1'):
... | ImportError | dataset/ETHPy150Open pydata/pandas/pandas/computation/tests/test_compat.py/test_compat |
7,266 | def check_invalid_numexpr_version(engine, parser):
def testit():
a, b = 1, 2
res = pd.eval('a + b', engine=engine, parser=parser)
tm.assert_equal(res, 3)
if engine == 'numexpr':
try:
import numexpr as ne
except __HOLE__:
raise nose.SkipTest("no nu... | ImportError | dataset/ETHPy150Open pydata/pandas/pandas/computation/tests/test_compat.py/check_invalid_numexpr_version |
7,267 | def _get_storage_attributes(self, name):
try:
(
model_class_path,
content_field,
filename_field,
mimetype_field,
filename
) = name.split(os.sep)
except __HOLE__:
raise NameException('Wrong... | ValueError | dataset/ETHPy150Open victor-o-silva/db_file_storage/db_file_storage/storage.py/DatabaseFileStorage._get_storage_attributes |
7,268 | def __init__(self, *args, **kwargs):
try:
self.model_class_path = kwargs.pop('model_class_path')
self.content_field = kwargs.pop('content_field')
self.filename_field = kwargs.pop('filename_field')
self.mimetype_field = kwargs.pop('mimetype_field')
except _... | KeyError | dataset/ETHPy150Open victor-o-silva/db_file_storage/db_file_storage/storage.py/FixedModelDatabaseFileStorage.__init__ |
7,269 | def prep_ticks(ax, index, ax_type, props):
"""Prepare axis obj belonging to axes obj.
positional arguments:
ax - the mpl axes instance
index - the index of the axis in `props`
ax_type - 'x' or 'y' (for now)
props - an mplexporter poperties dictionary
"""
axis_dict = dict()
if ax_ty... | IndexError | dataset/ETHPy150Open plotly/plotly.py/plotly/matplotlylib/mpltools.py/prep_ticks |
7,270 | def parse_line(line, import_date):
award = {}
award['cfda'] = line[0:7].strip()
if not RE_CFDA.match(award['cfda']):
raise InvalidCFDAProgramNumber(award['cfda'])
award['action'] = line[135]
award['award_id'] = line[142:158].strip()
try:
award['award_mod'] = int(line[158:162].st... | ValueError | dataset/ETHPy150Open sunlightlabs/clearspending/timeliness/parser.py/parse_line |
7,271 | def find_files_to_process():
files_from_crawler = list(flattened(recursive_listdir(DOWNLOAD_DIR)))
files_to_process = []
files_to_ignore = []
for path in files_from_crawler:
try:
import_date = find_date(path)
size = os.path.getsize(path)
files_to_process.appe... | ValueError | dataset/ETHPy150Open sunlightlabs/clearspending/timeliness/parser.py/find_files_to_process |
7,272 | def parser_main():
(bytes_to_process,
files_to_process,
files_to_ignore) = find_files_to_process()
for path in files_to_ignore:
print "Unparseable filename: {0}".format(os.path.basename(path))
print "Files to process: {0}".format(len(files_to_process))
print "Bytes to process: {0}".... | KeyboardInterrupt | dataset/ETHPy150Open sunlightlabs/clearspending/timeliness/parser.py/parser_main |
7,273 | def show_prefixes():
def filename_has_date(filename):
try:
import_date = find_date(filename)
return True
except (__HOLE__, ImportError), err:
return False
re_agency = re.compile('^[0-9]*[A-Z]+')
def extract_prefix(filename):
prefix_match = re_agen... | ValueError | dataset/ETHPy150Open sunlightlabs/clearspending/timeliness/parser.py/show_prefixes |
7,274 | def _iter_loaders(self, template):
loader = self.app.jinja_loader
if loader is not None:
yield loader, template
# old style module based loaders in case we are dealing with a
# blueprint that is an old style module
try:
module, local_name = posixpath.norm... | ValueError | dataset/ETHPy150Open baseblack/ReproWeb/3rdParty/python/flask/templating.py/DispatchingJinjaLoader._iter_loaders |
7,275 | def execute(task, *args, **kwargs):
"""
Patched version of fabric's execute task with alternative error handling
"""
my_env = {'clean_revert': True}
results = {}
# Obtain task
is_callable = callable(task)
if not (is_callable or _is_task(task)):
# Assume string, set env.command to... | SystemExit | dataset/ETHPy150Open prestodb/presto-admin/prestoadmin/fabric_patches.py/execute |
7,276 | def __getitem__(self, key):
try:
return self.data[key]
except __HOLE__:
return self.data[key.lower()]
# Stores already-created ORMs. | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/ModelsLocals.__getitem__ |
7,277 | def __init__(self, cls, app):
self.default_app = app
self.cls = cls
# Try loading the models off the migration class; default to no models.
self.models = {}
try:
self.models_source = cls.models
except __HOLE__:
return
# Start a 'ne... | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.__init__ |
7,278 | def __getattr__(self, key):
fullname = (self.default_app+"."+key).lower()
try:
return self.models[fullname]
except __HOLE__:
raise AttributeError("The model '%s' from the app '%s' is not available in this migration. (Did you use orm.ModelName, not orm['app.ModelName']?)" ... | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.__getattr__ |
7,279 | def __getitem__(self, key):
# Detect if they asked for a field on a model or not.
if ":" in key:
key, fname = key.split(":")
else:
fname = None
# Now, try getting the model
key = key.lower()
try:
model = self.models[key]
except ... | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.__getitem__ |
7,280 | def eval_in_context(self, code, app, extra_imports={}):
"Evaluates the given code in the context of the migration file."
# Drag in the migration module's locals (hopefully including models.py)
# excluding all models from that (i.e. from modern models.py), to stop pollution
fake_... | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.eval_in_context |
7,281 | def make_meta(self, app, model, data, stub=False):
"Makes a Meta class out of a dict of eval-able arguments."
results = {'app_label': app}
for key, code in data.items():
# Some things we never want to use.
if key in ["_bases", "_ormbases"]:
continue
... | NameError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.make_meta |
7,282 | def make_model(self, app, name, data):
"Makes a Model class out of the given app name, model name and pickled data."
# Extract any bases out of Meta
if "_ormbases" in data['Meta']:
# Make sure everything we depend on is done already; otherwise, wait.
for key in d... | NameError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.make_model |
7,283 | def retry_failed_fields(self):
"Tries to re-evaluate the _failed_fields for each model."
for modelkey, model in self.models.items():
app, modelname = modelkey.split(".", 1)
if hasattr(model, "_failed_fields"):
for fname, (code, extra_imports) in model._failed_fiel... | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/orm.py/_FakeORM.retry_failed_fields |
7,284 | def configKey(self, key, val, fileName = "override", lineno = '<No line>'):
try:
option = self._cfg_def[key]
except __HOLE__:
if self._ignoreErrors:
return
raise ParseError("%s:%s: unknown config item '%s'" % (fileName,
lineno, key))
... | KeyError | dataset/ETHPy150Open sassoftware/conary/conary/lib/cfg.py/ConfigFile.configKey |
7,285 | def _openUrl(self, url):
oldTimeout = socket.getdefaulttimeout()
timeout = 2
socket.setdefaulttimeout(timeout)
# Extra headers to send up
headers = {
'X-Conary-Version' : constants.version or "UNRELEASED",
'X-Conary-Config-Version' : str(configVersion),
... | IOError | dataset/ETHPy150Open sassoftware/conary/conary/lib/cfg.py/ConfigFile._openUrl |
7,286 | def _file_is_executable(exe_name):
"""Platform-independent check if file is executable.
Args:
exe_name: file name to test.
Returns:
bool, True if exe_name is executable.
"""
if os.path.isfile(exe_name) and os.access(exe_name, os.X_OK):
if not sys.platform.startswith('win'):
# This is suffi... | OSError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/go_managedvm.py/_file_is_executable |
7,287 | def _rmtree(directory):
try:
shutil.rmtree(directory)
except __HOLE__:
pass | OSError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/go_managedvm.py/_rmtree |
7,288 | def _run_tool(tool, extra_args):
"""Run external executable tool.
Args:
tool: string name of the tool to run.
extra_args: additional arguments for tool.
Returns:
A tuple of the (stdout, stderr) from the process.
Raises:
BuildError: if tool fails.
"""
args = [tool]
if sys.platform.starts... | OSError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/devappserver2/go_managedvm.py/_run_tool |
7,289 | def test_deprecate_option(self):
# we can deprecate non-existent options
self.cf.deprecate_option('foo')
self.assertTrue(self.cf._is_deprecated('foo'))
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
try:
self.cf.ge... | KeyError | dataset/ETHPy150Open pydata/pandas/pandas/tests/test_config.py/TestConfig.test_deprecate_option |
7,290 | @synchronizedDeferred(lock)
@deferredAsThread #will catch exceptions
def getprime(self):
pfh = open(config.DRONED_PRIMES)
psize = os.stat(config.DRONED_PRIMES)[6]
if (psize % 4) != 0 or psize < 4000:
pfh.close()
raise AssertionError("primes file is corrupt/too sma... | AssertionError | dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/models/server.py/DroneServer.getprime |
7,291 | def wrap(self, func):
""" Wrap :func: to perform aggregation on :func: call.
Should be called with view instance methods.
"""
@six.wraps(func)
def wrapper(*args, **kwargs):
try:
return self.aggregate()
except __HOLE__:
retu... | KeyError | dataset/ETHPy150Open ramses-tech/nefertari/nefertari/view_helpers.py/ESAggregator.wrap |
7,292 | def condition(etag_func=None, last_modified_func=None):
"""
Decorator to support conditional retrieval (or change) for a view
function.
The parameters are callables to compute the ETag and last modified time for
the requested resource, respectively. The callables are passed the same
parameters ... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/decorators/http.py/condition |
7,293 | def VerifyPermissions(required_permission, user, permission_type):
"""Verifies a valid user is logged in.
Args:
required_permission: permission string from permissions.*.
user: models.User entity; default current user.
permission_type: string, one of permission.TYPE_* variables.
Raises:
models.Ac... | ValueError | dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/handlers/__init__.py/VerifyPermissions |
7,294 | def _get_method(self, function_name):
try:
return self.http_lib_methods(self.authorized_methods[function_name]['method']).value
except KeyError:
raise MethodNotFoundInApiException(function_name) # From dict method
except __HOLE__:
# From FixedStringWithValue
... | ValueError | dataset/ETHPy150Open biicode/client/rest/rest_api.py/RestApiClient._get_method |
7,295 | def _get_pattern(self, function_name):
try:
return self.authorized_methods[function_name]['pattern']
except __HOLE__:
raise MethodNotFoundInApiException(function_name) # From dict method | KeyError | dataset/ETHPy150Open biicode/client/rest/rest_api.py/RestApiClient._get_pattern |
7,296 | def parse(local_cache):
q = sys.stdin.read()
URL = 'http://en.wikipedia.org/w/api.php?action=query&list=search&srlimit=50&srprop=wordcount&format=json&srsearch='
URLraw = 'http://en.wikipedia.org/w/index.php?action=raw&title='
data_json = False
if local_cache:
try:
cached_data = ... | IOError | dataset/ETHPy150Open okfn/bibserver/parserscrapers_plugins/wikipedia.py/parse |
7,297 | def save(self, force_insert=False, force_update=False, *args, **kwargs):
if not self.id:
response = urllib.urlopen(self.external_image.url)
data = StringIO(response.read())
im = Image.open(data)
size = im.size
ratio = size[1] / size[0]
if... | IOError | dataset/ETHPy150Open mollyproject/mollyproject/molly/external_media/models.py/ExternalImageSized.save |
7,298 | def delete(self):
try:
os.unlink(self.get_filename())
except __HOLE__:
# Ignore errors where we're trying to delete a file that's already
# been deleted
pass
super(ExternalImageSized, self).delete() | OSError | dataset/ETHPy150Open mollyproject/mollyproject/molly/external_media/models.py/ExternalImageSized.delete |
7,299 | def lazy_property(f):
@property
@wraps(f)
def wrapper(self, *args, **kwargs):
lazy = '_lazy_' + f.__name__
try:
return getattr(self, lazy)
except __HOLE__:
result = f(self, *args, **kwargs)
setattr(self, lazy, result)
return result
... | AttributeError | dataset/ETHPy150Open chango/inferno/inferno/lib/lazy_property.py/lazy_property |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.