Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
7,700 | def record_http_status(self, status):
"""Record the HTTP status code and the end time of the HTTP request."""
try:
self.http_status = int(status)
except (__HOLE__, TypeError):
self.http_status = 0
self.end_timestamp = time.time() | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/appstats/recording.py/Recorder.record_http_status |
7,701 | def get_latest_for_name(self, klass_name, project_name):
qs = self.filter(
name=klass_name,
module__project_version__project__name=project_name,
) or self.filter(
name__iexact=klass_name,
module__project_version__project__name__iexact=project_name,
... | IndexError | dataset/ETHPy150Open refreshoxford/django-cbv-inspector/cbv/models.py/KlassManager.get_latest_for_name |
7,702 | def get_prepared_attributes(self):
attributes = self.get_attributes()
# Make a dictionary of attributes based on name
attribute_names = {}
for attr in attributes:
try:
attribute_names[attr.name] += [attr]
except __HOLE__:
attribute_... | KeyError | dataset/ETHPy150Open refreshoxford/django-cbv-inspector/cbv/models.py/Klass.get_prepared_attributes |
7,703 | def deregister(self, model):
"""
Deregisters the given model. Remove the model from the self.app as well
If the model is not already registered, this will raise
ImproperlyConfigured.
"""
try:
del self.registry[model]
except __HOLE__:
raise... | KeyError | dataset/ETHPy150Open pydanny/django-admin2/djadmin2/core.py/Admin2.deregister |
7,704 | def deregister_app_verbose_name(self, app_label):
"""
Deregisters the given app label. Remove the app label from the
self.app_verbose_names as well.
If the app label is not already registered, this will raise
ImproperlyConfigured.
"""
try:
del self.ap... | KeyError | dataset/ETHPy150Open pydanny/django-admin2/djadmin2/core.py/Admin2.deregister_app_verbose_name |
7,705 | def autodiscover(self):
"""
Autodiscovers all admin2.py modules for apps in INSTALLED_APPS by
trying to import them.
"""
for app_name in [x for x in settings.INSTALLED_APPS]:
try:
import_module("%s.admin2" % app_name)
except __HOLE__ as e:
... | ImportError | dataset/ETHPy150Open pydanny/django-admin2/djadmin2/core.py/Admin2.autodiscover |
7,706 | def Notify(self):
"""Overridden to call the given callable.
"""
try:
self.callable(*self.args, **self.kw_args)
except __HOLE__:
self.Stop()
except:
self.Stop()
raise | StopIteration | dataset/ETHPy150Open enthought/mayavi/tvtk/tools/visual.py/VTimer.Notify |
7,707 | def migrations_dir(self):
"""
Returns the full path of the migrations directory.
If it doesn't exist yet, returns where it would exist, based on the
app's migrations module (defaults to app.migrations)
"""
module_path = self.migrations_module()
try:
mo... | ImportError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migrations.migrations_dir |
7,708 | def migrations_module(self):
"Returns the module name of the migrations module for this"
app_label = application_to_app_label(self.application)
if hasattr(settings, "SOUTH_MIGRATION_MODULES"):
if app_label in settings.SOUTH_MIGRATION_MODULES:
# There's an override.
... | ImportError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migrations.migrations_module |
7,709 | def set_application(self, application, force_creation=False, verbose_creation=True):
"""
Called when the application for this Migrations is set.
Imports the migrations module object, and throws a paddy if it can't.
"""
self._application = application
if not hasattr(applic... | ImportError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migrations.set_application |
7,710 | def next_filename(self, name):
"Returns the fully-formatted filename of what a new migration 'name' would be"
highest_number = 0
for migration in self:
try:
number = int(migration.name().split("_")[0])
highest_number = max(highest_number, number)
... | ValueError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migrations.next_filename |
7,711 | def migration(self):
"Tries to load the actual migration module"
full_name = self.full_name()
try:
migration = sys.modules[full_name]
except KeyError:
try:
migration = __import__(full_name, {}, {}, ['Migration'])
except __HOLE__ as e:
... | ImportError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migration.migration |
7,712 | def no_dry_run(self):
migration_class = self.migration_class()
try:
return migration_class.no_dry_run
except __HOLE__:
return False | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/migration/base.py/Migration.no_dry_run |
7,713 | def run(self):
try:
#
# - workaround to fetch the master IP and credentials as there does not seem to
# be a way to use 10.0.0.2 from within the pod
#
assert 'KUBERNETES_MASTER' in os.environ, '$KUBERNETES_MASTER not specified (check your portal pod... | AssertionError | dataset/ETHPy150Open autodesk-cloud/ochonetes/images/portal/resources/toolset/toolset/commands/kill.py/_Automation.run |
7,714 | def form_counts(self):
"""form_counts() -> The max number of forms, some could be non-existent (deleted)."""
try:
return int(self.data[ self.add_prefix('next_form_id') ])
except __HOLE__:
return self.fields['next_form_id'].initial | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/django_forms.py/ManagementForm.form_counts |
7,715 | def full_clean(self):
"""Simlar to formsets.py:full_clean"""
self._errors = []
if not self.is_bound:
return
for f in self.forms:
self._errors.append(f.errors)
try:
self.clean()
except __HOLE__, e:
self._non_form_errors = e.messages | ValidationError | dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/django_forms.py/BaseSimpleFormSet.full_clean |
7,716 | def run(self):
# The WebSocketApp loop runs in it's own thread,
# so make sure you call TheButton.close() when you're done with it!
self.the_button.start()
try:
while True:
colour = self.the_button.ascii_colour
self.interface.write(colour.enco... | KeyboardInterrupt | dataset/ETHPy150Open ALPSquid/thebutton-monitor/src/examples/arduino_example.py/ButtonSerial.run |
7,717 | @property
def _core_properties_part(self):
"""
|CorePropertiesPart| object related to this package. Creates
a default core properties part if one is not present (not common).
"""
try:
return self.part_related_by(RT.CORE_PROPERTIES)
except __HOLE__:
... | KeyError | dataset/ETHPy150Open python-openxml/python-docx/docx/opc/package.py/OpcPackage._core_properties_part |
7,718 | def read_system_config(self):
"""Parse and store the system config settings in electrum.conf into system_config[]."""
name = '/etc/electrum.conf'
if os.path.exists(name):
try:
import ConfigParser
except __HOLE__:
print "cannot parse electru... | ImportError | dataset/ETHPy150Open bitxbay/BitXBay/electru/build/lib/electrum/simple_config.py/SimpleConfig.read_system_config |
7,719 | def read_user_config(self):
"""Parse and store the user config settings in electrum.conf into user_config[]."""
if not self.path: return
path = os.path.join(self.path, "config")
if os.path.exists(path):
try:
with open(path, "r") as f:
data... | IOError | dataset/ETHPy150Open bitxbay/BitXBay/electru/build/lib/electrum/simple_config.py/SimpleConfig.read_user_config |
7,720 | def open(file, mode="r", buffering=-1,
encoding=None, errors=None,
newline=None, closefd=True):
r"""Open file and return a stream. Raise IOError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the fi... | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/open |
7,721 | def readinto(self, b):
"""Read up to len(b) bytes into b.
Like read(), this may issue multiple reads to the underlying raw
stream, unless the latter is 'interactive'.
Returns the number of bytes read (0 for EOF).
Raises BlockingIOError if the underlying raw stream has no
... | TypeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BufferedIOBase.readinto |
7,722 | def __repr__(self):
clsname = self.__class__.__name__
try:
name = self.name
except __HOLE__:
return "<_pyio.{0}>".format(clsname)
else:
return "<_pyio.{0} name={1!r}>".format(clsname, name)
### Lower-level APIs ### | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/_BufferedIOMixin.__repr__ |
7,723 | def seek(self, pos, whence=0):
if self.closed:
raise ValueError("seek on closed file")
try:
pos.__index__
except __HOLE__:
raise TypeError("an integer is required")
if whence == 0:
if pos < 0:
raise ValueError("negative seek... | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BytesIO.seek |
7,724 | def truncate(self, pos=None):
if self.closed:
raise ValueError("truncate on closed file")
if pos is None:
pos = self._pos
else:
try:
pos.__index__
except __HOLE__:
raise TypeError("an integer is required")
... | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BytesIO.truncate |
7,725 | def _read_unlocked(self, n=None):
nodata_val = b""
empty_values = (b"", None)
buf = self._read_buf
pos = self._read_pos
# Special case for when the number of bytes to read is unspecified.
if n is None or n == -1:
self._reset_read_buf()
chunks = [b... | IOError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BufferedReader._read_unlocked |
7,726 | def _peek_unlocked(self, n=0):
want = min(n, self.buffer_size)
have = len(self._read_buf) - self._read_pos
if have < want or have <= 0:
to_read = self.buffer_size - have
while True:
try:
current = self.raw.read(to_read)
... | IOError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BufferedReader._peek_unlocked |
7,727 | def _flush_unlocked(self):
if self.closed:
raise ValueError("flush of closed file")
while self._write_buf:
try:
n = self.raw.write(self._write_buf)
except BlockingIOError:
raise RuntimeError("self.raw should implement RawIOBase: it "
... | IOError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/BufferedWriter._flush_unlocked |
7,728 | def __init__(self, buffer, encoding=None, errors=None, newline=None,
line_buffering=False):
if newline is not None and not isinstance(newline, basestring):
raise TypeError("illegal newline type: %r" % (type(newline),))
if newline not in (None, "", "\n", "\r", "\r\n"):
... | ImportError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/TextIOWrapper.__init__ |
7,729 | def __repr__(self):
try:
name = self.name
except __HOLE__:
return "<_pyio.TextIOWrapper encoding='{0}'>".format(self.encoding)
else:
return "<_pyio.TextIOWrapper name={0!r} encoding='{1}'>".format(
name, self.encoding) | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/TextIOWrapper.__repr__ |
7,730 | def read(self, n=None):
self._checkReadable()
if n is None:
n = -1
decoder = self._decoder or self._get_decoder()
try:
n.__index__
except __HOLE__:
raise TypeError("an integer is required")
if n < 0:
# Read everything.
... | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/_pyio.py/TextIOWrapper.read |
7,731 | def convert_to_color ( object, name, value ):
""" Converts a number into a QColor object.
"""
# Try the toolkit agnostic format.
try:
tup = eval(value)
except:
tup = value
if isinstance(tup, tuple):
if 3 <= len(tup) <= 4:
try:
color = QtGui.QC... | TypeError | dataset/ETHPy150Open enthought/traitsui/traitsui/qt4/color_trait.py/convert_to_color |
7,732 | def __init__(self, label='', width=32, hide=None, empty_char=BAR_EMPTY_CHAR,
filled_char=BAR_FILLED_CHAR, expected_size=None, every=1):
self.label = label
self.width = width
self.hide = hide
# Only show bar in terminals by default (better for piping, logging etc.)
... | AttributeError | dataset/ETHPy150Open kennethreitz/clint/clint/textui/progress.py/Bar.__init__ |
7,733 | def _parseIntegerArgument(args, key, defaultValue):
"""
Attempts to parse the specified key in the specified argument
dictionary into an integer. If the argument cannot be parsed,
raises a BadRequestIntegerException. If the key is not present,
return the specified default value.
"""
ret = de... | ValueError | dataset/ETHPy150Open ga4gh/server/ga4gh/backend.py/_parseIntegerArgument |
7,734 | def _parsePageToken(pageToken, numValues):
"""
Parses the specified pageToken and returns a list of the specified
number of values. Page tokens are assumed to consist of a fixed
number of integers seperated by colons. If the page token does
not conform to this specification, raise a InvalidPageToken... | ValueError | dataset/ETHPy150Open ga4gh/server/ga4gh/backend.py/_parsePageToken |
7,735 | def variantAnnotationSetsGenerator(self, request):
"""
Returns a generator over the (variantAnnotationSet, nextPageToken)
pairs defined by the specified request.
"""
compoundId = datamodel.VariantSetCompoundId.parse(request.variantSetId)
dataset = self.getDataRepository()... | ValueError | dataset/ETHPy150Open ga4gh/server/ga4gh/backend.py/Backend.variantAnnotationSetsGenerator |
7,736 | def runSearchRequest(
self, requestStr, requestClass, responseClass, objectGenerator):
"""
Runs the specified request. The request is a string containing
a JSON representation of an instance of the specified requestClass.
We return a string representation of an instance of th... | ValueError | dataset/ETHPy150Open ga4gh/server/ga4gh/backend.py/Backend.runSearchRequest |
7,737 | def runtests(*test_args):
if not test_args:
test_args = [app_to_test]
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True)
try:
from django import s... | ImportError | dataset/ETHPy150Open django-de/django-simple-ratings/runtests.py/runtests |
7,738 | @view_config(renderer='new_page.mak', route_name='new_page')
@view_config(renderer='new_post.mak', route_name='new_post')
def submit(request):
s = request.session
p = request.session['safe_post']
r = request
qs = s['safe_get']
s['message'] = "Post a story."
dbsession = DBSession()
stories = ... | AttributeError | dataset/ETHPy150Open sjuxax/raggregate/raggregate/views/submission.py/submit |
7,739 | def test_config(self):
config = ssh_schemas.RosterEntryConfig()
expected = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Roster Entry',
'description': 'Salt SSH roster entry definition',
'type': 'object',
'properties': {
... | AssertionError | dataset/ETHPy150Open saltstack/salt/tests/unit/config/schemas/ssh_test.py/RoosterEntryConfigTest.test_config |
7,740 | def test_roster_config(self):
try:
self.assertDictContainsSubset(
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Roster Configuration",
"description": "Roster entries definition",
"type... | AssertionError | dataset/ETHPy150Open saltstack/salt/tests/unit/config/schemas/ssh_test.py/RosterItemTest.test_roster_config |
7,741 | def _serialize_context(context):
# Our sending format is made up of two messages. The first has a
# quick to unpack set of meta data that our collector is going to
# use for routing and stats. This is much faster than having the
# collector decode the whole event. We're just going to use python
# st... | TypeError | dataset/ETHPy150Open rhettg/BlueOx/blueox/network.py/_serialize_context |
7,742 | def merge(length, *sources):
"""Merge lists of lists.
Each source produces (or contains) lists of ordered items.
Items of each list must be greater or equal to all items of
the previous list (that implies that items must be comparable).
The function merges the sources into lists with the length
... | StopIteration | dataset/ETHPy150Open openstack/rally/rally/common/utils.py/merge |
7,743 | def timeout_thread(queue):
"""Terminate threads by timeout.
Function need to be run in separate thread. Its designed to terminate
threads which are running longer then timeout.
Parent thread will put tuples (thread_ident, deadline) in the queue,
where `thread_ident` is Thread.ident value of thread... | ValueError | dataset/ETHPy150Open openstack/rally/rally/common/utils.py/timeout_thread |
7,744 | def islink(path):
"""Test whether a path is a symbolic link"""
try:
st = os.lstat(path)
except (os.error, __HOLE__):
return False
return stat.S_ISLNK(st.st_mode) | AttributeError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/javapath.py/islink |
7,745 | def expandvars(path):
"""Expand shell variables of form $var and ${var}.
Unknown variables are left unchanged."""
if '$' not in path:
return path
import string
varchars = string.letters + string.digits + '_-'
res = ''
index = 0
pathlen = len(path)
while index < pathlen:
... | ValueError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/javapath.py/expandvars |
7,746 | def get_mod_func(callback):
"""Convert a fully-qualified module.function name to (module, function) - stolen from Django"""
try:
dot = callback.rindex('.')
except __HOLE__:
return (callback, '')
return (callback[:dot], callback[dot+1:]) | ValueError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/get_mod_func |
7,747 | def get_callable_from_string(f_name):
"""Takes a string containing a function name (optionally module qualified) and returns a callable object"""
try:
mod_name, func_name = get_mod_func(f_name)
if mod_name == "" and func_name == "":
raise AttributeError("%s couldn't be converted to a... | AttributeError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/get_callable_from_string |
7,748 | def load_config(options):
"""Load our configuration from plist or create a default file if none exists"""
if not os.path.exists(options.config_file):
logging.info("%s does not exist - initializing with an example configuration" % CRANKD_OPTIONS.config_file)
print >>sys.stderr, 'Creating %s with ... | ImportError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/load_config |
7,749 | def add_sc_notifications(sc_config):
"""
This uses the SystemConfiguration framework to get a SCDynamicStore session
and register for certain events. See the Apple SystemConfiguration
documentation for details:
<http://developer.apple.com/documentation/Networking/Reference/SysConfig/SCDynamicStore/... | AttributeError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/add_sc_notifications |
7,750 | def add_fs_notification(f_path, callback):
"""Adds an FSEvent notification for the specified path"""
path = os.path.realpath(os.path.expanduser(f_path))
if not os.path.exists(path):
raise AttributeError("Cannot add an FSEvent notification: %s does not exist!" % path)
if not os.path.isdir(path):... | KeyError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/add_fs_notification |
7,751 | def main():
configure_logging()
global CRANKD_OPTIONS, CRANKD_CONFIG
CRANKD_OPTIONS = process_commandline()
CRANKD_CONFIG = load_config(CRANKD_OPTIONS)
if "NSWorkspace" in CRANKD_CONFIG:
add_workspace_notifications(CRANKD_CONFIG['NSWorkspace'])
if "SystemConfiguration" in CRANKD_CONF... | KeyboardInterrupt | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/main |
7,752 | def do_shell(command, context=None, **kwargs):
"""Executes a shell command with logging"""
logging.info("%s: executing %s" % (context, command))
child_env = {'CRANKD_CONTEXT': context}
# We'll pull a subset of the available information in for shell scripts.
# Anyone who needs more will probably wa... | OSError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/do_shell |
7,753 | def add_conditional_restart(file_name, reason):
"""FSEvents monitors directories, not files. This function uses stat to
restart only if the file's mtime has changed"""
file_name = os.path.realpath(file_name)
while not os.path.exists(file_name):
file_name = os.path.dirname(file_name)
orig_sta... | IOError | dataset/ETHPy150Open nigelkersten/pymacadmin/bin/crankd.py/add_conditional_restart |
7,754 | def __getattr__(self, name):
try:
return getattr(self.obj, name)
except __HOLE__:
return self.obj.get_tag(name) | AttributeError | dataset/ETHPy150Open pcapriotti/pledger/pledger/filter.py/SmartWrapper.__getattr__ |
7,755 | def get_index_path(self):
"""
Returns the index path.
Raises ImproperlyConfigured if the path is not set in the settings.
"""
try:
return settings.SEARCH_INDEX
except __HOLE__:
raise ImproperlyConfigured("Set SEARCH_INDEX into your settings.") | AttributeError | dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/Index.get_index_path |
7,756 | def get_or_create_index(self):
"""
Returns an index object.
Creats the index if it does not exist
"""
# Try to return a storage object that was created before.
try:
return self.storage
except __HOLE__:
pass
path = self.get_index_pa... | AttributeError | dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/Index.get_or_create_index |
7,757 | def index_add_instance(sender, instance, **kwargs):
"""
Receiver that should be called by the post_save signal and the m2m_changed
signal.
If the instance has an method get_search_string, then it is written
into the search index. The method has to return an dictonary that can be
used as keyword... | AttributeError | dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/index_add_instance |
7,758 | def index_del_instance(sender, instance, **kwargs):
"""
Like index_add_instance but deletes the instance from the index.
Should be called by the post_delete signal.
"""
try:
# Try to get the arrribute get_search_attributes. It is not needed
# in this method (and therefore not called... | AttributeError | dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/utils/search.py/index_del_instance |
7,759 | def remove_artists(artists):
"""
Remove a collection of matplotlib artists from a scene
:param artists: Container of artists
"""
for a in artists:
try:
a.remove()
except __HOLE__: # already removed
pass | ValueError | dataset/ETHPy150Open glue-viz/glue/glue/utils/matplotlib.py/remove_artists |
7,760 | def point_contour(x, y, data):
"""Calculate the contour that passes through (x,y) in data
:param x: x location
:param y: y location
:param data: 2D image
:type data: :class:`numpy.ndarray`
Returns:
* A (nrow, 2column) numpy array. The two columns give the x and
y locations of ... | ImportError | dataset/ETHPy150Open glue-viz/glue/glue/utils/matplotlib.py/point_contour |
7,761 | def CheckFlow(self):
urn = self.client_id.Add("/fs/tsk")
fd = aff4.FACTORY.Open(urn, mode="r", token=self.token)
volumes = list(fd.OpenChildren())
found = False
for volume in volumes:
file_urn = volume.urn.Add("Windows/regedit.exe")
fd = aff4.FACTORY.Open(file_urn, mode="r",
... | AttributeError | dataset/ETHPy150Open google/grr/grr/endtoend_tests/transfer.py/TestGetFileTSKWindows.CheckFlow |
7,762 | def _get_field_stats_dates(self, field='@timestamp'):
"""
Add indices to `index_info` based on the value the stats api returns,
as determined by `field`
:arg field: The field with the date value. The field must be mapped in
elasticsearch as a date datatype. Default: ``@tim... | KeyError | dataset/ETHPy150Open elastic/curator/curator/indexlist.py/IndexList._get_field_stats_dates |
7,763 | def filter_by_age(self, source='name', direction=None, timestring=None,
unit=None, unit_count=None, field=None, stats_result='min_value',
epoch=None, exclude=False,
):
"""
Match `indices` by relative age calculations.
:arg source: Source of index age. Can be one of 'name... | KeyError | dataset/ETHPy150Open elastic/curator/curator/indexlist.py/IndexList.filter_by_age |
7,764 | def filter_allocated(self,
key=None, value=None, allocation_type='require', exclude=True,
):
"""
Match indices that have the routing allocation rule of
`key=value` from `indices`
:arg key: The allocation attribute to check for
:arg value: The value to check f... | KeyError | dataset/ETHPy150Open elastic/curator/curator/indexlist.py/IndexList.filter_allocated |
7,765 | def testRun(self):
db = DAL(DEFAULT_URI, check_reserved=['all'])
db.define_table('person', Field('name', default="Michael"),Field('uuid'))
db.define_table('pet',Field('friend',db.person),Field('name'))
dbdict = db.as_dict(flat=True, sanitize=False)
assert isinstance(dbdict, dict)... | ImportError | dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/tests/test_dal.py/TestDALDictImportExport.testRun |
7,766 | def validate(self, image_shape, filter_shape,
border_mode='valid', subsample=(1, 1),
N_image_shape=None, N_filter_shape=None,
input=None, filters=None,
unroll_batch=None, unroll_kern=None, unroll_patch=None,
verify_grad=True, should_ra... | ValueError | dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/tests/test_conv.py/TestConv2D.validate |
7,767 | @register.tag
def categories_for_slugs(parser, token):
"""
Usage: {% categories_for_slugs "slug[,slug...]" as varname %}
Sets the variable *varname* in the context to a list of categories, given by
the list of slugs.
Useful if you want to specify a custom list of categories and override the
de... | ValueError | dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/templatetags/satchmo_category.py/categories_for_slugs |
7,768 | @register.tag
def all_products_for_category(parser, token):
"""
Usage:
1. {% all_products_for_category as varname %}
2. {% all_products_for_category for slug_var as varname %}
3. {% all_products_for_category for "slug" as varname %}
Sets the variable *varname* in the context to a list of all... | ValueError | dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/templatetags/satchmo_category.py/all_products_for_category |
7,769 | @webapi_check_local_site
@webapi_login_required
@webapi_response_errors(DOES_NOT_EXIST, NOT_LOGGED_IN, PERMISSION_DENIED)
@webapi_request_fields(
allow_unknown=True
)
def update(self, request, extra_fields={}, *args, **kwargs):
"""Updates a per-file diff.
This is used solely... | ObjectDoesNotExist | dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/webapi/resources/filediff.py/FileDiffResource.update |
7,770 | def _get_patch(self, request, *args, **kwargs):
try:
resources.review_request.get_object(request, *args, **kwargs)
filediff = self.get_object(request, *args, **kwargs)
except __HOLE__:
return DOES_NOT_EXIST
resp = HttpResponse(filediff.diff, content_type='tex... | ObjectDoesNotExist | dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/webapi/resources/filediff.py/FileDiffResource._get_patch |
7,771 | def _get_diff_data(self, request, mimetype, *args, **kwargs):
try:
resources.review_request.get_object(request, *args, **kwargs)
filediff = self.get_object(request, *args, **kwargs)
except __HOLE__:
return DOES_NOT_EXIST
highlighting = request.GET.get('syntax... | ObjectDoesNotExist | dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/webapi/resources/filediff.py/FileDiffResource._get_diff_data |
7,772 | def _make_command(f, name, attrs, cls):
if isinstance(f, Command):
raise TypeError('Attempted to convert a callback into a '
'command twice.')
try:
params = f.__click_params__
params.reverse()
del f.__click_params__
except __HOLE__:
params = []... | AttributeError | dataset/ETHPy150Open pallets/click/click/decorators.py/_make_command |
7,773 | def version_option(version=None, *param_decls, **attrs):
"""Adds a ``--version`` option which immediately ends the program
printing out the version number. This is implemented as an eager
option that prints the version and exits the program in the callback.
:param version: the version number to show. ... | ImportError | dataset/ETHPy150Open pallets/click/click/decorators.py/version_option |
7,774 | @staticmethod
def verify(encoded, allowed_users):
"""
Verify that `encoded` is a valid encoded credentials object and that
its public key matches the public key we've already seen, if any.
encoded: tuple
Encoded credentials.
allowed_users: dict
Dicti... | KeyError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/Credentials.verify |
7,775 | def get_credentials():
""" Get the current thread's credentials. """
try:
return threading.current_thread().credentials
except __HOLE__:
credentials = Credentials()
return set_credentials(credentials) | AttributeError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/get_credentials |
7,776 | def remote_access():
""" Return True if the current thread is providing remote access. """
try:
creds = threading.current_thread().credentials
except __HOLE__:
return False
else:
return creds.remote
# For some reason use of a class as a decorator doesn't count as coverage. | AttributeError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/remote_access |
7,777 | def need_proxy(meth, result, access_controller):
"""
Returns True if `result` from `meth` requires a proxy.
If no proxy types have been explicitly defined for `meth`, then
`access_controller` provides a default set.
meth: method.
Method to be checked.
result: object
Result valu... | KeyError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/need_proxy |
7,778 | def get_proxy_credentials(self, meth, credentials):
"""
If special credentials are needed while executing `meth`, return
them, else return `credentials`.
meth: method
Method to be invoked.
credentials: :class:`Credentials`
Current credentials in effect.
... | KeyError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/AccessController.get_proxy_credentials |
7,779 | def need_proxy(self, obj, attr, res):
"""
Returns True if `attr` of `obj` whose value is `res` requires a proxy.
obj: object
Object whose attribute is to be returned.
attr: string
Name of attribute accessed.
res: object
Result to be returned... | KeyError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/AccessController.need_proxy |
7,780 | def check_role(role, meth):
"""
Verifies that `role` is matched by at least one :mod:`fnmatch`-style
pattern in `meth`'s RBAC. Raises :class:`RoleError` if no match is found.
role: string
Role to be checked.
meth: method.
Method to be checked.
"""
try:
patterns = m... | AttributeError | dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/check_role |
7,781 | def getunpackers():
"""Scans the unpackers dir, finds unpackers and add them to UNPACKERS list.
An unpacker will be loaded only if it is a valid python module (name must
adhere to naming conventions) and it is not blacklisted (i.e. inserted
into BLACKLIST."""
path = __path__
prefix = __name__ + ... | ImportError | dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/jsbeautifier/unpackers/__init__.py/getunpackers |
7,782 | def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
self._last_ping_time = 0
self.client = client.DatabaseClient(self)
try:
self.ops = DatabaseOperations()
except __HOLE__:
self.ops = DatabaseOperations(self) | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/storage/speckle/python/django/backend/base.py/DatabaseWrapper.__init__ |
7,783 | def _linux_brshow(br=None):
'''
Internal, returns bridges and enslaved interfaces (GNU/Linux - brctl)
'''
brctl = _tool_path('brctl')
if br:
cmd = '{0} show {1}'.format(brctl, br)
else:
cmd = '{0} show'.format(brctl)
brs = {}
for line in __salt__['cmd.run'](cmd, python... | KeyError | dataset/ETHPy150Open saltstack/salt/salt/modules/bridge.py/_linux_brshow |
7,784 | def _netbsd_brshow(br=None):
'''
Internal, returns bridges and enslaved interfaces (NetBSD - brconfig)
'''
brconfig = _tool_path('brconfig')
if br:
cmd = '{0} {1}'.format(brconfig, br)
else:
cmd = '{0} -a'.format(brconfig)
brs = {}
start_int = False
for line in __s... | KeyError | dataset/ETHPy150Open saltstack/salt/salt/modules/bridge.py/_netbsd_brshow |
7,785 | def loop(self):
"""
main game loop. returns the final score.
"""
pause_key = self.board.PAUSE
margins = {'left': 4, 'top': 4, 'bottom': 4}
atexit.register(self.showCursor)
try:
self.hideCursor()
while True:
self.clearScree... | KeyboardInterrupt | dataset/ETHPy150Open bfontaine/term2048/term2048/game.py/Game.loop |
7,786 | def create_or_update_user(params, username):
try:
user = User.objects.get(username__exact=username)
for key, value in iter(params.items()):
setattr(user, key, value)
except __HOLE__ as e:
log.debug(e)
log.debug('Try to save user with params: {}'.format(params))
... | ObjectDoesNotExist | dataset/ETHPy150Open 2gis/badger-api/authentication/backend.py/create_or_update_user |
7,787 | def _type(self):
if self._type:
return self._type
if self._app:
app = self._app
else:
try:
app = self.tasks[0].type.app
except (IndexError, __HOLE__):
app = self.body.type.app
return app.tasks['celery.chord'] | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/core_tasks.py/_type |
7,788 | def provider_method_wrapper(tiid, provider, method_name):
# logger.info(u"{:20}: in provider_method_wrapper with {tiid} {provider_name} {method_name} with {aliases}".format(
# "wrapper", tiid=tiid, provider_name=provider.provider_name, method_name=method_name, aliases=input_aliases_dict))
product = Pr... | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/core_tasks.py/provider_method_wrapper |
7,789 | def get_data_dir():
if os.getenv(MEMSQL_LOADER_PATH_ENV, None):
target = os.environ[MEMSQL_LOADER_PATH_ENV]
else:
target = os.path.join(os.path.expanduser("~"), ".memsql-loader")
parent = os.path.dirname(target)
if not os.path.exists(parent):
print("Can't load MemSQL Loader Datab... | OSError | dataset/ETHPy150Open memsql/memsql-loader/memsql_loader/util/paths.py/get_data_dir |
7,790 | @csrf_exempt
def proxy_request(request, **kwargs):
""" generic view to proxy a request.
Args:
destination: string, the proxied url
prefix: string, the prrefix behind we proxy the path
headers: dict, custom HTTP headers
no_redirect: boolean, False by default, do not redirect to ... | ValueError | dataset/ETHPy150Open benoitc/dj-revproxy/revproxy/proxy.py/proxy_request |
7,791 | def __getattr__(self, key):
try:
return self._get(key)
except __HOLE__:
# Proxy most special vars to config for dict procotol.
if key in self._proxies:
return getattr(self.config, key)
# Otherwise, raise useful AttributeError to follow geta... | KeyError | dataset/ETHPy150Open pyinvoke/invoke/invoke/config.py/DataProxy.__getattr__ |
7,792 | def _load_file(self, prefix, absolute=False):
# Setup
found = "_{0}_found".format(prefix)
path = "_{0}_path".format(prefix)
data = "_{0}".format(prefix)
# Short-circuit if loading appears to have occurred already
if getattr(self, found) is not None:
return
... | AttributeError | dataset/ETHPy150Open pyinvoke/invoke/invoke/config.py/Config._load_file |
7,793 | def set_list_value(self, list_, index, value):
"""Sets the value of `list` specified by `index` to the given `value`.
Index '0' means the first position, '1' the second and so on.
Similarly, '-1' is the last position, '-2' second last, and so on.
Using an index that does not exist on th... | IndexError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List.set_list_value |
7,794 | def remove_from_list(self, list_, index):
"""Removes and returns the value specified with an `index` from `list`.
Index '0' means the first position, '1' the second and so on.
Similarly, '-1' is the last position, '-2' the second last, and so on.
Using an index that does not exist on th... | IndexError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List.remove_from_list |
7,795 | def get_from_list(self, list_, index):
"""Returns the value specified with an `index` from `list`.
The given list is never altered by this keyword.
Index '0' means the first position, '1' the second, and so on.
Similarly, '-1' is the last position, '-2' the second last, and so on.
... | IndexError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List.get_from_list |
7,796 | def get_index_from_list(self, list_, value, start=0, end=None):
"""Returns the index of the first occurrence of the `value` on the list.
The search can be narrowed to the selected sublist by the `start` and
`end` indexes having the same semantics as in the `Get Slice From List`
keyword.... | ValueError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List.get_index_from_list |
7,797 | def _yield_list_diffs(self, list1, list2, names):
for index, (item1, item2) in enumerate(zip(list1, list2)):
name = ' (%s)' % names[index] if index in names else ''
try:
assert_equals(item1, item2, msg='Index %d%s' % (index, name))
except __HOLE__, err:
... | AssertionError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List._yield_list_diffs |
7,798 | def _index_to_int(self, index, empty_to_zero=False):
if empty_to_zero and not index:
return 0
try:
return int(index)
except __HOLE__:
raise ValueError("Cannot convert index '%s' to an integer" % index) | ValueError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_List._index_to_int |
7,799 | def remove_from_dictionary(self, dictionary, *keys):
"""Removes the given `keys` from the `dictionary`.
If the given `key` cannot be found from the `dictionary`, it
is ignored.
Example:
| Remove From Dictionary | ${D3} | b | x | y |
=>
- ${D3} = {'a': 1, 'c': 3}... | KeyError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Collections.py/_Dictionary.remove_from_dictionary |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.