Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
8,400 | def _read_config_callback(self, data):
"""Callback function when the ZKConfigManager reads new config data.
Args:
data: A string, the new data in the config file.
"""
# In case of corrupted data.
try:
decoded_data = json.loads(data)
if type(d... | ValueError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedHashMap._read_config_callback |
8,401 | def _reload_config_data(self):
"""Reload the data from config file into ``self._dict``
Note: When changing the managed list using add() and remove() from command line, the
DataWatcher's greenlet does not work, you need to call this explicitly to update the list
so as to make following c... | IOError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedHashMap._reload_config_data |
8,402 | def _reload_config_data(self):
"""Reload the data from config file into ``self._dict``
Note: When changing the managed mapped list using add() and remove() from command line, the
DataWatcher's greenlet does not work, you need to call this explicitly to update the list
so as to make foll... | IOError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedMappedList._reload_config_data |
8,403 | def _reload_config_data(self):
"""Reload the data from config file into 'self._json_config'
Note: When changing the managed json config using set_json_config() from command line, the
DataWatcher's greenlet does not work, you need to call this explicitly to update the config
so as to mak... | IOError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedJsonConfig._reload_config_data |
8,404 | def set_data(self, new_data):
"""Serialize and persist new data to ZK.
Args:
new_value: The new json config
Returns:
True if update succeeds, False otherwise
"""
try:
old_data = self.get_data()
serialized_data = json.dumps(old_dat... | TypeError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedJsonSerializableDataConfig.set_data |
8,405 | def _reload_config_data(self):
"""Reload (and deserialize) data from the config file into 'self._data'.
Note: When changing the config using self.set_data() from the command
line, the DataWatcher's greenlet does not work, so you need to call
this method explicitly to update the config. ... | IOError | dataset/ETHPy150Open pinterest/kingpin/kingpin/manageddata/managed_datastructures.py/ManagedJsonSerializableDataConfig._reload_config_data |
8,406 | def load_input(filename):
try:
with open(filename) as f:
intermediate_code = f.read()
except (OSError, __HOLE__) as e:
print("something's wrong with %s" % filename)
exit(1)
return intermediate_code | IOError | dataset/ETHPy150Open alehander42/pseudo/pseudo/loader.py/load_input |
8,407 | def mux(seed_pool, n_samples, k, lam=256.0, pool_weights=None,
with_replacement=True, prune_empty_seeds=True, revive=False):
'''Stochastic multiplexor for generator seeds.
Given an array of Streamer objects, do the following:
1. Select ``k`` seeds at random to activate
2. Assign each a... | StopIteration | dataset/ETHPy150Open bmcfee/pescador/pescador/util.py/mux |
8,408 | def get_format_modules(reverse=False, locale=None):
"""
Returns an iterator over the format modules found in the project and Django.
"""
modules = []
if not locale or not check_for_language(get_language()) \
or not settings.USE_L10N:
return modules
... | ImportError | dataset/ETHPy150Open willhardy/Roll-Your-Own/rollyourown/commerce/utils/formatting.py/get_format_modules |
8,409 | def get_format(format_type, locale=None):
"""
For a specific format type, returns the format for the current
language (locale), defaults to the format in the settings.
format_type is the name of the format, e.g. 'DATE_FORMAT'
"""
format_type = smart_str(format_type)
if settings.USE_L10N:
... | AttributeError | dataset/ETHPy150Open willhardy/Roll-Your-Own/rollyourown/commerce/utils/formatting.py/get_format |
8,410 | def feed(request, url, feed_dict=None):
"""Provided for backwards compatibility."""
if not feed_dict:
raise Http404(_(u"No feeds are registered."))
try:
slug, param = url.split('/', 1)
except __HOLE__:
slug, param = url, ''
try:
f = feed_dict[slug]
except KeyErr... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/gis/views.py/feed |
8,411 | def _copy_data(instream, outstream):
# Copy one stream to another
sent = 0
if hasattr(sys.stdin, 'encoding'):
enc = sys.stdin.encoding
else:
enc = 'ascii'
while True:
data = instream.read(1024)
if not data:
break
sent += len(data)
logger.de... | IOError | dataset/ETHPy150Open buanzo/jiffy/gnupg.py/_copy_data |
8,412 | def _make_binary_stream(s, encoding):
if _py3k:
if isinstance(s, str):
s = s.encode(encoding)
else:
if type(s) is not str:
s = s.encode(encoding)
try:
from io import BytesIO
rv = BytesIO(s)
except __HOLE__:
rv = StringIO(s)
return rv | ImportError | dataset/ETHPy150Open buanzo/jiffy/gnupg.py/_make_binary_stream |
8,413 | def _collect_output(self, process, result, writer=None, stdin=None):
"""
Drain the subprocesses output streams, writing the collected output
to the result. If a writer thread (writing to the subprocess) is given,
make sure it's joined before returning. If a stdin stream is given,
... | IOError | dataset/ETHPy150Open buanzo/jiffy/gnupg.py/GPG._collect_output |
8,414 | def sign_file(self, file, keyid=None, passphrase=None, clearsign=True,
detach=False, binary=False):
"""sign file"""
logger.debug("sign_file: %s", file)
if binary:
args = ['-s']
else:
args = ['-sa']
# You can't specify detach-sign and clea... | IOError | dataset/ETHPy150Open buanzo/jiffy/gnupg.py/GPG.sign_file |
8,415 | def gen_key_input(self, **kwargs):
"""
Generate --gen-key input per gpg doc/DETAILS
"""
parms = {}
for key, val in list(kwargs.items()):
key = key.replace('_','-').title()
if str(val).strip(): # skip empty strings
parms[key] = val
... | KeyError | dataset/ETHPy150Open buanzo/jiffy/gnupg.py/GPG.gen_key_input |
8,416 | def get_value(self):
if self.static:
val = self.default
else:
try:
val = getattr(self, 'db_value')
except __HOLE__:
val = self.default
return self.field.to_python(val) | AttributeError | dataset/ETHPy150Open idlesign/django-siteprefs/siteprefs/utils.py/PrefProxy.get_value |
8,417 | def get_pref_model_class(app, prefs, get_prefs_func):
"""Returns preferences model class dynamically crated for a given app or None on conflict."""
model_dict = {
'_prefs_app': app,
'_get_prefs': staticmethod(get_prefs_func),
'__module__': '%s.%s' % (app, PREFS_MODULE_NAME),... | RuntimeError | dataset/ETHPy150Open idlesign/django-siteprefs/siteprefs/utils.py/get_pref_model_class |
8,418 | def test_signed_request_missing_page_data():
try:
SignedRequest(TEST_SIGNED_REQUEST_MISSING_PAGE_DATA, TEST_FACEBOOK_APPLICATION_SECRET_KEY)
except __HOLE__:
raise AssertionError('Missing page data in signed request') | KeyError | dataset/ETHPy150Open jgorset/facepy/tests/test_signed_request.py/test_signed_request_missing_page_data |
8,419 | @app.route('/pypi/check_update/<dist_name>')
def check_pypi_update(dist_name):
""" Just check for updates and return a json
with the attribute "has_update".
:param dist_name: distribution name
:rtype: json
:return: json with the attribute "has_update"
"""
pkg_res = get_pkg_res()
pkg_dis... | KeyError | dataset/ETHPy150Open perone/stallion/stallion/main.py/check_pypi_update |
8,420 | @app.route('/pypi/releases/<dist_name>')
def releases(dist_name):
""" This is the /pypi/releases/<dist_name> entry point, it is the interface
between Stallion and the PyPI RPC service when checking for updates.
:param dist_name: the package name (distribution name).
"""
pkg_res = get_pkg_res()
... | KeyError | dataset/ETHPy150Open perone/stallion/stallion/main.py/releases |
8,421 | def OpenOutput(path, mode='w'):
"""Open |path| for writing, creating directories if necessary."""
try:
os.makedirs(os.path.dirname(path))
except __HOLE__:
pass
return open(path, mode) | OSError | dataset/ETHPy150Open adobe/brackets-shell/gyp/pylib/gyp/generator/ninja.py/OpenOutput |
8,422 | def GenerateOutput(target_list, target_dicts, data, params):
user_config = params.get('generator_flags', {}).get('config', None)
if user_config:
GenerateOutputForConfig(target_list, target_dicts, data, params,
user_config)
else:
config_names = target_dicts[target_list[0]]['conf... | KeyboardInterrupt | dataset/ETHPy150Open adobe/brackets-shell/gyp/pylib/gyp/generator/ninja.py/GenerateOutput |
8,423 | def postOptions(self):
if self['in'] is None:
raise usage.UsageError("%s\nYou must specify the input filename."
% self)
if self["typein"] == "guess":
try:
self["typein"] = sob.guessType(self["in"])
except __HOLE__:
... | KeyError | dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/scripts/tapconvert.py/ConvertOptions.postOptions |
8,424 | @register.filter
def djdiv(value, arg):
"""
Divide the value by the arg, using Python 3-style division that returns
floats. If bad values are passed in, return the empty string.
"""
try:
return value / arg
except (__HOLE__, TypeError):
try:
return value / arg
... | ValueError | dataset/ETHPy150Open pydanny/dj-stripe/djstripe/templatetags/djstripe_tags.py/djdiv |
8,425 | def getNewId(self, objType):
try:
objType = self.remap[objType]
except __HOLE__:
pass
try:
id = self.ids[objType]
self.ids[objType] += 1
return id
except KeyError:
self.ids[objType] = self.beginId + 1
ret... | KeyError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/versions/v0_9_1/domain/id_scope.py/IdScope.getNewId |
8,426 | def updateBeginId(self, objType, beginId):
try:
objType = self.remap[objType]
except __HOLE__:
pass
try:
if self.ids[objType] <= beginId:
self.ids[objType] = beginId
except KeyError:
self.ids[objType] = beginId | KeyError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/versions/v0_9_1/domain/id_scope.py/IdScope.updateBeginId |
8,427 | def setBeginId(self, objType, beginId):
try:
objType = self.remap[objType]
except __HOLE__:
pass
self.ids[objType] = beginId | KeyError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/versions/v0_9_1/domain/id_scope.py/IdScope.setBeginId |
8,428 | def make_sure_path_exists(path):
logging.debug('Make sure {} exists'.format(path))
try:
os.makedirs(path)
except __HOLE__ as e:
if e.errno != errno.EEXIST:
return False
return True | OSError | dataset/ETHPy150Open eyadsibai/brute-force-plotter/brute_force_plotter/utils.py/make_sure_path_exists |
8,429 | def unescape_html(text):
"""Created by Fredrik Lundh (http://effbot.org/zone/re-sub.htm#unescape-html)"""
def fixup(m):
text = m.group(0)
if text[:2] == "&#":
# character reference
try:
if text[:3] == "&#x":
return unichr(int(text[3:-1]... | ValueError | dataset/ETHPy150Open sajao/CrisisLex/src-collect/tweepy1/utils.py/unescape_html |
8,430 | def import_simplejson():
try:
import simplejson as json
except ImportError:
try:
import json # Python 2.6+
except ImportError:
try:
from django.utils import simplejson as json # Google App Engine
except __HOLE__:
raise... | ImportError | dataset/ETHPy150Open sajao/CrisisLex/src-collect/tweepy1/utils.py/import_simplejson |
8,431 | def _construct_ring(self, param, msg='Parameter must be a sequence of LinearRings or objects that can initialize to LinearRings'):
"Helper routine for trying to construct a ring from the given parameter."
if isinstance(param, LinearRing): return param
try:
ring = LinearRing(param)
... | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/gis/geos/polygon.py/Polygon._construct_ring |
8,432 | def notifyDone(self, relay):
"""A relaying SMTP client is disconnected.
unmark all pending messages under this relay's responsibility
as being relayed, and remove the relay.
"""
for message in self.manager.managed.get(relay, ()):
if self.manager.queue.noisy:
... | KeyError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/mail/relaymanager.py/_AttemptManager.notifyDone |
8,433 | def notifyNoConnection(self, relay):
"""Relaying SMTP client couldn't connect.
Useful because it tells us our upstream server is unavailable.
"""
# Back off a bit
try:
msgs = self.manager.managed[relay]
except __HOLE__:
log.msg("notifyNoConnection... | KeyError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/mail/relaymanager.py/_AttemptManager.notifyNoConnection |
8,434 | def markGood(self, mx):
"""Indicate a given mx host is back online.
@type mx: C{str}
@param mx: The hostname of the host which is up.
"""
try:
del self.badMXs[mx]
except __HOLE__:
pass | KeyError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/mail/relaymanager.py/MXCalculator.markGood |
8,435 | def __init__(self, nagcat, conf):
BaseTest.__init__(self, conf)
self._nagcat = nagcat
self._test = conf.get('test', "")
self._description = conf.get('description', self._test)
self._documentation = conf.get('documentation', "")
self._investigation = conf.get('investigati... | KeyError | dataset/ETHPy150Open marineam/nagcat/python/nagcat/test.py/Test.__init__ |
8,436 | def read_content(self, stream=False):
db = get_blob_db()
try:
blob = db.get(self.blob_id, self._blobdb_bucket())
except (__HOLE__, NotFound, BadName):
raise AttachmentNotFound(self.name)
if stream:
return blob
with blob:
return bl... | KeyError | dataset/ETHPy150Open dimagi/commcare-hq/corehq/form_processor/models.py/AbstractAttachment.read_content |
8,437 | def walkTroveSet(self, topTrove, ignoreMissing = True,
withFiles=True, asTuple=True):
"""
Generator returns all of the troves included by topTrove, including
topTrove itself. It is a depth first search of strong refs. Punchouts
are taken into account.
@param... | KeyError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/AbstractTroveSource.walkTroveSet |
8,438 | def iterFilesInTrove(self, n, v, f, sortByPath=False, withFiles=False,
capsules = False):
try:
cs = self.troveCsMap[n,v,f]
except __HOLE__:
raise errors.TroveMissing(n, v)
trvCs = cs.getNewTroveVersion(n,v,f)
fileList = trvCs.getNewFileLi... | KeyError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/ChangesetFilesTroveSource.iterFilesInTrove |
8,439 | def getTroves(self, troveList, withFiles = True, allowMissing=True,
callback=None):
troveList = list(enumerate(troveList)) # make a copy and add indexes
numTroves = len(troveList)
results = [None] * numTroves
for source in self.sources:
newTroveList = []
... | NotImplementedError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/SourceStack.getTroves |
8,440 | def getFileVersions(self, fileIds):
results = [ None ] * len(fileIds)
needed = list(enumerate(fileIds))
for source in self.sources:
try:
newResults = source.getFileVersions([ x[1] for x in needed ])
for result, (i, info) in itertools.izip(newResults, n... | NotImplementedError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/SourceStack.getFileVersions |
8,441 | def getFileVersion(self, pathId, fileId, version):
for source in self.sources:
try:
return source.getFileVersion(pathId, fileId, version)
# FIXME: there should be a better error for this
except (KeyError, __HOLE__), e:
continue
return N... | NotImplementedError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/SourceStack.getFileVersion |
8,442 | def iterFilesInTrove(self, n, v, f, *args, **kw):
for source in self.sources:
try:
for value in source.iterFilesInTrove(n, v, f, *args, **kw):
yield value
return
except __HOLE__:
pass
except errors.TroveMissi... | NotImplementedError | dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/SourceStack.iterFilesInTrove |
8,443 | def clever_reset_ref(git_project, ref, raises=True):
""" Resets only if needed, fetches only if needed """
try:
remote_name = git_project.default_remote.name
except __HOLE__:
error_msg = "Project {} has no default remote, defaulting to origin"
ui.error(error_msg.format(git_project.na... | AttributeError | dataset/ETHPy150Open aldebaran/qibuild/python/qisrc/reset.py/clever_reset_ref |
8,444 | def _import_class_or_module(self, name):
"""
Import a class using its fully-qualified *name*.
"""
try:
path, base = self.py_sig_re.match(name).groups()
except:
raise ValueError(
"Invalid class or module '%s' specified for inheritance diagra... | ImportError | dataset/ETHPy150Open ipython/ipython-py3k/docs/sphinxext/inheritance_diagram.py/InheritanceGraph._import_class_or_module |
8,445 | def run_dot(self, args, name, parts=0, urls={},
graph_options={}, node_options={}, edge_options={}):
"""
Run graphviz 'dot' over this graph, returning whatever 'dot'
writes to stdout.
*args* will be passed along as commandline arguments.
*name* is the name of th... | OSError | dataset/ETHPy150Open ipython/ipython-py3k/docs/sphinxext/inheritance_diagram.py/InheritanceGraph.run_dot |
8,446 | def _validate_volume(driver_info, volume_id):
"""Validates if volume is in Storage pools designated for ironic."""
volume = _get_volume(driver_info, volume_id)
# Check if the ironic <scard>/ironic-<pool_id>/<volume_id> naming scheme
# is present in volume id
try:
pool_id = volume.id.split(... | IndexError | dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/seamicro.py/_validate_volume |
8,447 | @staticmethod
def eval_config_parameter(param):
"""
Try to evaluate the given parameter as a string or integer and return
it properly. This is used to parse i3status configuration parameters
such as 'disk "/home" {}' or worse like '"cpu_temperature" 0 {}'.
"""
params ... | NameError | dataset/ETHPy150Open ultrabug/py3status/py3status/i3status.py/I3status.eval_config_parameter |
8,448 | @staticmethod
def eval_config_value(value):
"""
Try to evaluate the given parameter as a string or integer and return
it properly. This is used to parse i3status configuration parameters
such as 'disk "/home" {}' or worse like '"cpu_temperature" 0 {}'.
"""
if value.lo... | ValueError | dataset/ETHPy150Open ultrabug/py3status/py3status/i3status.py/I3status.eval_config_value |
8,449 | def i3status_config_reader(self, i3status_config_path):
"""
Parse i3status.conf so we can adapt our code to the i3status config.
"""
config = {
'general': {
'color_bad': '#FF0000',
'color_degraded': '#FFFF00',
'color_good': '#00... | ValueError | dataset/ETHPy150Open ultrabug/py3status/py3status/i3status.py/I3status.i3status_config_reader |
8,450 | @staticmethod
def write_in_tmpfile(text, tmpfile):
"""
Write the given text in the given tmpfile in python2 and python3.
"""
try:
tmpfile.write(text)
except __HOLE__:
tmpfile.write(str.encode(text)) | TypeError | dataset/ETHPy150Open ultrabug/py3status/py3status/i3status.py/I3status.write_in_tmpfile |
8,451 | @profile
def run(self):
"""
Spawn i3status using a self generated config file and poll its output.
"""
try:
with NamedTemporaryFile(prefix='py3status_') as tmpfile:
self.write_tmp_i3status_config(tmpfile)
syslog(LOG_INFO,
... | OSError | dataset/ETHPy150Open ultrabug/py3status/py3status/i3status.py/I3status.run |
8,452 | def _do_action(self, action, path, *args, **kwargs):
"""Call **action** on each filesystem object in turn. If one raises an
:py:class:`IOError`, save the exception and try the rest. If none
succeed, re-raise the first exception.
"""
first_exception = None
for fs in self... | IOError | dataset/ETHPy150Open Yelp/mrjob/mrjob/fs/composite.py/CompositeFilesystem._do_action |
8,453 | def ensure_exists(path):
try:
os.makedirs(path)
except __HOLE__ as e:
if e.errno == errno.EEXIST: # (path exists)
pass
if not os.path.isdir(path):
raise | OSError | dataset/ETHPy150Open memex-explorer/memex-explorer/source/apps/crawl_space/utils.py/ensure_exists |
8,454 | def rm_if_exists(filename):
try:
os.remove(filename)
return True
except __HOLE__ as e:
if e.errno != errno.ENOENT: # (no such file or directory)
raise
return False | OSError | dataset/ETHPy150Open memex-explorer/memex-explorer/source/apps/crawl_space/utils.py/rm_if_exists |
8,455 | def parse_provider_config(type, config):
try:
instance = manager.get(type)
except KeyError:
raise ApiError(
message='Invalid provider: {}'.format(type),
name='invalid_provider',
)
result = {}
all_options = chain(instance.get_default_options().items(),
... | ValueError | dataset/ETHPy150Open getsentry/freight/freight/providers/utils.py/parse_provider_config |
8,456 | def absent(name):
'''
Ensures that the user does not exist, eventually delete user.
.. versionadded:: 2016.3.0
:param name: user alias
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix pass... | KeyError | dataset/ETHPy150Open saltstack/salt/salt/states/zabbix_user.py/absent |
8,457 | def _iso_to_datetime(self, isodate):
date_formats = ('%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%dT%H:%M:%S%z')
date = None
for date_format in date_formats:
try:
date = datetime.strptime(isodate, date_format)
except __HOLE__:
pass
if date:
... | ValueError | dataset/ETHPy150Open apache/libcloud/libcloud/loadbalancer/drivers/rackspace.py/RackspaceLBDriver._iso_to_datetime |
8,458 | def _plot_labels(target, *labels):
for l in labels:
have_label = False
for child in target.get_children():
try:
if child.get_text() == l['s'] and child.get_position() == (l['x'], l['y']):
have_label = True
break
except _... | AttributeError | dataset/ETHPy150Open scot-dev/scot/scot/plotting.py/_plot_labels |
8,459 | def __call__(self, environ, start_response):
url = []
def change_response(status, headers, exc_info=None):
status_code = status.split(' ')
try:
code = int(status_code[0])
except (ValueError, __HOLE__):
raise Exception(
... | TypeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/errordocument.py/StatusBasedForward.__call__ |
8,460 | def make_errordocument(app, global_conf, **kw):
"""
Paste Deploy entry point to create a error document wrapper.
Use like::
[filter-app:main]
use = egg:Paste#errordocument
next = real-app
500 = /lib/msg/500.html
404 = /lib/msg/404.html
"""
map = {}
for s... | ValueError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/errordocument.py/make_errordocument |
8,461 | def __call__(self, environ, start_response):
url = []
code_message = []
try:
def change_response(status, headers, exc_info=None):
new_url = None
parts = status.split(' ')
try:
code = int(parts[0])
exc... | TypeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/errordocument.py/_StatusBasedRedirect.__call__ |
8,462 | def _run_policies(self, envelope):
results = [envelope]
def recurse(current, i):
try:
policy = self.queue_policies[i]
except __HOLE__:
return
ret = policy.apply(current)
if ret:
results.remove(current)
... | IndexError | dataset/ETHPy150Open slimta/python-slimta/slimta/queue/__init__.py/Queue._run_policies |
8,463 | def _dequeue(self, id):
try:
envelope, attempts = self.store.get(id)
except __HOLE__:
return
if id not in self.active_ids:
self.active_ids.add(id)
self._pool_spawn('relay', self._attempt, id, envelope, attempts) | KeyError | dataset/ETHPy150Open slimta/python-slimta/slimta/queue/__init__.py/Queue._dequeue |
8,464 | def _wait_store(self):
while True:
try:
for entry in self.store.wait():
self._add_queued(entry)
except __HOLE__:
return | NotImplementedError | dataset/ETHPy150Open slimta/python-slimta/slimta/queue/__init__.py/Queue._wait_store |
8,465 | def _wait_ready(self, now):
try:
first = self.queued[0]
except __HOLE__:
self.wake.wait()
self.wake.clear()
return
first_timestamp = first[0]
if first_timestamp > now:
self.wake.wait(first_timestamp-now)
self.wake.cl... | IndexError | dataset/ETHPy150Open slimta/python-slimta/slimta/queue/__init__.py/Queue._wait_ready |
8,466 | def parse_argspec(obj_or_str):
if isinstance(obj_or_str, basestring):
obj_or_str = obj_or_str.strip()
if not obj_or_str.endswith(":"):
obj_or_str += ":"
if not obj_or_str.startswith("def "):
obj_or_str = "def " + obj_or_str
try:
tree = ast.parse(ob... | ValueError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/matplotlib/parse.py/parse_argspec |
8,467 | def parse_plots(plot_types, table_overrides):
def get_module_base(n):
return n
def get_super_base(n):
return "plot"
module_specs = []
for plot in plot_types:
port_specs = {}
print "========================================"
print plot
print "==============... | AttributeError | dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/matplotlib/parse.py/parse_plots |
8,468 | def info(name):
'''
Return information about a group
CLI Example:
.. code-block:: bash
salt '*' group.info foo
'''
try:
grinfo = grp.getgrnam(name)
except __HOLE__:
return {}
else:
return _format_info(grinfo) | KeyError | dataset/ETHPy150Open saltstack/salt/salt/modules/groupadd.py/info |
8,469 | def get_related_tags(self, request, **kwargs):
""" Can be used to get all tags used by all CommitteeMeetings of a specific committee
"""
try:
ctype = ContentType.objects.get_by_natural_key(kwargs['app_label'], kwargs['object_type'])
except ContentType.DoesNotExist:
... | AttributeError | dataset/ETHPy150Open ofri/Open-Knesset/auxiliary/api.py/TagResource.get_related_tags |
8,470 | def _plot_sources_raw(ica, raw, picks, exclude, start, stop, show, title,
block):
"""Function for plotting the ICA components as raw array."""
color = _handle_default('color', (0., 0., 0.))
orig_data = ica._transform_raw(raw, 0, len(raw.times)) * 0.2
if picks is None:
picks... | TypeError | dataset/ETHPy150Open mne-tools/mne-python/mne/viz/ica.py/_plot_sources_raw |
8,471 | def _plot_sources_epochs(ica, epochs, picks, exclude, start, stop, show,
title, block):
"""Function for plotting the components as epochs."""
data = ica._transform_epochs(epochs, concatenate=True)
eog_chs = pick_types(epochs.info, meg=False, eog=True, ref_meg=False)
ecg_chs = pi... | TypeError | dataset/ETHPy150Open mne-tools/mne-python/mne/viz/ica.py/_plot_sources_epochs |
8,472 | def list_projects(folders, folder = None, user = None):
'''List all folders or all subfolders of a folder.
If folder is provided, this method will output a list of subfolders
contained by it. Otherwise, a list of all top-level folders is produced.
:param folders: reference to folder.Folders instance
... | KeyError | dataset/ETHPy150Open dossier/dossier.models/dossier/models/query.py/list_projects |
8,473 | def run(hide=False, more=False, start="01-01-2012", end=None):
"""Update local game data."""
# get today's information
year = date.today().year
month = date.today().month
day = date.today().day
# get ending date information
if end != None:
end_month, end_day, end_year = end.split("-"... | OSError | dataset/ETHPy150Open zachpanz88/mlbgame/mlbgame/update.py/run |
8,474 | def _yaml_include(self, loader, node):
"""
Include another yaml file from main file
This is usually done by registering !include tag
"""
filepath = node.value
if not os.path.exists(filepath):
for dir in self.conf_dirs:
filepath = os.path.join(d... | IOError | dataset/ETHPy150Open gooddata/smoker/smoker/server/daemon.py/Smokerd._yaml_include |
8,475 | def _load_config(self):
"""
Load specified config file
"""
try:
with open(self.conf['config'], 'r') as fp:
config = fp.read()
except __HOLE__ as e:
lg.error("Can't read config file %s: %s" % (self.conf['config'], e))
raise
... | IOError | dataset/ETHPy150Open gooddata/smoker/smoker/server/daemon.py/Smokerd._load_config |
8,476 | def run(self):
"""
Run daemon
* change effective uid/gid
* start thread for each check
* start webserver
"""
lg.info("Starting daemon")
# Change effective UID/GID
if self.conf.has_key('uid') and self.conf.has_key('gid'):
if os.geteu... | KeyError | dataset/ETHPy150Open gooddata/smoker/smoker/server/daemon.py/Smokerd.run |
8,477 | def validate_start_time(value):
try:
datetime.strptime(value, '%d.%m.%Y %H:%M')
except __HOLE__:
raise DjangoValidationError(_('Invalid input.')) | ValueError | dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/agenda/signals.py/validate_start_time |
8,478 | def __getattr__(self, key):
try: return self[key]
except __HOLE__, k: return None | KeyError | dataset/ETHPy150Open limodou/uliweb/uliweb/utils/storage.py/Storage.__getattr__ |
8,479 | def __delattr__(self, key):
try: del self[key]
except __HOLE__, k: raise AttributeError, k | KeyError | dataset/ETHPy150Open limodou/uliweb/uliweb/utils/storage.py/Storage.__delattr__ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.