Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
100 | @classmethod
def getInstance(cls):
if cls.instance != None:
return cls.instance
else:
cls.instance = TestPlanSettings()
try:
configFile = sys.argv[1]
except __HOLE__:
exit("Please specify the configuration file")
... | IndexError | dataset/ETHPy150Open azoft-dev-team/imagrium/src/core/testplan_settings.py/TestPlanSettings.getInstance |
101 | def __init__(self, key_name, data_type, *args, **kwargs):
subspec = kwargs.pop('subspec', None)
super(KeyTransform, self).__init__(*args, **kwargs)
self.key_name = key_name
self.data_type = data_type
try:
output_field = self.TYPE_MAP[data_type]
except __HOLE_... | KeyError | dataset/ETHPy150Open adamchainz/django-mysql/django_mysql/models/fields/dynamic.py/KeyTransform.__init__ |
102 | def workerProcess(self):
"""Loop getting clients from the shared queue and process them"""
if self.postForkCallback:
self.postForkCallback()
while self.isRunning.value:
try:
client = self.serverTransport.accept()
self.serveClient(client)
... | SystemExit | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/thrift-0.9.1/src/server/TProcessPoolServer.py/TProcessPoolServer.workerProcess |
103 | def serve(self):
"""Start workers and put into queue"""
# this is a shared state that can tell the workers to exit when False
self.isRunning.value = True
# first bind and listen to the port
self.serverTransport.listen()
# fork the children
for i in range(self.nu... | KeyboardInterrupt | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/thrift-0.9.1/src/server/TProcessPoolServer.py/TProcessPoolServer.serve |
104 | def num_row_elements(row):
'''Get number of elements in CSV row.'''
try:
rowset = set(row)
rowset.discard('')
return len(rowset)
except __HOLE__:
return 0 | TypeError | dataset/ETHPy150Open xesscorp/KiPart/kipart/common.py/num_row_elements |
105 | def get_part_num(csv_reader):
'''Get the part number from a row of the CSV file.'''
part_num = get_nonblank_row(csv_reader)
try:
part_num = set(part_num)
part_num.discard('')
return part_num.pop()
except __HOLE__:
return None | TypeError | dataset/ETHPy150Open xesscorp/KiPart/kipart/common.py/get_part_num |
106 | def save_normalized_image(path, data):
image_parser = ImageFile.Parser()
try:
image_parser.feed(data)
image = image_parser.close()
except __HOLE__:
raise
return False
image.thumbnail(MAX_IMAGE_SIZE, Image.ANTIALIAS)
if image.mode != 'RGB':
image = image.conver... | IOError | dataset/ETHPy150Open bboe/flask-image-uploader/app.py/save_normalized_image |
107 | def run(self):
if self._cancelled:
return
conn = None
try:
conn = self.try_reconnect()
except Exception as exc:
try:
next_delay = next(self.schedule)
except __HOLE__:
# the schedule has been exhausted
... | StopIteration | dataset/ETHPy150Open datastax/python-driver/cassandra/pool.py/_ReconnectionHandler.run |
108 | def call(xc, p, qname, contextItem, args):
try:
cfSig = xc.modelXbrl.modelCustomFunctionSignatures[qname, len(args)]
if cfSig is not None and cfSig.customFunctionImplementation is not None:
return callCfi(xc, p, qname, cfSig, contextItem, args)
elif qname in xc.customFunctions: #... | KeyError | dataset/ETHPy150Open Arelle/Arelle/arelle/FunctionCustom.py/call |
109 | @memoize_default()
def _get_under_cursor_stmt(self, cursor_txt, start_pos=None):
tokenizer = source_tokens(cursor_txt)
r = Parser(self._grammar, cursor_txt, tokenizer=tokenizer)
try:
# Take the last statement available that is not an endmarker.
# And because it's a si... | AttributeError | dataset/ETHPy150Open davidhalter/jedi/jedi/api/__init__.py/Script._get_under_cursor_stmt |
110 | def _goto(self, add_import_name=False):
"""
Used for goto_assignments and usages.
:param add_import_name: Add the the name (if import) to the result.
"""
def follow_inexistent_imports(defs):
""" Imports can be generated, e.g. following
`multiprocessing.du... | AttributeError | dataset/ETHPy150Open davidhalter/jedi/jedi/api/__init__.py/Script._goto |
111 | def _analysis(self):
def check_types(types):
for typ in types:
try:
f = typ.iter_content
except __HOLE__:
pass
else:
check_types(f())
#statements = set(chain(*self._parser.module().us... | AttributeError | dataset/ETHPy150Open davidhalter/jedi/jedi/api/__init__.py/Script._analysis |
112 | def _simple_complete(self, path, dot, like):
user_stmt = self._parser.user_stmt_with_whitespace()
is_simple_path = not path or re.search('^[\w][\w\d.]*$', path)
if isinstance(user_stmt, tree.Import) or not is_simple_path:
return super(Interpreter, self)._simple_complete(path, dot, li... | KeyError | dataset/ETHPy150Open davidhalter/jedi/jedi/api/__init__.py/Interpreter._simple_complete |
113 | def get_class_alias(klass):
"""
Tries to find a suitable L{pyamf.ClassAlias} subclass for C{klass}.
"""
for k, v in pyamf.ALIAS_TYPES.iteritems():
for kl in v:
try:
if issubclass(klass, kl):
return k
except __HOLE__:
# n... | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/util/__init__.py/get_class_alias |
114 | @login_required
@require_POST
@xframe_options_sameorigin
def up_image_async(request, model_name, object_pk):
"""Upload all images in request.FILES."""
# Verify the model agaist our white-list
if model_name not in ALLOWED_MODELS:
message = _('Model not allowed.')
return HttpResponseBadReques... | ObjectDoesNotExist | dataset/ETHPy150Open mozilla/kitsune/kitsune/upload/views.py/up_image_async |
115 | def __init__(self, environ):
script_name = base.get_script_name(environ)
path_info = force_unicode(environ.get('PATH_INFO', u'/'))
if not path_info or path_info == script_name:
# Sometimes PATH_INFO exists, but is empty (e.g. accessing
# the SCRIPT_NAME URL without a trai... | TypeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/core/handlers/wsgi.py/WSGIRequest.__init__ |
116 | def __call__(self, environ, start_response):
from django.conf import settings
# Set up middleware if needed. We couldn't do this earlier, because
# settings weren't available.
if self._request_middleware is None:
self.initLock.acquire()
try:
try:
... | UnicodeDecodeError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/core/handlers/wsgi.py/WSGIHandler.__call__ |
117 | def _setup_flavor(env, flavor):
"""Setup a flavor, providing customization hooks to modify CloudBioLinux installs.
Specify flavor as a name, in which case we look it up in the standard
flavor directory (contrib/flavor/your_flavor), or as an absolute path to a
flavor directory outside of cloudbiolinux.
... | AttributeError | dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/utils.py/_setup_flavor |
118 | @staticmethod
def try_registered_completion(ctxt, symname, completions):
debugging = ctxt.get_binding('*DEBUG*', False)
if ctxt.remainder or completions is None:
return False
try:
completer = ctxt.get_completer(symname)
except __HOLE__:
return Fals... | KeyError | dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/pylexotron.py/matcher.try_registered_completion |
119 | def match(self, ctxt, completions):
prevname = ctxt.productionname
try:
rule = ctxt.get_production_by_name(self.arg)
except __HOLE__:
raise ValueError("Can't look up production rule named %r" % (self.arg,))
output = rule.match(ctxt.with_production_named(self.arg),... | KeyError | dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/pylexotron.py/rule_reference.match |
120 | def validate_port_or_colon_separated_port_range(port_range):
"""Accepts a port number or a single-colon separated range."""
if port_range.count(':') > 1:
raise ValidationError(_("One colon allowed in port range"))
ports = port_range.split(':')
for port in ports:
try:
if int(p... | ValueError | dataset/ETHPy150Open CiscoSystems/avos/horizon/utils/validators.py/validate_port_or_colon_separated_port_range |
121 | def __eq__(self, other):
try:
return self.__dict__ == other.__dict__
except __HOLE__:
return False | AttributeError | dataset/ETHPy150Open Teradata/PyTd/teradata/datatypes.py/Interval.__eq__ |
122 | def __eq__(self, other):
try:
return self.__dict__ == other.__dict__
except __HOLE__:
return False | AttributeError | dataset/ETHPy150Open Teradata/PyTd/teradata/datatypes.py/Period.__eq__ |
123 | def test_private_field_access_raises_exception(self):
try:
self.proxy._private_field.get()
self.fail('Should raise AttributeError exception')
except __HOLE__:
pass
except Exception:
self.fail('Should raise AttributeError exception') | AttributeError | dataset/ETHPy150Open jodal/pykka/tests/field_access_test.py/FieldAccessTest.test_private_field_access_raises_exception |
124 | @cached_property
def is_good_choice(self):
if self.biblio_name=="title":
try:
if self.biblio_value.isupper():
return False
except __HOLE__: #some titles are ints, apparently
return False
return True | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/BiblioRow.is_good_choice |
125 | @cached_property
def display_year(self):
try:
return str(self.year)
except (__HOLE__, UnicodeEncodeError):
return None | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.display_year |
126 | @cached_property
def calculated_host(self):
try:
return self.repository.split(" ")[0].lower()
except __HOLE__:
return None | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.calculated_host |
127 | @cached_property
def display_authors(self):
try:
auths = ",".join(self.authors.split(",")[0:3])
if auths.isupper():
auths = auths.title()
if len(auths) < len(self.authors):
auths += " et al."
except __HOLE__:
auths = N... | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.display_authors |
128 | @cached_property
def author_list(self):
try:
auth_list = self.authors.split(",")
except __HOLE__:
auth_list = []
ret = []
for auth in auth_list:
my_auth = auth.strip()
try:
if my_auth.isupper():
my_... | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.author_list |
129 | @cached_property
def display_title(self):
try:
ret = self.title
except __HOLE__:
ret = "no title available"
try:
if ret.isupper():
ret = ret.title()
except AttributeError: #some titles are ints, apparently
pass
... | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.display_title |
130 | @cached_property
def display_host(self):
try:
return self.journal
except AttributeError:
try:
return self.repository
except __HOLE__:
return '' | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.display_host |
131 | @cached_property
def free_fulltext_host(self):
try:
return self._get_url_host(self.free_fulltext_url)
except __HOLE__:
return None | AttributeError | dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/biblio.py/Biblio.free_fulltext_host |
132 | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... | AttributeError | dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/parallels.py/create |
133 | def render(self, request):
"""
Renders dojo.data compatible JSON if self.data is a QuerySet, falls
back to standard JSON.
"""
callback = request.GET.get('callback', None)
try:
indent = int(request.GET['indent'])
except (KeyError, __HOLE__):
... | ValueError | dataset/ETHPy150Open klipstein/dojango/dojango/data/piston/emitters.py/DojoDataEmitter.render |
134 | def convert(self, text):
"""Convert the given text."""
# Main function. The order in which other subs are called here is
# essential. Link and image substitutions need to happen before
# _EscapeSpecialChars(), so that any *'s or _'s in the <a>
# and <img> tags get encoded.
... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown.convert |
135 | def _get_emacs_vars(self, text):
"""Return a dictionary of emacs-style local variables.
Parsing is done loosely according to this spec (and according to
some in-practice deviations from this):
http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specif... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown._get_emacs_vars |
136 | def _hash_html_blocks(self, text, raw=False):
"""Hashify HTML blocks
We only want to do this for block-level HTML tags, such as headers,
lists, and tables. That's because we still want to wrap <p>s around
"paragraphs" that are wrapped in non-block-level tags, such as anchors,
ph... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown._hash_html_blocks |
137 | def _do_links(self, text):
"""Turn Markdown link shortcuts into XHTML <a> and <img> tags.
This is a combination of Markdown.pl's _DoAnchors() and
_DoImages(). They are done together because that simplified the
approach. It was necessary to use a different approach than
Markdown.... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown._do_links |
138 | def _get_pygments_lexer(self, lexer_name):
try:
from pygments import lexers, util
except __HOLE__:
return None
try:
return lexers.get_lexer_by_name(lexer_name)
except util.ClassNotFound:
return None | ImportError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown._get_pygments_lexer |
139 | def _regex_from_encoded_pattern(s):
"""'foo' -> re.compile(re.escape('foo'))
'/foo/' -> re.compile('foo')
'/foo/i' -> re.compile('foo', re.I)
"""
if s.startswith('/') and s.rfind('/') != 0:
# Parse it: /PATTERN/FLAGS
idx = s.rfind('/')
pattern, flags_str = s[1:idx],... | KeyError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/_regex_from_encoded_pattern |
140 | def __call__(self, *args):
try:
return self.cache[args]
except KeyError:
self.cache[args] = value = self.func(*args)
return value
except __HOLE__:
# uncachable -- for instance, passing a list as an argument.
# Better to not cache than to blow up entirely.
... | TypeError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/_memoized.__call__ |
141 | def main(argv=None):
if argv is None:
argv = sys.argv
if not logging.root.handlers:
logging.basicConfig()
usage = "usage: %prog [PATHS...]"
version = "%prog "+__version__
parser = optparse.OptionParser(prog="markdown2", usage=usage,
version=version, description=cmdln_desc,
... | ValueError | dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/main |
142 | def file_infos(names=None):
"""
iterates over storage files metadata.
note: we put the storage name into the metadata as 'id'
:param names: None means "all items"
otherwise give a list of storage item names
"""
storage = current_app.storage
if names is None:
names ... | OSError | dataset/ETHPy150Open bepasty/bepasty-server/bepasty/views/filelist.py/file_infos |
143 | def __getitem__(self, key):
try:
i = self.keylist.index(key)
except __HOLE__:
raise KeyError
return self.valuelist[i] | ValueError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_userdict.py/SeqDict.__getitem__ |
144 | def __setitem__(self, key, value):
try:
i = self.keylist.index(key)
self.valuelist[i] = value
except __HOLE__:
self.keylist.append(key)
self.valuelist.append(value) | ValueError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_userdict.py/SeqDict.__setitem__ |
145 | def __delitem__(self, key):
try:
i = self.keylist.index(key)
except __HOLE__:
raise KeyError
self.keylist.pop(i)
self.valuelist.pop(i) | ValueError | dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_userdict.py/SeqDict.__delitem__ |
146 | def AddTransfer(self, throttle_name, token_count):
"""Add a count to the amount this thread has transferred.
Each time a thread transfers some data, it should call this method to
note the amount sent. The counts may be rotated if sufficient time
has passed since the last rotation.
Args:
thro... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/remote_api/throttle.py/Throttle.AddTransfer |
147 | def get_language(language_code):
for tag in normalize_language_tag(language_code):
tag = tag.replace('-','_') # '-' not valid in module names
if tag in _languages:
return _languages[tag]
try:
module = __import__(tag, globals(), locals(), level=0)
except __HOLE... | ImportError | dataset/ETHPy150Open timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python2/docutils/parsers/rst/languages/__init__.py/get_language |
148 | def main():
print("%s (server) #v%s\n" % (NAME, VERSION))
parser = optparse.OptionParser(version=VERSION)
parser.add_option("-c", dest="config_file", default=CONFIG_FILE, help="configuration file (default: '%s')" % os.path.split(CONFIG_FILE)[-1])
options, _ = parser.parse_args()
read_config(optio... | KeyboardInterrupt | dataset/ETHPy150Open stamparm/maltrail/server.py/main |
149 | def nP(n, k=None, replacement=False):
"""Return the number of permutations of ``n`` items taken ``k`` at a time.
Possible values for ``n``::
integer - set of length ``n``
sequence - converted to a multiset internally
multiset - {element: multiplicity}
If ``k`` is None then the tota... | ValueError | dataset/ETHPy150Open sympy/sympy/sympy/functions/combinatorial/numbers.py/nP |
150 | def nT(n, k=None):
"""Return the number of ``k``-sized partitions of ``n`` items.
Possible values for ``n``::
integer - ``n`` identical items
sequence - converted to a multiset internally
multiset - {element: multiplicity}
Note: the convention for ``nT`` is different than that of `... | TypeError | dataset/ETHPy150Open sympy/sympy/sympy/functions/combinatorial/numbers.py/nT |
151 | def __getattr__(self, key):
try:
return getattr(self.comparator, key)
except __HOLE__:
raise AttributeError(
'Neither %r object nor %r object has an attribute %r' % (
type(self).__name__,
type(self.comparator).__name__,
... | AttributeError | dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/sql/elements.py/ColumnElement.__getattr__ |
152 | @_generative
def bindparams(self, *binds, **names_to_values):
"""Establish the values and/or types of bound parameters within
this :class:`.TextClause` construct.
Given a text construct such as::
from sqlalchemy import text
stmt = text("SELECT id, name FROM user WHE... | KeyError | dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/sql/elements.py/TextClause.bindparams |
153 | def __init__(self, whens, value=None, else_=None):
"""Produce a ``CASE`` expression.
The ``CASE`` construct in SQL is a conditional object that
acts somewhat analogously to an "if/then" construct in other
languages. It returns an instance of :class:`.Case`.
:func:`.case` in it... | TypeError | dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/sql/elements.py/Case.__init__ |
154 | def _column_as_key(element):
if isinstance(element, util.string_types):
return element
if hasattr(element, '__clause_element__'):
element = element.__clause_element__()
try:
return element.key
except __HOLE__:
return None | AttributeError | dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/sql/elements.py/_column_as_key |
155 | def __init__(self, array):
"""
It takes as an optional input argument the array of the input
:data:`parameters` defined in the parameter file.
The current implemented types are 'flat' (default), and 'gaussian',
which expect also a mean and sigma. Possible extension would take a
... | IndexError | dataset/ETHPy150Open baudren/montepython_public/montepython/prior.py/Prior.__init__ |
156 | def generic_float(self, name, values, default=None):
def validate(s, value):
try:
value = str(float(value))
except __HOLE__:
raise ValidationError(
"{0} {1} coult not be coerced into a float".format(
name, value)... | ValueError | dataset/ETHPy150Open mozilla/inventory/mcsv/resolver.py/Generics.generic_float |
157 | @meta
def primary_attribute(self, **kwargs):
def _primary_attribute(s, header, value, **kwargs):
try:
_, s._primary_attr = map(
lambda s: s.strip(), header.split('%')
)
except __HOLE__:
raise ValidationError(
... | ValueError | dataset/ETHPy150Open mozilla/inventory/mcsv/resolver.py/Resolver.primary_attribute |
158 | def get_targets(extensions):
try:
targets = list(extensions.map(lambda ext: ext.plugin()))
except __HOLE__:
targets = []
return targets | RuntimeError | dataset/ETHPy150Open openstack-infra/subunit2sql/subunit2sql/shell.py/get_targets |
159 | def execute(self):
try:
self.op["start_time"] = time.time()
self.check_dependencies()
handler_func = self.op["callback"]
ret = handler_func(self.op["name"], self.args,
node=self.op["node"],
verbose=self... | SystemExit | dataset/ETHPy150Open ohmu/poni/poni/tool.py/ControlTask.execute |
160 | @argh_named("script")
@arg_verbose
@argh.arg('script', metavar="FILE", type=str,
help='script file path or "-" (a single minus-sign) for stdin')
@argh.arg('variable', type=str, nargs="*", help="'name=[type:]value'")
@expects_obj
def handle_script(self, arg):
"""run commands fro... | ValueError | dataset/ETHPy150Open ohmu/poni/poni/tool.py/Tool.handle_script |
161 | @argh_named("control")
@arg_verbose
@arg_full_match
@arg_flag("-n", "--no-deps", help="do not run dependency tasks")
@arg_flag("-i", "--ignore-missing",
help="do not fail in case no matching operations are found")
@arg_quiet
@arg_output_dir
@arg_flag("-t", "--clock-tasks", dest... | KeyError | dataset/ETHPy150Open ohmu/poni/poni/tool.py/Tool.handle_control |
162 | @argh_named("cp")
@arg_verbose
@arg_full_match
@arg_host_access_method
@arg_flag("-d", "--create-dest-dir", help="create missing remote target directories")
@arg_flag("-r", "--recursive", help="copy directories recursively")
@argh.arg('source', type=str, nargs="+", help='source file/dir to copy'... | OSError | dataset/ETHPy150Open ohmu/poni/poni/tool.py/Tool.handle_remote_cp |
163 | @argh_named("update")
@arg_full_match
@argh.arg('target', type=str, help='target systems/nodes (regexp)')
@expects_obj
def handle_cloud_update(self, arg):
"""update node cloud instance properties"""
confman = self.get_confman(arg.root_dir)
for node in confman.find(arg.target, ful... | KeyError | dataset/ETHPy150Open ohmu/poni/poni/tool.py/Tool.handle_cloud_update |
164 | def run(self, args=None):
def adjust_logging(arg):
"""tune the logging before executing commands"""
self.tune_arg_namespace(arg)
if arg.time_log and os.path.exists(arg.time_log):
self.task_times.load(arg.time_log)
if arg.debug:
lo... | ValueError | dataset/ETHPy150Open ohmu/poni/poni/tool.py/Tool.run |
165 | def technical_404_response(request, exception):
"Create a technical 404 error response. The exception should be the Http404."
try:
error_url = exception.args[0]['path']
except (IndexError, TypeError, KeyError):
error_url = request.path_info[1:] # Trim leading slash
try:
tried =... | TypeError | dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/views/debug.py/technical_404_response |
166 | def transport(world, shinydata, filename, path):
"""Write shinydata to a file under the given file_name.
"""
if not os.path.exists(path):
try:
os.mkdir(path)
except Exception, e:
world.log.error('EXPORT FAILED: ' + str(e))
raise SportError('Error accessing... | IOError | dataset/ETHPy150Open shinymud/ShinyMUD/src/shinymud/lib/sport_plugins/transports/save_file.py/transport |
167 | def test_merge_dict_request(self):
data = {
'name': 'miao',
'random_input': [1, 2, 3]
}
# Django test submits data as multipart-form by default,
# which results in request.data being a MergeDict.
# Wrote UserNoMergeDictViewSet to raise an exception (return... | NotImplementedError | dataset/ETHPy150Open AltSchool/dynamic-rest/tests/test_viewsets.py/TestMergeDictConvertsToDict.test_merge_dict_request |
168 | def getCmdInfoBasic( command ):
typemap = {
'string' : unicode,
'length' : float,
'float' : float,
'angle' : float,
'int' : int,
'unsignedint' : int,
'on|off' : bool,
'script' : callable,
... | ValueError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/getCmdInfoBasic |
169 | def getCmdInfo( command, version='8.5', python=True ):
"""Since many maya Python commands are builtins we can't get use getargspec on them.
besides most use keyword args that we need the precise meaning of ( if they can be be used with
edit or query flags, the shortnames of flags, etc) so we have to parse t... | IOError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/getCmdInfo |
170 | def fixCodeExamples(style='maya', force=False):
"""cycle through all examples from the maya docs, replacing maya.cmds with pymel and inserting pymel output.
NOTE: this can only be run from gui mode
WARNING: back up your preferences before running
TODO: auto backup and restore of maya prefs
"""
... | TypeError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/fixCodeExamples |
171 | def getCallbackFlags(cmdInfo):
"""used parsed data and naming convention to determine which flags are callbacks"""
commandFlags = []
try:
flagDocs = cmdInfo['flags']
except __HOLE__:
pass
else:
for flag, data in flagDocs.items():
if data['args'] in ['script', call... | KeyError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/getCallbackFlags |
172 | def testNodeCmd( funcName, cmdInfo, nodeCmd=False, verbose=False ):
_logger.info(funcName.center( 50, '='))
if funcName in [ 'character', 'lattice', 'boneLattice', 'sculpt', 'wire' ]:
_logger.debug("skipping")
return cmdInfo
# These cause crashes... confirmed that pointOnPolyConstrain... | TypeError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/testNodeCmd |
173 | def rebuild(self) :
"""Build and save to disk the list of Maya Python commands and their arguments
WARNING: will unload existing plugins, then (re)load all maya-installed
plugins, without making an attempt to return the loaded plugins to the
state they were at before this comman... | KeyError | dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/internal/cmdcache.py/CmdCache.rebuild |
174 | def to_screen(self, group, new_screen):
"""Adjust offsets of clients within current screen"""
for win in self.find_clients(group):
if win.maximized:
win.maximized = True
elif win.fullscreen:
win.fullscreen = True
else:
#... | AttributeError | dataset/ETHPy150Open qtile/qtile/libqtile/layout/floating.py/Floating.to_screen |
175 | def configure(self, client, screen):
if client is self.focused:
bc = client.group.qtile.colorPixel(self.border_focus)
else:
bc = client.group.qtile.colorPixel(self.border_normal)
if client.maximized:
bw = self.max_border_width
elif client.fullscreen:
... | AttributeError | dataset/ETHPy150Open qtile/qtile/libqtile/layout/floating.py/Floating.configure |
176 | def configure(self, win, screen):
# force recalc
if not self.last_screen or self.last_screen != screen:
self.last_screen = screen
self.dirty = True
if self.last_size and not self.dirty:
if screen.width != self.last_size[0] or \
screen.heigh... | ValueError | dataset/ETHPy150Open qtile/qtile/libqtile/layout/ratiotile.py/RatioTile.configure |
177 | def default_store(database, host, port):
"""Gets a default store for connectable or URL. If store does not exist
one is created and added to shared default store pool."""
key = (database, host, port)
try:
store = _default_stores[key]
except __HOLE__:
store = MongoDBStore(database, h... | KeyError | dataset/ETHPy150Open Stiivi/bubbles/bubbles/backends/mongo/objects.py/default_store |
178 | def new_transport_init(self, host, connect_timeout):
import errno
import re
import socket
import ssl
# Jython does not have this attribute
try:
from socket import SOL_TCP
except ImportError: # pragma: no cover
from socket import IPPROTO_TCP as SOL_TCP # noqa
try:
from ssl import SSLError
except Impo... | NotImplementedError | dataset/ETHPy150Open cr0hn/enteletaor/enteletaor_lib/modules/brute/patch.py/new_transport_init |
179 | def to_internal_value(self, value):
value = super(PatchItem, self).to_internal_value(value)
if set(value.keys()) != set(['op', 'path', 'value']):
raise ValidationError("Missing some of required parts: 'path', 'op', 'value'")
if value['path'][0] != '/':
raise ValidationErr... | KeyError | dataset/ETHPy150Open umutbozkurt/django-rest-framework-mongoengine/rest_framework_mongoengine/contrib/patching.py/PatchItem.to_internal_value |
180 | def __call__(self, i, default=DEFAULT, cast=None, otherwise=None):
"""
request.args(0,default=0,cast=int,otherwise='http://error_url')
request.args(0,default=0,cast=int,otherwise=lambda:...)
"""
n = len(self)
if 0 <= i < n or -n <= i < 0:
value = self[i]
... | ValueError | dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/storage.py/List.__call__ |
181 | def _extract_aliases(self, page, id=None):
dict_of_keylists = {
'url' : ['url']
}
aliases_dict = provider._extract_from_xml(page, dict_of_keylists)
try:
doi = provider.doi_from_url_string(aliases_dict["url"])
if doi:
aliases_dict["doi... | KeyError | dataset/ETHPy150Open Impactstory/total-impact-core/totalimpact/providers/dataone.py/Dataone._extract_aliases |
182 | def print_json(obj):
try:
s = json.dumps(obj, sort_keys = True, indent = 4, cls=MyEncoder)
except __HOLE__:
s = repr(obj)
sys.stdout.write(s + "\n")
sys.stdout.flush() | TypeError | dataset/ETHPy150Open bitxbay/BitXBay/electru/build/lib/electrum/util.py/print_json |
183 | @extensionclassmethod(Observable)
def concat(cls, *args):
"""Concatenates all the observable sequences.
1 - res = Observable.concat(xs, ys, zs)
2 - res = Observable.concat([xs, ys, zs])
Returns an observable sequence that contains the elements of each given
sequence, in sequential order.
"""
... | StopIteration | dataset/ETHPy150Open ReactiveX/RxPY/rx/linq/observable/concat.py/concat |
184 | def get_media_requests(self, item, info):
try:
img_elem = info.spider.scraper.get_image_elem()
if img_elem.scraped_obj_attr.name in item and item[img_elem.scraped_obj_attr.name]:
if not hasattr(self, 'conf'):
self.conf = info.spider.conf
... | TypeError | dataset/ETHPy150Open holgerd77/django-dynamic-scraper/dynamic_scraper/pipelines.py/DjangoImagesPipeline.get_media_requests |
185 | def unregister(self, address):
addr = ipaddress.ip_address(address)
try:
self._pool.remove(addr)
except __HOLE__:
pass | ValueError | dataset/ETHPy150Open sorz/sstp-server/sstpd/address.py/IPPool.unregister |
186 | @crossdomain
@endpoint
def get(self, **kwargs):
current_app.logger.info("GETting record(s) from database")
records = []
# generate meta information
params = {'query': self.access_limits(**kwargs), 'projection': {}}
if '_limit' in request.args:
try:
... | ValueError | dataset/ETHPy150Open gevious/flask_slither/flask_slither/resources.py/BaseResource.get |
187 | def unquote(s):
"""unquote('abc%20def') -> 'abc def'."""
res = s.split('%')
for i in xrange(1, len(res)):
item = res[i]
try:
res[i] = _hextochr[item[:2]] + item[2:]
except KeyError:
res[i] = '%' + item
except __HOLE__:
res[i] = un... | UnicodeDecodeError | dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/urlparse.py/unquote |
188 | def test():
import sys
base = ''
if sys.argv[1:]:
fn = sys.argv[1]
if fn == '-':
fp = sys.stdin
else:
fp = open(fn)
else:
try:
from cStringIO import StringIO
except __HOLE__:
from StringIO import StringI... | ImportError | dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/urlparse.py/test |
189 | def reverse(
self,
query,
exactly_one=False,
timeout=None,
):
"""
Given a point, find an address.
.. versionadded:: 1.2.0
:param string query: The coordinates for which you wish to obtain the
closest human-readable... | ValueError | dataset/ETHPy150Open geopy/geopy/geopy/geocoders/geonames.py/GeoNames.reverse |
190 | def multi_service():
"""Start all the services in separate threads"""
threads = []
for service in [test_notification_service, console_monitor_service]:
threads.append(threading.Thread(target=service))
for thread in threads:
thread.daemon = True
thread.start()
while threading.... | KeyboardInterrupt | dataset/ETHPy150Open datastax/cstar_perf/frontend/cstar_perf/frontend/server/notifications.py/multi_service |
191 | def coroutine(func):
""" Decorator for coroutine functions that need to block for asynchronous operations. """
@functools.wraps(func)
def wrapper(*args, **kwargs):
return_future = Future()
def handle_future(future):
# Chained futures!
try:
if future.e... | StopIteration | dataset/ETHPy150Open Shizmob/pydle/pydle/async.py/coroutine |
192 | def _importAndCheckStack(importName):
"""
Import the given name as a module, then walk the stack to determine whether
the failure was the module not existing, or some code in the module (for
example a dependent import) failing. This can be helpful to determine
whether any actual application code wa... | ImportError | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/reflect.py/_importAndCheckStack |
193 | def resolve_function_type(self, func, args, kws):
"""
Resolve function type *func* for argument types *args* and *kws*.
A signature is returned.
"""
if func not in self._functions:
# It's not a known function type, perhaps it's a global?
try:
... | KeyError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext.resolve_function_type |
194 | def resolve_value_type(self, val):
"""
Return the numba type of a Python value that is being used
as a runtime constant.
None is returned for unsupported types.
"""
tp = typeof(val, Purpose.constant)
if tp is not None:
return tp
if isinstance(... | KeyError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext.resolve_value_type |
195 | def _get_global_type(self, gv):
try:
return self._lookup_global(gv)
except __HOLE__:
if isinstance(gv, pytypes.ModuleType):
return types.Module(gv)
else:
raise | KeyError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext._get_global_type |
196 | def install_registry(self, registry):
"""
Install a *registry* (a templates.Registry instance) of function,
attribute and global declarations.
"""
try:
loader = self._registries[registry]
except KeyError:
loader = templates.RegistryLoader(registry)... | KeyError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext.install_registry |
197 | def _lookup_global(self, gv):
"""
Look up the registered type for global value *gv*.
"""
try:
gv = weakref.ref(gv)
except __HOLE__:
pass
return self._globals[gv] | TypeError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext._lookup_global |
198 | def _insert_global(self, gv, gty):
"""
Register type *gty* for value *gv*. Only a weak reference
to *gv* is kept, if possible.
"""
def on_disposal(wr, pop=self._globals.pop):
# pop() is pre-looked up to avoid a crash late at shutdown on 3.5
# (https://bug... | TypeError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext._insert_global |
199 | def _remove_global(self, gv):
"""
Remove the registered type for global value *gv*.
"""
try:
gv = weakref.ref(gv)
except __HOLE__:
pass
del self._globals[gv] | TypeError | dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext._remove_global |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.