Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
600 | def _getRedo(self, channel):
try:
return self.redos[channel].pop()
except (KeyError, __HOLE__):
return None | IndexError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/Topic._getRedo |
601 | def _formatTopics(self, irc, channel, topics, fit=False):
topics = [s for s in topics if s and not s.isspace()]
self.lastTopics[channel] = topics
newTopic = self._joinTopic(channel, topics)
try:
maxLen = irc.state.supported['topiclen']
if fit:
whil... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/Topic._formatTopics |
602 | def do315(self, irc, msg):
# Try to restore the topic when not set yet.
channel = msg.args[1]
c = irc.state.channels.get(channel)
if c is None or not self.registryValue('setOnJoin', channel):
return
if irc.nick not in c.ops and 't' in c.modes:
self.log.deb... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/Topic.do315 |
603 | def restore(self, irc, msg, args, channel):
"""[<channel>]
Restores the topic to the last topic set by the bot. <channel> is only
necessary if the message isn't sent in the channel itself.
"""
self._checkManageCapabilities(irc, msg, channel)
try:
topics = se... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/Topic.restore |
604 | def refresh(self, irc, msg, args, channel):
"""[<channel>]
Refreshes current topic set by anyone. Restores topic if empty.
<channel> is only necessary if the message isn't sent in the channel
itself.
"""
self._checkManageCapabilities(irc, msg, channel)
topic = irc... | KeyError | dataset/ETHPy150Open ProgVal/Limnoria/plugins/Topic/plugin.py/Topic.refresh |
605 | def cufftCheckStatus(status):
"""Raise an exception if the specified CUBLAS status is an error."""
if status != 0:
try:
raise cufftExceptions[status]
except __HOLE__:
raise cufftError
# Data transformation types: | KeyError | dataset/ETHPy150Open lebedov/scikit-cuda/skcuda/cufft.py/cufftCheckStatus |
606 | def parse_metadata_line(self):
if isinstance(self.metadata_line, dict):
return self.metadata_line
source = self.source
if source is None:
return None
with open(source, 'r') as f:
first_line = f.readline().strip()
try:
parsed_json... | ValueError | dataset/ETHPy150Open jmathai/elodie/elodie/media/text.py/Text.parse_metadata_line |
607 | def __getitem__(self, index):
if not isinstance(index, int):
return self.first[index]
try:
return super(ElementList, self).__getitem__(index)
except __HOLE__:
raise ElementDoesNotExist(
u'no elements could be found with {0} "{1}"'.format(
... | IndexError | dataset/ETHPy150Open cobrateam/splinter/splinter/element_list.py/ElementList.__getitem__ |
608 | def __getattr__(self, name):
try:
return getattr(self.first, name)
except (ElementDoesNotExist, __HOLE__):
raise AttributeError(u"'{0}' object has no attribute '{1}'".format(
self.__class__.__name__, name)) | AttributeError | dataset/ETHPy150Open cobrateam/splinter/splinter/element_list.py/ElementList.__getattr__ |
609 | def fetch(self, url, body=None, headers=None):
if body is None:
if url in self.get_responses:
return self.get_responses[url]
else:
try:
body.index('openid.mode=associate')
except __HOLE__:
pass # fall through
... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/openid/test/test_consumer.py/TestFetcher.fetch |
610 | def test_notAList(self):
# XXX: should be a Message object test, not a consumer test
# Value should be a single string. If it's a list, it should generate
# an exception.
query = {'openid.mode': ['cancel']}
try:
r = Message.fromPostArgs(query)
except __HOLE_... | TypeError | dataset/ETHPy150Open CollabQ/CollabQ/openid/test/test_consumer.py/TestQueryFormat.test_notAList |
611 | def iter_over_requirement(tokens):
"""Yield a single requirement 'block' (i.e. a sequence of tokens between
comma).
Parameters
----------
tokens: iterator
Iterator of tokens
"""
while True:
block = []
token = six.advance_iterator(tokens)
try:
whil... | StopIteration | dataset/ETHPy150Open enthought/depsolver/depsolver/requirement_parser.py/iter_over_requirement |
612 | def get_sq_ext(filename):
"""
Gets the squadron extension from filename.
Keyword arguments:
filename -- the file to get the extension from
"""
try:
return filename[filename.rindex('~')+1:]
except __HOLE__:
return '' | ValueError | dataset/ETHPy150Open gosquadron/squadron/squadron/template.py/get_sq_ext |
613 | def load_locs_json(domain, selected_loc_id=None, include_archived=False,
user=None, only_administrative=False):
"""initialize a json location tree for drill-down controls on
the client. tree is only partially initialized and branches
will be filled in on the client via ajax.
what is initialized... | IndexError | dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/locations/util.py/load_locs_json |
614 | def build_compilers():
# noinspection PyShadowingNames
compilers = {}
for compiler_path in settings.COMPILERS:
compiler_options = {}
if isinstance(compiler_path, (tuple, list)):
if len(compiler_path) != 2:
raise django.core.exceptions.ImproperlyConfigured(
... | ValueError | dataset/ETHPy150Open andreyfedoseev/django-static-precompiler/static_precompiler/utils.py/build_compilers |
615 | def get_compiler_by_name(name):
try:
return get_compilers()[name]
except __HOLE__:
raise exceptions.CompilerNotFound("There is no compiler with name '{0}'.".format(name)) | KeyError | dataset/ETHPy150Open andreyfedoseev/django-static-precompiler/static_precompiler/utils.py/get_compiler_by_name |
616 | def o_string(self, s, toenc, fromenc='latin_1'):
"""
Converts a String or Unicode String to a byte string of specified encoding.
@param toenc: Encoding which we wish to convert to. This can be either ID3V2_FIELD_ENC_* or the actual python encoding type
@param fromenc: converting from en... | UnicodeDecodeError | dataset/ETHPy150Open Ciantic/pytagger/tagger/id3v2frame.py/ID3v2BaseFrame.o_string |
617 | def x_text(self):
"""
Extract Text Fields
@todo: handle multiple strings seperated by \x00
sets: encoding, strings
"""
data = self.rawdata
self.encoding = encodings[ord(data[0])]
rawtext = data[1:]
if normalize_encoding(self.encoding) ==... | UnicodeDecodeError | dataset/ETHPy150Open Ciantic/pytagger/tagger/id3v2frame.py/ID3v2BaseFrame.x_text |
618 | def load_tests(loader, tests, ignore):
try:
import sklearn
except __HOLE__:
pass
else:
tests.addTests(doctest.DocTestSuite())
return tests | ImportError | dataset/ETHPy150Open Twangist/log_calls/log_calls/tests/test_with_sklearn/test_decorate_sklearn_KMeans_functions.py/load_tests |
619 | def clean(self):
# if it's inactive, then do no validation
if self.is_active is False:
return
# check against TWITTER_DEFAULT_USERNAME
if self.user.username == settings.TWITTER_DEFAULT_USERNAME:
raise ValidationError('''Streamsample is also configured to
... | ValueError | dataset/ETHPy150Open gwu-libraries/social-feed-manager/sfm/ui/models.py/TwitterFilter.clean |
620 | @property
def apps(self):
INSTALLED_APPS = []
try:
import whoosh
except Exception as e:
try:
import haystack
except __HOLE__ as e:
warnings.warn(
'Haystack search engine is disabled because: {}'.format(e... | ImportError | dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/module/search/__init__.py/Default.apps |
621 | def __call__(self, environ, start_response):
# Request for this state, modified by replace_start_response()
# and used when an error is being reported.
state = {}
def replacement_start_response(status, headers, exc_info=None):
"""Overrides the default response to make errors... | ValueError | dataset/ETHPy150Open openstack/ironic/ironic/api/middleware/parsable_error.py/ParsableErrorMiddleware.__call__ |
622 | def test_config_with_non_package_relative_import(self):
from pecan import configuration
with tempfile.NamedTemporaryFile('wb', suffix='.py') as f:
f.write(b_('\n'.join(['from . import variables'])))
f.flush()
configuration.Config({})
try:
... | ValueError | dataset/ETHPy150Open pecan/pecan/pecan/tests/test_conf.py/TestConf.test_config_with_non_package_relative_import |
623 | def _get_interface_name_from_hosting_port(self, port):
"""
Extract the underlying subinterface name for a port
e.g. Port-channel10.200 or GigabitEthernet0/0/0.500
"""
try:
vlan = port['hosting_info']['segmentation_id']
int_prefix = port['hosting_info']['ph... | KeyError | dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_routing_driver.py/ASR1kRoutingDriver._get_interface_name_from_hosting_port |
624 | def clear_cached_posts(sender, instance, **kwargs):
"""when a model is saved clear the cache on the query
and the cache on it's rendered page
- archive_dates
- posts_published
- posts_idea
- posts_draft
- posts_hidden
- tags_and_counts
- view post
- archive month
- all tags ... | ValueError | dataset/ETHPy150Open jamiecurle/django-omblog/omblog/listeners.py/clear_cached_posts |
625 | def post_create_slug(sender, instance, **kwargs):
"""Create a slug on freshly created blog posts"""
if instance.pk and instance.slug is not None:
return
slug = slugify(instance.title)
try:
sender.objects.exclude(pk__in=[instance.pk])\
.get(slug=slug)
# append ra... | AttributeError | dataset/ETHPy150Open jamiecurle/django-omblog/omblog/listeners.py/post_create_slug |
626 | def Get(self, db, key, *args, **kwargs):
"""
Handles GET message command.
Executes a Get operation over the leveldb backend.
db => LevelDB object
*args => (key) to fetch
"""
try:
return success(db.Get(key))
except __HOLE__:
... | KeyError | dataset/ETHPy150Open oleiade/Elevator/debian/elevator/usr/lib/python2.6/dist-packages/elevator/api.py/Handler.Get |
627 | def MGet(self, db, keys, *args, **kwargs):
def get_or_none(key, context):
try:
res = db.Get(key)
except __HOLE__:
warning_msg = "Key {0} does not exist".format(key)
context['status'] = WARNING_STATUS
errors_logger.warning(wa... | KeyError | dataset/ETHPy150Open oleiade/Elevator/debian/elevator/usr/lib/python2.6/dist-packages/elevator/api.py/Handler.MGet |
628 | def Put(self, db, key, value, *args, **kwargs):
"""
Handles Put message command.
Executes a Put operation over the leveldb backend.
db => LevelDB object
*args => (key, value) to update
"""
try:
return success(db.Put(key, value))
... | TypeError | dataset/ETHPy150Open oleiade/Elevator/debian/elevator/usr/lib/python2.6/dist-packages/elevator/api.py/Handler.Put |
629 | def Slice(self, db, key_from, offset, *args, **kwargs):
"""Returns a slice of the db. `offset` keys,
starting a `key_from`"""
# Operates over a snapshot in order to return
# a consistent state of the db
db_snapshot = db.CreateSnapshot()
it = db_snapshot.RangeIter(key_from... | StopIteration | dataset/ETHPy150Open oleiade/Elevator/debian/elevator/usr/lib/python2.6/dist-packages/elevator/api.py/Handler.Slice |
630 | def Batch(self, db, collection, *args, **kwargs):
batch = leveldb.WriteBatch()
batch_actions = {
SIGNAL_BATCH_PUT: batch.Put,
SIGNAL_BATCH_DELETE: batch.Delete,
}
try:
for command in collection:
signal, args = destructurate(command)
... | KeyError | dataset/ETHPy150Open oleiade/Elevator/debian/elevator/usr/lib/python2.6/dist-packages/elevator/api.py/Handler.Batch |
631 | def test_mro(self):
# in Python 2.3, this raises TypeError: MRO conflict among bases classes,
# in Python 2.2 it works.
#
# But in early versions of _ctypes.c, the result of tp_new
# wasn't checked, and it even crashed Python.
# Found by Greg Chapman.
try:
... | TypeError | dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/ctypes/test/test_functions.py/FunctionTestCase.test_mro |
632 | def post_comment(request):
"""
Post a comment
Redirects to the `comments.comments.comment_was_posted` view upon success.
Templates: `comment_preview`
Context:
comment
the comment being posted
comment_form
the comment form
options
comment ... | ObjectDoesNotExist | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/views/comments.py/post_comment |
633 | def post_free_comment(request):
"""
Post a free comment (not requiring a log in)
Redirects to `comments.comments.comment_was_posted` view on success.
Templates: `comment_free_preview`
Context:
comment
comment being posted
comment_form
comment form object
... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/views/comments.py/post_free_comment |
634 | def comment_was_posted(request):
"""
Display "comment was posted" success page
Templates: `comment_posted`
Context:
object
The object the comment was posted on
"""
obj = None
if request.GET.has_key('c'):
content_type_id, object_id = request.GET['c'].split(':')
... | ObjectDoesNotExist | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/views/comments.py/comment_was_posted |
635 | def main():
''' Main method, takes care of loading data, running it through the various analyses
and reporting the results
'''
# Handle command-line arguments
parser = optparse.OptionParser()
parser.add_option('--alexa-file', default='data/alexa_100k.csv', help='Alexa file to pull from. D... | KeyboardInterrupt | dataset/ETHPy150Open ClickSecurity/data_hacking/dga_detection/dga_model_gen.py/main |
636 | def store(self, section, key, data, dtype='json'):
assert dtype in ('json',)
if not self.enabled:
return
fn = self._get_cache_fn(section, key, dtype)
try:
try:
os.makedirs(os.path.dirname(fn))
except __HOLE__ as ose:
i... | OSError | dataset/ETHPy150Open yasoob/youtube-dl-GUI/youtube_dl/cache.py/Cache.store |
637 | def load(self, section, key, dtype='json', default=None):
assert dtype in ('json',)
if not self.enabled:
return default
cache_fn = self._get_cache_fn(section, key, dtype)
try:
try:
with io.open(cache_fn, 'r', encoding='utf-8') as cachef:
... | IOError | dataset/ETHPy150Open yasoob/youtube-dl-GUI/youtube_dl/cache.py/Cache.load |
638 | def standardize_patterns(column_names, patterns):
"""
Given patterns in any of the permitted input forms, return a dict whose keys
are column indices and whose values are functions which return a boolean value whether the value passes.
If patterns is a dictionary and any of its keys are values in column... | AttributeError | dataset/ETHPy150Open wireservice/csvkit/csvkit/grep.py/standardize_patterns |
639 | def stop(self, **params):
try:
if self.redis_subscriber:
self.redis_subscriber.unsubscribe()
self.state = "stopped"
self.status = str(datetime.datetime.now())
except __HOLE__:
return "not subscribed" | AttributeError | dataset/ETHPy150Open emccode/heliosburn/heliosburn/proxy/modules/traffic_recorder.py/TrafficRecorder.stop |
640 | def start(kapp):
global app_ref
if use_null_logger:
logger = log.NullLogger()
else:
logger = logging.getLogger("ipg")
logger.setLevel(logging.INFO)
fmt = logging.Formatter(STD_FORMAT)
stderrHdlr = logging.StreamHandler()
stderrHdlr.setFormatter(fmt)
l... | OSError | dataset/ETHPy150Open ejeschke/ginga/ginga/qtw/ipg.py/start |
641 | def get_notification_language(user):
"""
Returns site-specific notification language for this user. Raises
LanguageStoreNotAvailable if this site does not use translated
notifications.
"""
if getattr(settings, 'NOTIFICATION_LANGUAGE_MODULE', False):
try:
app_label, model_name... | ImportError | dataset/ETHPy150Open davemerwin/blue-channel/external_apps/notification/models.py/get_notification_language |
642 | def time_varying_coefficients(d, timelines, constant=False, independent=0, randgen=random.exponential):
"""
Time vary coefficients
d: the dimension of the dataset
timelines: the observational times
constant: True for constant coefficients
independent: the number of coffients to set to 0 (covari... | IndexError | dataset/ETHPy150Open CamDavidsonPilon/lifelines/lifelines/generate_datasets.py/time_varying_coefficients |
643 | @property
def most_specific(self):
"""The most specific (smallest) subdivision available.
If there are no :py:class:`Subdivision` objects for the response,
this returns an empty :py:class:`Subdivision`.
:type: :py:class:`Subdivision`
"""
try:
retur... | IndexError | dataset/ETHPy150Open maxmind/GeoIP2-python/geoip2/records.py/Subdivisions.most_specific |
644 | def _unpack_message_set(self, tp, messages):
try:
for offset, size, msg in messages:
if self.config['check_crcs'] and not msg.validate_crc():
raise Errors.InvalidMessageError(msg)
elif msg.is_compressed():
for record in self._un... | StopIteration | dataset/ETHPy150Open dpkp/kafka-python/kafka/consumer/fetcher.py/Fetcher._unpack_message_set |
645 | def __next__(self):
if not self._iterator:
self._iterator = self._message_generator()
try:
return next(self._iterator)
except __HOLE__:
self._iterator = None
raise | StopIteration | dataset/ETHPy150Open dpkp/kafka-python/kafka/consumer/fetcher.py/Fetcher.__next__ |
646 | def _maybeClass(classnamep):
try:
object
except __HOLE__:
isObject = 0
else:
isObject = isinstance(classnamep, type)
if isinstance(classnamep, ClassType) or isObject:
return qual(classnamep)
return classnamep | NameError | dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/spread/jelly.py/_maybeClass |
647 | def _resolve_spec(self, spec):
package, subpath = self._split_spec(spec)
try:
pkgpath = self.resolver.resolve(package + ':').abspath()
except __HOLE__ as e:
raise BundleError(e)
else:
return path.join(pkgpath, subpath) | ImportError | dataset/ETHPy150Open sontek/pyramid_webassets/pyramid_webassets/__init__.py/PyramidResolver._resolve_spec |
648 | def resolve_source_to_url(self, ctx, filepath, item):
request = get_current_request()
# Use the filepath to reconstruct the item without globs
package, _ = self._split_spec(item)
if package is not None:
pkgdir = self._resolve_spec(package + ':')
if filepath.start... | ValueError | dataset/ETHPy150Open sontek/pyramid_webassets/pyramid_webassets/__init__.py/PyramidResolver.resolve_source_to_url |
649 | def resolve_output_to_url(self, ctx, item):
request = get_current_request()
if not path.isabs(item):
if ':' not in item:
if 'asset_base' in ctx.config:
if ctx.config['asset_base'].endswith(':'):
item = ctx.config['asset_base'] + it... | ValueError | dataset/ETHPy150Open sontek/pyramid_webassets/pyramid_webassets/__init__.py/PyramidResolver.resolve_output_to_url |
650 | def get_webassets_env_from_settings(settings, prefix='webassets'):
"""This function will take all webassets.* parameters, and
call the ``Environment()`` constructor with kwargs passed in.
The only two parameters that are not passed as keywords are:
* base_dir
* base_url
which are passed in po... | ImportError | dataset/ETHPy150Open sontek/pyramid_webassets/pyramid_webassets/__init__.py/get_webassets_env_from_settings |
651 | def assets(request, *args, **kwargs):
env = get_webassets_env_from_request(request)
result = []
for f in args:
try:
result.append(env[f])
except __HOLE__:
result.append(f)
bundle = Bundle(*result, **kwargs)
if USING_WEBASSETS_CONTEXT:
with bundle.bi... | KeyError | dataset/ETHPy150Open sontek/pyramid_webassets/pyramid_webassets/__init__.py/assets |
652 | def diff_map(self, inwrappers):
"""Generate SQL to transform existing data wrappers
:param input_map: a YAML map defining the new data wrappers
:return: list of SQL statements
Compares the existing data wrapper definitions, as fetched from the
catalogs, to the input map and gen... | KeyError | dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/ForeignDataWrapperDict.diff_map |
653 | def diff_map(self, inservers):
"""Generate SQL to transform existing foreign servers
:param inservers: a YAML map defining the new foreign servers
:return: list of SQL statements
Compares the existing server definitions, as fetched from the
catalogs, to the input map and genera... | KeyError | dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/ForeignServerDict.diff_map |
654 | def diff_map(self, inusermaps):
"""Generate SQL to transform existing user mappings
:param input_map: a YAML map defining the new user mappings
:return: list of SQL statements
Compares the existing user mapping definitions, as fetched from the
catalogs, to the input map and gen... | KeyError | dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/UserMappingDict.diff_map |
655 | def from_map(self, schema, inobjs, newdb):
"""Initalize the dictionary of tables by converting the input map
:param schema: schema owning the tables
:param inobjs: YAML map defining the schema objects
:param newdb: collection of dictionaries defining the database
"""
for... | KeyError | dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/ForeignTableDict.from_map |
656 | def diff_map(self, intables):
"""Generate SQL to transform existing foreign tables
:param intables: a YAML map defining the new foreign tables
:return: list of SQL statements
Compares the existing foreign table definitions, as fetched
from the catalogs, to the input map and gen... | KeyError | dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/ForeignTableDict.diff_map |
657 | def stepAxis(self, op, p, sourceSequence):
targetSequence = []
for node in sourceSequence:
if not isinstance(node,(ModelObject, etree._ElementTree, ModelAttribute)):
raise XPathException(self.progHeader, 'err:XPTY0020', _('Axis step {0} context item is not a node: {1}').forma... | TypeError | dataset/ETHPy150Open Arelle/Arelle/arelle/XPathContext.py/XPathContext.stepAxis |
658 | def atomize(self, p, x):
# sequence
if isinstance(x, SEQUENCE_TYPES):
sequence = []
for item in self.flattenSequence(x):
atomizedItem = self.atomize(p, item)
if atomizedItem != []:
sequence.append(atomizedItem)
retur... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/XPathContext.py/XPathContext.atomize |
659 | def __init__(self, filename):
super(JsonStore, self).__init__()
self.filename = filename
self.data = {}
if exists(filename):
try:
with io.open(filename, encoding='utf-8') as fd:
self.data = json.load(fd)
except __HOLE__:
... | ValueError | dataset/ETHPy150Open kivy/kivy-ios/toolchain.py/JsonStore.__init__ |
660 | def build_recipes(names, ctx):
# gather all the dependencies
print("Want to build {}".format(names))
graph = Graph()
recipe_to_load = names
recipe_loaded = []
while names:
name = recipe_to_load.pop(0)
if name in recipe_loaded:
continue
try:
recipe ... | ImportError | dataset/ETHPy150Open kivy/kivy-ios/toolchain.py/build_recipes |
661 | def GetUserAppAndServe(self, script, env, start_response):
"""Dispatch a WSGI request to <script>."""
try:
app, mod_file = self.GetUserApp(script)
except __HOLE__:
logging.exception('Failed to import %s', script)
start_response('500 Internal Server Error', [], sys.exc_info())
return ... | ImportError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/vmruntime/meta_app.py/MetaWSGIApp.GetUserAppAndServe |
662 | def ServeApp(self, app, mod_file, env, start_response):
"""(Further) wrap the provided WSGI app and dispatch a request to it."""
for key in ENV_KEYS:
if key in os.environ:
del os.environ[key]
for key in ENV_KEYS:
assert key not in os.environ
assert os.getenv(key) is None
fo... | AttributeError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/vmruntime/meta_app.py/MetaWSGIApp.ServeApp |
663 | def ServeStaticFile(self, matcher, appinfo_external, unused_env,
start_response):
"""Serve a static file."""
static_files = appinfo_external.static_files
static_dir = appinfo_external.static_dir
if static_files:
filename = matcher.expand(static_files)
elif static_dir:
... | IOError | dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/vmruntime/meta_app.py/MetaWSGIApp.ServeStaticFile |
664 | @classmethod
def execute(cls, fst_model, input, is_file=False, nbest=None):
logger = logging.getLogger(__name__)
cmd = ['phonetisaurus-g2p',
'--model=%s' % fst_model,
'--input=%s' % input,
'--words']
if is_file:
cmd.append('--isfile'... | OSError | dataset/ETHPy150Open jasperproject/jasper-client/client/g2p.py/PhonetisaurusG2P.execute |
665 | def _http_request(self, method, uri, headers=None, body_parts=None):
"""Makes an HTTP request using httplib.
Args:
method: str example: 'GET', 'POST', 'PUT', 'DELETE', etc.
uri: str or atom.http_core.Uri
headers: dict of strings mapping to strings which will be sent as HTTP
... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/atom/http_core.py/HttpClient._http_request |
666 | def parseXML(cls, xmlStr, storeXML=False):
"""Convert an XML string into a nice instance tree of XMLNodes.
xmlStr -- the XML to parse
storeXML -- if True, stores the XML string in the root XMLNode.xml
"""
def __parseXMLElement(element, thisNode):
"""Recurs... | AttributeError | dataset/ETHPy150Open sightmachine/SimpleCV/SimpleCV/MachineLearning/query_imgs/flickrapi2.py/XMLNode.parseXML |
667 | def __getCachedToken(self):
"""Read and return a cached token, or None if not found.
The token is read from the cached token file, which is basically the
entire RSP response containing the auth element.
"""
try:
f = file(self.__getCachedTokenFilename(), "r")... | IOError | dataset/ETHPy150Open sightmachine/SimpleCV/SimpleCV/MachineLearning/query_imgs/flickrapi2.py/FlickrAPI.__getCachedToken |
668 | @register.tag
def forum_time(parser, token):
try:
tag, time = token.split_contents()
except __HOLE__:
raise template.TemplateSyntaxError('forum_time requires single argument')
else:
return ForumTimeNode(time) | ValueError | dataset/ETHPy150Open slav0nic/djangobb/djangobb_forum/templatetags/forum_extras.py/forum_time |
669 | def was_modified_since(header=None, mtime=0, size=0):
"""
Was something modified since the user last downloaded it?
header
This is the value of the If-Modified-Since header. If this is None,
I'll just return True.
mtime
This is the modification time of the item we're talking about.
... | AttributeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/static.py/was_modified_since |
670 | def get_rdata_class(rdclass, rdtype):
def import_module(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
mod = _rdata_modules.get((rdclass, rdtype))
rdclass_text = dns.rdataclass.to_text(r... | ImportError | dataset/ETHPy150Open catap/namebench/nb_third_party/dns/rdata.py/get_rdata_class |
671 | def try_printout(data, out, opts):
'''
Safely get the string to print out, try the configured outputter, then
fall back to nested and then to raw
'''
try:
return get_printout(out, opts)(data).rstrip()
except (KeyError, __HOLE__):
log.debug(traceback.format_exc())
try:
... | AttributeError | dataset/ETHPy150Open saltstack/salt/salt/output/__init__.py/try_printout |
672 | def update_progress(opts, progress, progress_iter, out):
'''
Update the progress iterator for the given outputter
'''
# Look up the outputter
try:
progress_outputter = salt.loader.outputters(opts)[out]
except __HOLE__: # Outputter is not loaded
log.warning('Progress outputter no... | KeyError | dataset/ETHPy150Open saltstack/salt/salt/output/__init__.py/update_progress |
673 | def display_output(data, out=None, opts=None):
'''
Print the passed data using the desired output
'''
if opts is None:
opts = {}
display_data = try_printout(data, out, opts)
output_filename = opts.get('output_file', None)
log.trace('data = {0}'.format(data))
try:
# outpu... | UnicodeDecodeError | dataset/ETHPy150Open saltstack/salt/salt/output/__init__.py/display_output |
674 | def get_printout(out, opts=None, **kwargs):
'''
Return a printer function
'''
if opts is None:
opts = {}
if 'output' in opts:
# new --out option
out = opts['output']
if out == 'text':
out = 'txt'
elif out is None or out == '':
out = 'nested'
if o... | AttributeError | dataset/ETHPy150Open saltstack/salt/salt/output/__init__.py/get_printout |
675 | def __call__(self, result=None):
"""
Wrapper around default __call__ method to perform common Django test
set up. This means that user-defined Test Cases aren't required to
include a call to super().setUp().
"""
testMethod = getattr(self, self._testMethodName)
ski... | SystemExit | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/test/testcases.py/SimpleTestCase.__call__ |
676 | def assertJSONEqual(self, raw, expected_data, msg=None):
try:
data = json.loads(raw)
except ValueError:
self.fail("First argument is not valid JSON: %r" % raw)
if isinstance(expected_data, six.string_types):
try:
expected_data = json.loads(expe... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/test/testcases.py/SimpleTestCase.assertJSONEqual |
677 | def UpdateProjectList(self):
new_project_paths = []
for project in self.manifest.projects.values():
if project.relpath:
new_project_paths.append(project.relpath)
file_name = 'project.list'
file_path = os.path.join(self.manifest.repodir, file_name)
old_project_paths = []
if os.path... | OSError | dataset/ETHPy150Open android/tools_repo/subcmds/sync.py/Sync.UpdateProjectList |
678 | def Execute(self, opt, args):
if opt.jobs:
self.jobs = opt.jobs
if opt.network_only and opt.detach_head:
print >>sys.stderr, 'error: cannot combine -n and -d'
sys.exit(1)
if opt.network_only and opt.local_only:
print >>sys.stderr, 'error: cannot combine -n and -l'
sys.exit(1)
... | IOError | dataset/ETHPy150Open android/tools_repo/subcmds/sync.py/Sync.Execute |
679 | def __init__(self, data=None, index=None, dtype=None, name=None,
copy=False, fastpath=False):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isinstance(data, SingleBlockManager):
data = Si... | TypeError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.__init__ |
680 | def _ixs(self, i, axis=0):
"""
Return the i-th value or values in the Series by location
Parameters
----------
i : int, slice, or sequence of integers
Returns
-------
value : scalar (int) or Series (slice, sequence)
"""
try:
... | IndexError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series._ixs |
681 | def __getitem__(self, key):
try:
result = self.index.get_value(self, key)
if not lib.isscalar(result):
if is_list_like(result) and not isinstance(result, Series):
# we need to box if we have a non-unique index here
# otherwise hav... | KeyError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.__getitem__ |
682 | def __setitem__(self, key, value):
def setitem(key, value):
try:
self._set_with_engine(key, value)
return
except (SettingWithCopyError):
raise
except (__HOLE__, ValueError):
values = self._values
... | KeyError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.__setitem__ |
683 | def _set_with_engine(self, key, value):
values = self._values
try:
self.index._engine.set_value(values, key, value)
return
except __HOLE__:
values[self.index.get_loc(key)] = value
return | KeyError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series._set_with_engine |
684 | def set_value(self, label, value, takeable=False):
"""
Quickly set single value at passed label. If label is not contained, a
new object is created with the label placed at the end of the result
index
Parameters
----------
label : object
Partial index... | KeyError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.set_value |
685 | def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
index=True, length=False, dtype=False, name=False,
max_rows=None):
"""
Render a string representation of the Series
Parameters
----------
buf : StringIO-like, optional... | AttributeError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.to_string |
686 | @Appender(generic._shared_docs['sort_values'] % _shared_doc_kwargs)
def sort_values(self, axis=0, ascending=True, inplace=False,
kind='quicksort', na_position='last'):
axis = self._get_axis_number(axis)
# GH 5856/5853
if inplace and self._is_cached:
raise Va... | TypeError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series.sort_values |
687 | def _dir_additions(self):
rv = set()
for accessor in self._accessors:
try:
getattr(self, accessor)
rv.add(accessor)
except __HOLE__:
pass
return rv | AttributeError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/Series._dir_additions |
688 | def _sanitize_array(data, index, dtype=None, copy=False,
raise_cast_failure=False):
""" sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
... | ValueError | dataset/ETHPy150Open pydata/pandas/pandas/core/series.py/_sanitize_array |
689 | @util.cached_property
def time_sent(self):
try:
timestamp_text = _timestamp_xpb.one_(self._message_element)
except __HOLE__:
timestamp_text = _em_timestamp_xpb.one_(self._message_element)
return helpers.parse_date_updated(timestamp_text) | IndexError | dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/messaging.py/Message.time_sent |
690 | @util.cached_property
def correspondent_id(self):
"""
:returns: The id assigned to the correspondent of this message.
"""
try:
return int(self._thread_element.attrib['data-personid'])
except (__HOLE__, KeyError):
try:
return int(self.co... | ValueError | dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/messaging.py/MessageThread.correspondent_id |
691 | @util.cached_property
def correspondent(self):
"""
:returns: The username of the user with whom the logged in user is
conversing in this :class:`~.MessageThread`.
"""
try:
return self._correspondent_xpb.one_(self._thread_element).strip()
except _... | IndexError | dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/messaging.py/MessageThread.correspondent |
692 | @property
def initiator(self):
"""
:returns: A :class:`~okcupyd.profile.Profile` instance belonging to the
initiator of this :class:`~.MessageThread`.
"""
try:
return self.messages[0].sender
except __HOLE__:
pass | IndexError | dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/messaging.py/MessageThread.initiator |
693 | @property
def respondent(self):
"""
:returns: A :class:`~okcupyd.profile.Profile` instance belonging to the
respondent of this :class:`~.MessageThread`.
"""
try:
return self.messages[0].recipient
except __HOLE__:
pass | IndexError | dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/messaging.py/MessageThread.respondent |
694 | def load_config(self, file):
"""Attempts to load a JSON config file for Cardinal.
Takes a file path, attempts to decode its contents from JSON, then
validate known config options to see if they can safely be loaded in.
their place. The final merged dictionary object is saved to the
... | KeyError | dataset/ETHPy150Open JohnMaguire/Cardinal/cardinal/config.py/ConfigParser.load_config |
695 | def merge_argparse_args_into_config(self, args):
"""Merges the args returned by argparse.ArgumentParser into the config.
Keyword arguments:
args -- The args object returned by argsparse.parse_args().
Returns:
dict -- Dictionary object of the entire config.
"""
... | AttributeError | dataset/ETHPy150Open JohnMaguire/Cardinal/cardinal/config.py/ConfigParser.merge_argparse_args_into_config |
696 | def validate_remote(ctx, param, value):
if value:
try:
remote, branch = value.split('/')
return (remote, branch)
except __HOLE__:
raise click.BadParameter('remote need to be in format <remote>/<branch>') | ValueError | dataset/ETHPy150Open marcwebbie/passpie/passpie/validators.py/validate_remote |
697 | def validate_cols(ctx, param, value):
if value:
try:
validated = {c: index for index, c in enumerate(value.split(',')) if c}
for col in ('name', 'login', 'password'):
assert col in validated
return validated
except (AttributeError, ValueError):
... | AssertionError | dataset/ETHPy150Open marcwebbie/passpie/passpie/validators.py/validate_cols |
698 | def read_headers(rfile, hdict=None):
"""Read headers from the given stream into the given header dict.
If hdict is None, a new header dict is created. Returns the populated
header dict.
Headers which are repeated are folded together using a comma if their
specification so dictates.
This funct... | ValueError | dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/libs/cherrypy/wsgiserver/wsgiserver3.py/read_headers |
699 | def _fetch(self):
if self.closed:
return
line = self.rfile.readline()
self.bytes_read += len(line)
if self.maxlen and self.bytes_read > self.maxlen:
raise MaxSizeExceeded("Request Entity Too Large", self.maxlen)
line = line.strip().split(SEMICOLON, 1)
... | ValueError | dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/libs/cherrypy/wsgiserver/wsgiserver3.py/ChunkedRFile._fetch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.