Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
6,000 | def has_builder(self):
"""Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calli... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.has_builder |
6,001 | def has_explicit_builder(self):
"""Return whether this Node has an explicit builder
This allows an internal Builder created by SCons to be marked
non-explicit, so that it can be overridden by an explicit
builder that the user supplies (the canonical example being
directories).""... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.has_explicit_builder |
6,002 | def get_builder(self, default_builder=None):
"""Return the set builder, or a specified default value"""
try:
return self.builder
except __HOLE__:
return default_builder | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.get_builder |
6,003 | def get_source_scanner(self, node):
"""Fetch the source scanner for the specified node
NOTE: "self" is the target being built, "node" is
the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be
called from locations w... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.get_source_scanner |
6,004 | def get_ninfo(self):
try:
return self.ninfo
except __HOLE__:
self.ninfo = self.new_ninfo()
return self.ninfo | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.get_ninfo |
6,005 | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.get_binfo |
6,006 | def del_binfo(self):
"""Delete the build info from this node."""
try:
delattr(self, 'binfo')
except __HOLE__:
pass | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.del_binfo |
6,007 | def get_csig(self):
try:
return self.ninfo.csig
except __HOLE__:
ninfo = self.get_ninfo()
ninfo.csig = SCons.Util.MD5signature(self.get_contents())
return self.ninfo.csig | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.get_csig |
6,008 | def add_dependency(self, depend):
"""Adds dependencies."""
try:
self._add_child(self.depends, self.depends_set, depend)
except __HOLE__, e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s = str(... | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.add_dependency |
6,009 | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
try:
self._add_child(self.ignore, self.ignore_set, depend)
except __HOLE__, e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s = ... | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.add_ignore |
6,010 | def add_source(self, source):
"""Adds sources."""
if self._specific_sources:
return
try:
self._add_child(self.sources, self.sources_set, source)
except __HOLE__, e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e... | TypeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.add_source |
6,011 | def _children_get(self):
try:
return self._memo['children_get']
except __HOLE__:
pass
# The return list may contain duplicate Nodes, especially in
# source trees where there are a lot of repeated #includes
# of a tangle of .h files. Profiling shows, howe... | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node._children_get |
6,012 | def explain(self):
if not self.exists():
return "building `%s' because it doesn't exist\n" % self
if self.always_build:
return "rebuilding `%s' because AlwaysBuild() is specified\n" % self
old = self.get_stored_info()
if old is None:
return None
... | AttributeError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py/Node.explain |
6,013 | def post(self):
"""POST"""
ca_id = self.request.get('ca_id', None)
auth1 = self.GetAuth1Instance(ca_id=ca_id)
if self._IsRemoteIpAddressBlocked(os.environ.get('REMOTE_ADDR', '')):
raise base.NotAuthenticated('RemoteIpAddressBlocked')
n = self.request.get('n', None)
m = self.request.get('... | ValueError | dataset/ETHPy150Open google/simian/src/simian/mac/munki/handlers/auth.py/Auth.post |
6,014 | def create(vm_):
'''
Create a single instance from a data dict.
CLI Examples:
.. code-block:: bash
salt-cloud -p qingcloud-ubuntu-c1m1 hostname1
salt-cloud -m /path/to/mymap.sls -P
'''
try:
# Check for required profile parameters before sending any API calls.
i... | AttributeError | dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/qingcloud.py/create |
6,015 | def create(self, req, body):
"""Creates a new snapshot."""
context = req.environ['nova.context']
authorize(context, action='create')
if not self.is_valid_body(body, 'snapshot'):
raise webob.exc.HTTPBadRequest()
try:
snapshot = body['snapshot']
... | KeyError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/assisted_volume_snapshots.py/AssistedVolumeSnapshotsController.create |
6,016 | def delete(self, req, id):
"""Delete a snapshot."""
context = req.environ['nova.context']
authorize(context, action='delete')
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
delete_metadata = {}
delete_metadata.update(req.GET)
try:
... | ValueError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/assisted_volume_snapshots.py/AssistedVolumeSnapshotsController.delete |
6,017 | def __init__(self, name, start=False, profile_sql=False, connection_names=('default',)):
"""Constructor
:param name: name of the Profiler instance
:type name: string
:param start: whether to start immediately after Profiler instantiation
:type start: bool
:param profile_... | AssertionError | dataset/ETHPy150Open CodeScaleInc/django-profiler/profiling/__init__.py/Profiler.__init__ |
6,018 | def profile(*fn, **options):
"""Decorator for profiling functions and class methods.
:param profile_sql: whether to profile sql queries or not
:type profile_sql: bool
:param stats: whether to use cProfile or profile module to get execution statistics
:type stats: bool
:param stats_filename: fil... | AttributeError | dataset/ETHPy150Open CodeScaleInc/django-profiler/profiling/__init__.py/profile |
6,019 | def validate_maplight_date(d):
try:
datetime.strptime(d, '%Y-%m-%d')
return True
except __HOLE__:
return False
# TODO Also create MapLightContestMeasure | ValueError | dataset/ETHPy150Open wevoteeducation/WeVoteBase/import_export_maplight/models.py/validate_maplight_date |
6,020 | @click.command(short_help="Upload datasets to Mapbox accounts")
@click.argument('tileset', required=True)
@click.argument('infile', type=click.File('r'), required=False)
@click.option('--name', default=None, help="Name for the data upload")
@click.pass_context
def upload(ctx, tileset, infile, name):
"""Upload data ... | IOError | dataset/ETHPy150Open mapbox/mapbox-cli-py/mapboxcli/scripts/uploads.py/upload |
6,021 | def match(self, regexp, flags=None):
"""compile the given regexp, cache the reg, and call match_reg()."""
try:
reg = _regexp_cache[(regexp, flags)]
except __HOLE__:
if flags:
reg = re.compile(regexp, flags)
else:
reg = re.compi... | KeyError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Mako-0.8.1/mako/lexer.py/Lexer.match |
6,022 | def decode_raw_stream(self, text, decode_raw, known_encoding, filename):
"""given string/unicode or bytes/string, determine encoding
from magic encoding comment, return body as unicode
or raw if decode_raw=False
"""
if isinstance(text, compat.text_type):
m = se... | UnicodeDecodeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Mako-0.8.1/mako/lexer.py/Lexer.decode_raw_stream |
6,023 | def has_object_permission(self, permission, request, view, obj):
safe_locals = {"obj": obj, "request": request}
try:
attr1_value = eval(self.obj_attr1, {}, safe_locals)
attr2_value = eval(self.obj_attr2, {}, safe_locals)
except __HOLE__:
return False
... | AttributeError | dataset/ETHPy150Open niwinz/djangorestframework-composed-permissions/restfw_composed_permissions/generic/components.py/ObjectAttrEqualToObjectAttr.has_object_permission |
6,024 | def getPositionByType(self, tagSet):
if not self.__tagToPosIdx:
idx = self.__namedTypesLen
while idx > 0:
idx = idx - 1
tagMap = self.__namedTypes[idx].getType().getTagMap()
for t in tagMap.getPosMap():
if t in self.__ta... | KeyError | dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/pyasn1/type/namedtype.py/NamedTypes.getPositionByType |
6,025 | def getNameByPosition(self, idx):
try:
return self.__namedTypes[idx].getName()
except __HOLE__:
raise error.PyAsn1Error('Type position out of range') | IndexError | dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/pyasn1/type/namedtype.py/NamedTypes.getNameByPosition |
6,026 | def getPositionByName(self, name):
if not self.__nameToPosIdx:
idx = self.__namedTypesLen
while idx > 0:
idx = idx - 1
n = self.__namedTypes[idx].getName()
if n in self.__nameToPosIdx:
raise error.PyAsn1Error('Duplicate ... | KeyError | dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/pyasn1/type/namedtype.py/NamedTypes.getPositionByName |
6,027 | def getTagMapNearPosition(self, idx):
if not self.__ambigiousTypes: self.__buildAmbigiousTagMap()
try:
return self.__ambigiousTypes[idx].getTagMap()
except __HOLE__:
raise error.PyAsn1Error('Type position out of range') | KeyError | dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/pyasn1/type/namedtype.py/NamedTypes.getTagMapNearPosition |
6,028 | def getPositionNearType(self, tagSet, idx):
if not self.__ambigiousTypes: self.__buildAmbigiousTagMap()
try:
return idx+self.__ambigiousTypes[idx].getPositionByType(tagSet)
except __HOLE__:
raise error.PyAsn1Error('Type position out of range') | KeyError | dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/pyasn1/type/namedtype.py/NamedTypes.getPositionNearType |
6,029 | def compress(self, data_list):
if data_list:
try:
month = int(data_list[0])
except (ValueError, __HOLE__):
raise forms.ValidationError(self.error_messages['invalid_month'])
try:
year = int(data_list[1])
except (Value... | TypeError | dataset/ETHPy150Open jumoconnect/openjumo/jumodjango/etc/credit_card_fields.py/ExpiryDateField.compress |
6,030 | def test_errors_non_list():
"""
When a ListField is given a non-list value, then there should be one error related to the type
mismatch.
"""
field = ListField(child=DateField())
try:
field.to_internal_value('notAList')
assert False, 'Expected ValidationError'
except __HOLE__ ... | ValidationError | dataset/ETHPy150Open estebistec/drf-compound-fields/tests/test_listfield.py/test_errors_non_list |
6,031 | def test_validate_elements_valid():
"""
When a ListField is given a list whose elements are valid for the item-field, then validate
should not raise a ValidationError.
"""
field = ListField(child=CharField(max_length=5))
try:
field.to_internal_value(["a", "b", "c"])
except __HOLE__:
... | ValidationError | dataset/ETHPy150Open estebistec/drf-compound-fields/tests/test_listfield.py/test_validate_elements_valid |
6,032 | def perform_search(fn_to_tagged_sents,
onset=None, nucleus=None, coda=None, tone=None,
initial=None, final=None, jyutping=None,
character=None, pos=None,
word_range=(0, 0), sent_range=(0, 0),
tagged=True, sents=False):
""... | ValueError | dataset/ETHPy150Open pycantonese/pycantonese/pycantonese/search.py/perform_search |
6,033 | def run(self, test):
"Run the given test case or test suite."
result = self._makeResult()
registerResult(result)
result.failfast = self.failfast
result.buffer = self.buffer
with warnings.catch_warnings():
if self.warnings:
# if self.warnings i... | AttributeError | dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/unittest/runner.py/TextTestRunner.run |
6,034 | def _weigh_object(self, host_state, weight_properties):
value = 0.0
# NOTE(sbauza): Keying a dict of Metrics per metric name given that we
# have a MonitorMetricList object
metrics_dict = {m.name: m for m in host_state.metrics or []}
for (name, ratio) in self.setting:
... | KeyError | dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/scheduler/weights/metrics.py/MetricsWeigher._weigh_object |
6,035 | def render(self, context):
# Try to resolve the variables. If they are not resolve-able, then use
# the provided name itself.
try:
email = self.email.resolve(context)
except template.VariableDoesNotExist:
email = self.email.var
try:
ra... | AttributeError | dataset/ETHPy150Open caseywstark/colab/colab/apps/threadedcomments/templatetags/gravatar.py/GravatarUrlNode.render |
6,036 | def render(self, name, value, attrs):
encoded = value
if not is_password_usable(encoded):
return "None"
final_attrs = self.build_attrs(attrs)
encoded = smart_str(encoded)
if len(encoded) == 32 and '$' not in encoded:
algorithm = 'unsalted_md5'
... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/auth/forms.py/ReadOnlyPasswordHashWidget.render |
6,037 | def render(self, context):
try:
expire_time = self.expire_time_var.resolve(context)
except VariableDoesNotExist:
raise TemplateSyntaxError('"cache" tag got an unknown variable: %r' % self.expire_time_var.var)
try:
expire_time = int(expire_time)
except ... | ValueError | dataset/ETHPy150Open django/django/django/templatetags/cache.py/CacheNode.render |
6,038 | def test_m2m_cross_database_protection(self):
"Operations that involve sharing M2M objects across databases raise an error"
# Create a book and author on the default database
pro = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, 16))
... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_m2m_cross_database_protection |
6,039 | def test_foreign_key_cross_database_protection(self):
"Operations that involve sharing FK objects across databases raise an error"
# Create a book and author on the default database
pro = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, ... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_foreign_key_cross_database_protection |
6,040 | def test_o2o_cross_database_protection(self):
"Operations that involve sharing FK objects across databases raise an error"
# Create a user and profile on the default database
alice = User.objects.db_manager('default').create_user('alice', 'alice@example.com')
# Create a user and profile... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_o2o_cross_database_protection |
6,041 | def test_generic_key_cross_database_protection(self):
"Operations that involve sharing generic key objects across databases raise an error"
copy_content_types_from_default_to_other()
# Create a book and author on the default database
pro = Book.objects.create(title="Pro Django",
... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_generic_key_cross_database_protection |
6,042 | def test_subquery(self):
"""Make sure as_sql works with subqueries and master/slave."""
sub = Person.objects.using('other').filter(name='fff')
qs = Book.objects.filter(editor__in=sub)
# When you call __str__ on the query object, it doesn't know about using
# so it falls back to ... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_subquery |
6,043 | def test_foreign_key_cross_database_protection(self):
"Foreign keys can cross databases if they two databases have a common source"
# Create a book and author on the default database
pro = Book.objects.using('default').create(title="Pro Django",
... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/RouterTestCase.test_foreign_key_cross_database_protection |
6,044 | def test_m2m_cross_database_protection(self):
"M2M relations can cross databases if the database share a source"
# Create books and authors on the inverse to the usual database
pro = Book.objects.using('other').create(pk=1, title="Pro Django",
pub... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/RouterTestCase.test_m2m_cross_database_protection |
6,045 | def test_o2o_cross_database_protection(self):
"Operations that involve sharing FK objects across databases raise an error"
# Create a user and profile on the default database
alice = User.objects.db_manager('default').create_user('alice', 'alice@example.com')
# Create a user and profile... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/RouterTestCase.test_o2o_cross_database_protection |
6,046 | def test_generic_key_cross_database_protection(self):
"Generic Key operations can span databases if they share a source"
copy_content_types_from_default_to_other()
# Create a book and author on the default database
pro = Book.objects.using('default'
).create(title="Pro D... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/RouterTestCase.test_generic_key_cross_database_protection |
6,047 | @property
def currentWindow(self):
try:
return self.focusHistory[-1]
except __HOLE__:
# no window has focus
return None | IndexError | dataset/ETHPy150Open qtile/qtile/libqtile/group.py/_Group.currentWindow |
6,048 | @currentWindow.setter
def currentWindow(self, win):
try:
self.focusHistory.remove(win)
except __HOLE__:
# win has never received focus before
pass
self.focusHistory.append(win) | ValueError | dataset/ETHPy150Open qtile/qtile/libqtile/group.py/_Group.currentWindow |
6,049 | def _remove_from_focus_history(self, win):
try:
index = self.focusHistory.index(win)
except __HOLE__:
# win has never received focus
return False
else:
del self.focusHistory[index]
# return True if win was the last item (i.e. it was cur... | ValueError | dataset/ETHPy150Open qtile/qtile/libqtile/group.py/_Group._remove_from_focus_history |
6,050 | def assert_equal_steps(test_case, expected, actual):
"""
Assert that the list of provided steps are the same.
If they are not, display the differences intelligently.
:param test_case: The ``TestCase`` whose assert methods will be called.
:param expected: The expected build step instance.
:param... | IndexError | dataset/ETHPy150Open ClusterHQ/flocker/admin/test/test_packaging.py/assert_equal_steps |
6,051 | def test_internal_symlinks_only(self):
"""
The resulting ``virtualenv`` only contains symlinks to files inside the
virtualenv and to /usr on the host OS.
"""
target_path = FilePath(self.mktemp())
create_virtualenv(root=target_path)
allowed_targets = (target_path, ... | ValueError | dataset/ETHPy150Open ClusterHQ/flocker/admin/test/test_packaging.py/CreateVirtualenvTests.test_internal_symlinks_only |
6,052 | def test_usage_error_message(self):
"""
``DockerBuildScript.main`` prints a usage error to ``stderr`` if there
are missing command line options.
"""
fake_sys_module = FakeSysModule(argv=[])
script = DockerBuildScript(sys_module=fake_sys_module)
try:
sc... | SystemExit | dataset/ETHPy150Open ClusterHQ/flocker/admin/test/test_packaging.py/DockerBuildScriptTests.test_usage_error_message |
6,053 | def test_usage_error_message(self):
"""
``BuildScript.main`` prints a usage error to ``stderr`` if there are
missing command line options.
"""
fake_sys_module = FakeSysModule(argv=[])
script = BuildScript(sys_module=fake_sys_module)
try:
script.main(t... | SystemExit | dataset/ETHPy150Open ClusterHQ/flocker/admin/test/test_packaging.py/BuildScriptTests.test_usage_error_message |
6,054 | def parseStringToPythonAst(text):
lineOffsets = computeLineOffsets(text)
try:
pyAst = astCache_.get(text)
if pyAst is None:
pyAst = astCache_[text] = convertPythonAstToForaPythonAst(ast.parse(text), lineOffsets)
return pyAst
except SyntaxError as e:
return ForaNat... | TypeError | dataset/ETHPy150Open ufora/ufora/ufora/FORA/python/PurePython/PythonAstConverter.py/parseStringToPythonAst |
6,055 | def last_event(request, slug):
"Displays a list of all services and their current status."
try:
service = Service.objects.get(slug=slug)
except Service.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
try:
evt = service.event_set.order_by('-date_crea... | IndexError | dataset/ETHPy150Open disqus/overseer/overseer/views.py/last_event |
6,056 | def test_drop_column(self):
try:
self.tbl.drop_column('date')
assert 'date' not in self.tbl.columns
except __HOLE__:
pass | NotImplementedError | dataset/ETHPy150Open pudo/dataset/test/test_persistence.py/TableTestCase.test_drop_column |
6,057 | def hamming(str1, str2):
"""Algorithm based on an old project of mine, ported from yavascript:
christabor.github.io/etude/09-02-2014/.
A superior algorithm exists at
wikipedia.org/wiki/Hamming_distance#Algorithm_example,
but copying it would defeat the purpose."""
dist = 0
last_longer = len... | IndexError | dataset/ETHPy150Open christabor/MoAL/MOAL/algorithms/coding_theory/hamming_distance.py/hamming |
6,058 | def state_writer(self):
while self.server.is_alive():
# state is not guaranteed accurate, as we do not
# update the file on every iteration
gevent.sleep(0.01)
try:
job_id, job = self.server.first_job()
except __HOLE__:
... | IndexError | dataset/ETHPy150Open dcramer/taskmaster/src/taskmaster/server.py/Controller.state_writer |
6,059 | @staticmethod
def json_body(req):
if not req.content_length:
return {}
try:
raw_json = req.stream.read()
except Exception:
raise freezer_api_exc.BadDataFormat('Empty request body. A valid '
'JSON document is... | ValueError | dataset/ETHPy150Open openstack/freezer-api/freezer_api/api/common/resource.py/BaseResource.json_body |
6,060 | @opt.register_specialize
@opt.register_stabilize
@opt.register_canonicalize
@gof.local_optimizer([CrossentropySoftmax1HotWithBiasDx])
def local_useless_crossentropy_softmax_1hot_with_bias_dx_alloc(node):
"""
Replace a CrossentropySoftmax1HotWithBiasDx op, whose incoming gradient is
an `alloc` of a scalar va... | AttributeError | dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/nnet.py/local_useless_crossentropy_softmax_1hot_with_bias_dx_alloc |
6,061 | def gerbers_to_svg(manufacturer='default'):
"""
Takes Gerber files as input and generates an SVG of them
"""
def normalise_gerber_number(gerber_number, axis, form):
"""
Takes a Gerber number and converts it into a float using
the formatting defined in the Gerber header
... | IOError | dataset/ETHPy150Open boldport/pcbmode/pcbmode/utils/gerber.py/gerbers_to_svg |
6,062 | @classmethod
def PushNotification(cls, client, user_id, alert, badge, callback,
exclude_device_id=None, extra=None, sound=None):
"""Queries all devices for 'user'. Devices with 'push_token'
set are pushed notifications via the push_notification API.
NOTE: currently, code path is syn... | TypeError | dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/device.py/Device.PushNotification |
6,063 | def eval_evec(symmetric, d, typ, k, which, v0=None, sigma=None,
mattype=np.asarray, OPpart=None, mode='normal'):
general = ('bmat' in d)
if symmetric:
eigs_func = eigsh
else:
eigs_func = eigs
if general:
err = ("error for %s:general, typ=%s, which=%s, sigma=%s, "
... | AssertionError | dataset/ETHPy150Open scipy/scipy/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py/eval_evec |
6,064 | @contextlib.contextmanager
def cd(newpath):
"""
Change the current working directory to `newpath`, temporarily.
If the old current working directory no longer exists, do not return back.
"""
oldpath = os.getcwd()
os.chdir(newpath)
try:
yield
finally:
try:
os.... | OSError | dataset/ETHPy150Open networkx/networkx/doc/source/conf.py/cd |
6,065 | def DatabaseDirectorySize(root_path, extension):
"""Compute size (in bytes) and number of files of a file-based data store."""
directories = collections.deque([root_path])
total_size = 0
total_files = 0
while directories:
directory = directories.popleft()
try:
items = os.listdir(directory)
e... | OSError | dataset/ETHPy150Open google/grr/grr/lib/data_stores/common.py/DatabaseDirectorySize |
6,066 | def _make_model_class(message_type, indexed_fields, **props):
"""Construct a Model subclass corresponding to a Message subclass.
Args:
message_type: A Message subclass.
indexed_fields: A list of dotted and undotted field names.
**props: Additional properties with which to seed the class.
Returns:
... | KeyError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/ndb/msgprop.py/_make_model_class |
6,067 | def roundFact(fact, inferDecimals=False, vDecimal=None):
if vDecimal is None:
vStr = fact.value
try:
vDecimal = decimal.Decimal(vStr)
vFloatFact = float(vStr)
except (decimal.InvalidOperation, __HOLE__): # would have been a schema error reported earlier
vD... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateXbrlCalcs.py/roundFact |
6,068 | def inferredPrecision(fact):
vStr = fact.value
dStr = fact.decimals
pStr = fact.precision
if dStr == "INF" or pStr == "INF":
return floatINF
try:
vFloat = float(vStr)
if dStr:
match = numberPattern.match(vStr if vStr else str(vFloat))
if match:
... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateXbrlCalcs.py/inferredPrecision |
6,069 | def inferredDecimals(fact):
vStr = fact.value
dStr = fact.decimals
pStr = fact.precision
if dStr == "INF" or pStr == "INF":
return floatINF
try:
if pStr:
p = int(pStr)
if p == 0:
return floatNaN # =0 cannot be determined
vFloat = fl... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateXbrlCalcs.py/inferredDecimals |
6,070 | def roundValue(value, precision=None, decimals=None, scale=None):
try:
vDecimal = decimal.Decimal(value)
if scale:
iScale = int(scale)
vDecimal = vDecimal.scaleb(iScale)
if precision is not None:
vFloat = float(value)
if scale:
... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateXbrlCalcs.py/roundValue |
6,071 | def insignificantDigits(value, precision=None, decimals=None, scale=None):
try:
vDecimal = decimal.Decimal(value)
if scale:
iScale = int(scale)
vDecimal = vDecimal.scaleb(iScale)
if precision is not None:
vFloat = float(value)
if scale:
... | ValueError | dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateXbrlCalcs.py/insignificantDigits |
6,072 | def list(self):
"""List Fuel environments."""
try:
return self.client.get_all()
except __HOLE__:
raise RuntimeError(_("Can't list environments. "
"Please check server availability.")) | SystemExit | dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/scenarios/fuel/utils.py/FuelEnvManager.list |
6,073 | def create(self, name, release_id=1,
network_provider="neutron",
deployment_mode="ha_compact",
net_segment_type="vlan"):
try:
env = self.client.create(name, release_id, network_provider,
deployment_mode, net_segment_ty... | SystemExit | dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/scenarios/fuel/utils.py/FuelEnvManager.create |
6,074 | def getMipMaps(mesh):
mipmaps = {}
for effect in mesh.effects:
for prop in effect.supported:
propval = getattr(effect, prop)
if isinstance(propval, collada.material.Map):
image_name = propval.sampler.surface.image.path
image_data = propval.sam... | IOError | dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/optimize_filters/save_mipmaps.py/getMipMaps |
6,075 | def action(self, destination, data, **kwa):
""" Increment corresponding items in destination by items in data
if only one field then single increment
if multiple fields then vector increment
parameters:
destination = share to increment
source... | TypeError | dataset/ETHPy150Open ioflo/ioflo/ioflo/base/poking.py/IncDirect.action |
6,076 | def action(self, destination, destinationFields, source, sourceFields, **kwa):
""" Increment destinationFields in destination by sourceFields in source
parameters:
destination = share to increment
destinationField = field in share to increment
source =... | TypeError | dataset/ETHPy150Open ioflo/ioflo/ioflo/base/poking.py/IncIndirect.action |
6,077 | def _read_one_frame(self):
"""
Reads a single data frame from the stream and returns it.
"""
# Keep reading until the stream is closed or we have a data frame.
while not self.remote_closed and not self.data:
self._recv_cb()
try:
return self.data.p... | IndexError | dataset/ETHPy150Open Lukasa/hyper/hyper/http20/stream.py/Stream._read_one_frame |
6,078 | def Main():
try:
import setuptools
METADATA.update(SETUPTOOLS_METADATA)
setuptools.setup(**METADATA)
except __HOLE__:
import distutils.core
distutils.core.setup(**METADATA) | ImportError | dataset/ETHPy150Open ryanmcgrath/pythentic_jobs/setup.py/Main |
6,079 | def fail(self):
super(RandomExponentialBackoff, self).fail()
# Exponential growth with ratio sqrt(2); compute random delay
# between x and 2x where x is growing exponentially
delay_scale = int(2 ** (self.number_of_retries / 2.0 - 1)) + 1
delay = delay_scale + random.randint(1, de... | NameError | dataset/ETHPy150Open zulip/zulip/api/zulip/__init__.py/RandomExponentialBackoff.fail |
6,080 | def get_user_agent(self):
vendor = ''
vendor_version = ''
try:
vendor = platform.system()
vendor_version = platform.release()
except __HOLE__:
# If the calling process is handling SIGCHLD, platform.system() can
# fail with an IOError. See ... | IOError | dataset/ETHPy150Open zulip/zulip/api/zulip/__init__.py/Client.get_user_agent |
6,081 | def plot_reflection_factor(self, filename=None):
"""
Plot reflection factor.
"""
if self.frequency is None:
raise ValueError("No frequency specified.")
if self.angle is None:
raise ValueError("No angle specified.")
try:
... | TypeError | dataset/ETHPy150Open python-acoustics/python-acoustics/acoustics/reflection.py/Boundary.plot_reflection_factor |
6,082 | @dir_app.route('/results/')
def get_result_dir_info():
''' Retrieve results directory information.
The backend's results directory is determined by WORK_DIR. All the
directories there are formatted and returned as results. If WORK_DIR does
not exist, an empty listing will be returned (shown as a 'fail... | OSError | dataset/ETHPy150Open apache/climate/ocw-ui/backend/directory_helpers.py/get_result_dir_info |
6,083 | def __init__(self, environment, kwargs):
Dependency.__init__(self)
self.name = 'boost'
self.libdir = ''
try:
self.boost_root = os.environ['BOOST_ROOT']
if not os.path.isabs(self.boost_root):
raise DependencyException('BOOST_ROOT must be an absolute... | KeyError | dataset/ETHPy150Open mesonbuild/meson/mesonbuild/dependencies.py/BoostDependency.__init__ |
6,084 | def _read_config(self):
self.hosts = []
try:
if os.path.exists(self.config_path):
cfgfile = open(self.config_path, 'r')
self.settings = yaml.safe_load(cfgfile.read())
cfgfile.close()
# Use the presence of a Description as an in... | IOError | dataset/ETHPy150Open openshift/openshift-ansible/utils/src/ooinstall/oo_config.py/OOConfig._read_config |
6,085 | @classmethod
def _validate_structure(cls, structure, name, authorized_types):
"""
validate if all fields in self.structure are in authorized types.
"""
##############
def __validate_structure(struct, name, _authorized):
if type(struct) is type:
if ... | TypeError | dataset/ETHPy150Open namlook/mongokit/mongokit/schema_document.py/SchemaDocument._validate_structure |
6,086 | def HashFile(theFile,simplename,o_result):
if os.path.exists(theFile):
if os.path.isfile(theFile):
try:
f=open(theFile,'rb')
except __HOLE__:
log.warning("open failed :"+theFile)
return
else:
try:
... | IOError | dataset/ETHPy150Open girishramnani/hacking-tools/file_hasher/_pfish_tools.py/HashFile |
6,087 | def test_invalid_input_line(self):
caught_exception = False
try:
position = DocumentMapping.Position("app.js", -1, 0)
except __HOLE__:
caught_exception = True
self.assertTrue(caught_exception) | ValueError | dataset/ETHPy150Open sokolovstas/SublimeWebInspector/tests/DocumentMappingTests.py/PositionTests.test_invalid_input_line |
6,088 | def test_invalid_input_column(self):
caught_exception = False
try:
position = DocumentMapping.Position("app.js", 0, -1)
except __HOLE__:
caught_exception = True
self.assertTrue(caught_exception) | ValueError | dataset/ETHPy150Open sokolovstas/SublimeWebInspector/tests/DocumentMappingTests.py/PositionTests.test_invalid_input_column |
6,089 | def test_invalid_input(self):
caught_exception = False
try:
position = DocumentMapping.Position("app.js", -4, -3)
except __HOLE__:
caught_exception = True
self.assertTrue(caught_exception) | ValueError | dataset/ETHPy150Open sokolovstas/SublimeWebInspector/tests/DocumentMappingTests.py/PositionTests.test_invalid_input |
6,090 | def reply2har(reply, include_content=False, binary_content=False):
""" Serialize QNetworkReply to HAR. """
res = {
"httpVersion": "HTTP/1.1", # XXX: how to get HTTP version?
"cookies": reply_cookies2har(reply),
"headers": headers2har(reply),
"content": {
"size": 0,
... | TypeError | dataset/ETHPy150Open scrapinghub/splash/splash/har/qt.py/reply2har |
6,091 | def on_post(self, req, resp, tenant_id):
body = json.loads(req.stream.read().decode())
try:
name = body['keypair']['name']
key = body['keypair'].get('public_key', generate_random_key())
except (__HOLE__, TypeError):
return error_handling.bad_request(
... | KeyError | dataset/ETHPy150Open softlayer/jumpgate/jumpgate/compute/drivers/sl/keypairs.py/KeypairsV2.on_post |
6,092 | @destructiveTest
@skipIf(os.getuid() != 0, 'You must be logged in as root to run this test')
@requires_system_grains
def test_mac_group_chgid(self, grains=None):
'''
Tests changing the group id
'''
# Create a group to delete - If unsuccessful, skip the test
if self.ru... | AssertionError | dataset/ETHPy150Open saltstack/salt/tests/integration/modules/mac_group.py/MacGroupModuleTest.test_mac_group_chgid |
6,093 | @destructiveTest
@skipIf(os.getuid() != 0, 'You must be logged in as root to run this test')
@requires_system_grains
def test_mac_adduser(self, grains=None):
'''
Tests adding user to the group
'''
# Create a group to use for test - If unsuccessful, skip the test
if se... | AssertionError | dataset/ETHPy150Open saltstack/salt/tests/integration/modules/mac_group.py/MacGroupModuleTest.test_mac_adduser |
6,094 | def __init__(self, message):
try:
self.picurl = message.pop('PicUrl')
self.media_id = message.pop('MediaId')
except __HOLE__:
raise ParseError()
super(ImageMessage, self).__init__(message) | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/ImageMessage.__init__ |
6,095 | def __init__(self, message):
try:
self.media_id = message.pop('MediaId')
self.thumb_media_id = message.pop('ThumbMediaId')
except __HOLE__:
raise ParseError()
super(VideoMessage, self).__init__(message) | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/VideoMessage.__init__ |
6,096 | def __init__(self, message):
try:
self.media_id = message.pop('MediaId')
self.thumb_media_id = message.pop('ThumbMediaId')
except __HOLE__:
raise ParseError()
super(ShortVideoMessage, self).__init__(message) | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/ShortVideoMessage.__init__ |
6,097 | def __init__(self, message):
try:
location_x = message.pop('Location_X')
location_y = message.pop('Location_Y')
self.location = (float(location_x), float(location_y))
self.scale = int(message.pop('Scale'))
self.label = message.pop('Label')
exce... | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/LocationMessage.__init__ |
6,098 | def __init__(self, message):
try:
self.title = message.pop('Title')
self.description = message.pop('Description')
self.url = message.pop('Url')
except __HOLE__:
raise ParseError()
super(LinkMessage, self).__init__(message) | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/LinkMessage.__init__ |
6,099 | def __init__(self, message):
message.pop('type')
try:
self.type = message.pop('Event').lower()
if self.type == 'subscribe' or self.type == 'scan':
self.key = message.pop('EventKey', None)
self.ticket = message.pop('Ticket', None)
elif s... | KeyError | dataset/ETHPy150Open wechat-python-sdk/wechat-python-sdk/wechat_sdk/messages.py/EventMessage.__init__ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.