Unnamed: 0 int64 0 10k | function stringlengths 79 138k | label stringclasses 20
values | info stringlengths 42 261 |
|---|---|---|---|
4,700 | def select(self, node):
try:
return self.dict[node.scanner_key()]
except __HOLE__:
return None | KeyError | dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/__init__.py/Selector.select |
4,701 | def __del__(self):
"Destroys this DataStructure object."
try:
capi.destroy_ds(self._ptr)
except (AttributeError, __HOLE__):
pass # Some part might already have been garbage collected | TypeError | dataset/ETHPy150Open django/django/django/contrib/gis/gdal/datasource.py/DataSource.__del__ |
4,702 | @login_required
@permission_required("relaydomains.add_service")
@require_http_methods(["POST"])
def scan_for_services(request):
try:
Service.objects.load_from_master_cf()
except __HOLE__ as e:
return render_to_json_response([str(e)], status=500)
return render_to_json_response(
dict... | IOError | dataset/ETHPy150Open tonioo/modoboa/modoboa/relaydomains/views.py/scan_for_services |
4,703 | def _LoadModuleCode(filename):
"""Loads the code of a module, using compiled bytecode if available.
Args:
filename: The Python script filename.
Returns:
A 2-tuple (code, filename) where:
code: A code object contained in the file or None if it does not exist.
filename: The name of the file lo... | ValueError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/runtime/cgi.py/_LoadModuleCode |
4,704 | def _GetModuleOrNone(module_name):
"""Returns a module if it exists or None."""
module = None
if module_name:
try:
module = __import__(module_name)
except __HOLE__:
pass
else:
for name in module_name.split('.')[1:]:
module = getattr(module, name)
return module | ImportError | dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/runtime/cgi.py/_GetModuleOrNone |
4,705 | def show(self, req, id):
context = req.environ['nova.context']
authorize(context)
try:
if '.' in id:
before_date = datetime.datetime.strptime(str(id),
"%Y-%m-%d %H:%M:%S.%f")
else:
before_date... | ValueError | dataset/ETHPy150Open openstack/nova/nova/api/openstack/compute/legacy_v2/contrib/instance_usage_audit_log.py/InstanceUsageAuditLogController.show |
4,706 | def revert(self):
for k,v in self._original_settings.iteritems():
if v == NO_SETTING:
try:
delattr(self._settings, k)
except __HOLE__:
# Django < r11825
delattr(self._settings._wrapped, k)
else:
... | AttributeError | dataset/ETHPy150Open carljm/django-localeurl/localeurl/tests/test_utils.py/TestSettingsManager.revert |
4,707 | def __init__(self, template_string, name='<Unknown Template>',
libraries=[]):
try:
template_string = encoding.smart_unicode(template_string)
except __HOLE__:
raise template.TemplateEncodingError(
"template content must be unicode or UTF-8 string")
... | UnicodeDecodeError | dataset/ETHPy150Open carljm/django-localeurl/localeurl/tests/test_utils.py/TestTemplate.__init__ |
4,708 | def processOne(self, deferred):
if self.stopping:
deferred.callback(self.root)
return
try:
self.remaining=self.iterator.next()
except __HOLE__:
self.stopping=1
except:
deferred.errback(failure.Failure())
... | StopIteration | dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/scripts/tkunzip.py/Progressor.processOne |
4,709 | def validate(self, values, model_instance):
try:
iter(values)
except __HOLE__:
raise ValidationError("Value of type %r is not iterable." %
type(values)) | TypeError | dataset/ETHPy150Open django-nonrel/djangotoolbox/djangotoolbox/fields.py/AbstractIterableField.validate |
4,710 | def fixdir(lst):
try:
lst.remove('__builtins__')
except __HOLE__:
pass
return lst
# Helper to run a test | ValueError | dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_pkg.py/fixdir |
4,711 | def runtest(hier, code):
root = tempfile.mkdtemp()
mkhier(root, hier)
savepath = sys.path[:]
fd, fname = tempfile.mkstemp(text=True)
os.write(fd, code)
os.close(fd)
try:
sys.path.insert(0, root)
if verbose: print "sys.path =", sys.path
try:
execfile(fname,... | IOError | dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_pkg.py/runtest |
4,712 | @cached_property
def supports_stddev(self):
"Confirm support for STDDEV and related stats functions"
class StdDevPop(object):
sql_function = 'STDDEV_POP'
try:
self.connection.ops.check_aggregate_support(StdDevPop())
return True
except __HOLE__:
... | NotImplementedError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/backends/__init__.py/BaseDatabaseFeatures.supports_stddev |
4,713 | def get_function_attributes(func):
'''
Extract the function attributes from a Python function or object with
*py_func* attribute, such as CPUDispatcher.
Returns an instance of FunctionAttributes.
'''
if hasattr(func, 'py_func'):
func = func.py_func # This is a Overload object
name... | TypeError | dataset/ETHPy150Open numba/numba/numba/compiler.py/get_function_attributes |
4,714 | def _convert_to_integer(self, name, value):
try:
return int(value)
except __HOLE__:
LOGGER.error("Option '--%s' expected integer value but got '%s'. "
"Default value used instead." % (name.lower(), value))
return self._get_default_value(name) | ValueError | dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/conf/settings.py/_BaseSettings._convert_to_integer |
4,715 | def style_language(self, style):
"""Return language corresponding to this style."""
try:
return style.language
except AttributeError:
pass
try:
return self.styles['bodytext'].language
except __HOLE__:
# FIXME: this is pretty arbitra... | AttributeError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.style_language |
4,716 | def text_for_label(self, label, style):
"""Translate text for label."""
try:
text = self.docutils_languages[
self.style_language(style)].labels[label]
except __HOLE__:
text = label.capitalize()
return text | KeyError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.text_for_label |
4,717 | def text_for_bib_field(self, field, style):
"""Translate text for bibliographic fields."""
try:
text = self.docutils_languages[
self.style_language(style)].bibliographic_fields[field]
except __HOLE__:
text = field
return text + ":" | KeyError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.text_for_bib_field |
4,718 | def author_separator(self, style):
"""Return separator string for authors."""
try:
sep = self.docutils_languages[
self.style_language(style)].author_separators[0]
except __HOLE__:
sep = ';'
return sep + " " | KeyError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.author_separator |
4,719 | def styleToTags(self, style):
'''Takes a style name, returns a pair of opening/closing tags for it, like
"<font face=helvetica size=14 color=red>". Used for inline
nodes (custom interpreted roles)'''
try:
s = self.styles[style]
r1=['<font face="%s" color="#%s" ' ... | KeyError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.styleToTags |
4,720 | def styleToFont(self, style):
'''Takes a style name, returns a font tag for it, like
"<font face=helvetica size=14 color=red>". Used for inline
nodes (custom interpreted roles)'''
try:
s = self.styles[style]
r=['<font face="%s" color="#%s" ' %
(s.... | KeyError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.styleToFont |
4,721 | def createPdf(self, text=None,
source_path=None,
output=None,
doctree=None,
compressed=False,
# This adds entries to the PDF TOC
# matching the rst source lines
debugLinesPdf=False):
"""... | ValueError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/RstToPdf.createPdf |
4,722 | def replaceTokens(self, elems, canv, doc, smarty):
"""Put doc_title/page number/etc in text of header/footer."""
# Make sure page counter is up to date
pnum=setPageCounter()
def replace(text):
if not isinstance(text, unicode):
try:
text =... | TypeError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/HeaderOrFooter.replaceTokens |
4,723 | def draw_background(self, which, canv):
''' Draws a background and/or foreground image
on each page which uses the template.
Calculates the image one time, and caches
it for reuse on every page in the template.
How the background is drawn depends on the
... | ValueError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/FancyPage.draw_background |
4,724 | def main(_args=None):
"""Parse command line and call createPdf with the correct data."""
parser = parse_commandline()
# Fix issue 430: don't overwrite args
# need to parse_args to see i we have a custom config file
options, args = parser.parse_args(copy(_args))
if options.configfile:
#... | IOError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/main |
4,725 | def add_extensions(options):
extensions = []
for ext in options.extensions:
if not ext.startswith('!'):
extensions.append(ext)
continue
ext = ext[1:]
try:
extensions.remove(ext)
except __HOLE__:
log.warning('Could not remove extens... | ValueError | dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/createpdf.py/add_extensions |
4,726 | def __dir__(self):
"""Return a list of the StackedObjectProxy's and proxied
object's (if one exists) names.
"""
dir_list = dir(self.__class__) + self.__dict__.keys()
try:
dir_list.extend(dir(self._current_obj()))
except __HOLE__:
pass
dir_l... | TypeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy.__dir__ |
4,727 | def __repr__(self):
try:
return repr(self._current_obj())
except (TypeError, __HOLE__):
return '<%s.%s object at 0x%x>' % (self.__class__.__module__,
self.__class__.__name__,
id(self)) | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy.__repr__ |
4,728 | def _current_obj(self):
"""Returns the current active object being proxied to
In the event that no object was pushed, the default object if
provided will be used. Otherwise, a TypeError will be raised.
"""
try:
objects = self.____local__.objects
except __HOL... | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy._current_obj |
4,729 | def _push_object(self, obj):
"""Make ``obj`` the active object for this thread-local.
This should be used like:
.. code-block:: python
obj = yourobject()
module.glob = StackedObjectProxy()
module.glob._push_object(obj)
try:
... d... | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy._push_object |
4,730 | def _pop_object(self, obj=None):
"""Remove a thread-local object.
If ``obj`` is given, it is checked against the popped object and an
error is emitted if they don't match.
"""
try:
popped = self.____local__.objects.pop()
if obj and popped is not obj:
... | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy._pop_object |
4,731 | def _object_stack(self):
"""Returns all of the objects stacked in this container
(Might return [] if there are none)
"""
try:
try:
objs = self.____local__.objects
except __HOLE__:
return []
return objs[:]
except... | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectProxy._object_stack |
4,732 | def restoration_end(self):
"""Register a restoration context as finished, if one exists"""
try:
del self.restoration_context_id.request_id
except __HOLE__:
pass | AttributeError | dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/registry.py/StackedObjectRestorer.restoration_end |
4,733 | def generate_dict(self, constant_map={}):
"""Returns a dictionary containing all the data associated with the
Shape.
Parameters
==========
constant_map : dictionary
If any of the shape's geometry are defined as SymPy expressions,
then this dictionary shou... | TypeError | dataset/ETHPy150Open pydy/pydy/pydy/viz/shapes.py/Shape.generate_dict |
4,734 | def set(self, path, child=False, attribute=False):
""" Accepts a forward slash seperated path of XML elements to traverse and create if non existent.
Optional child and target node attributes can be set. If the `child` attribute is a tuple
it will create X child nodes by reading each tuple as (n... | AttributeError | dataset/ETHPy150Open abunsen/Paython/paython/lib/api.py/XMLGateway.set |
4,735 | def unset(self, key):
"""
Sets up request dict for Get
"""
try:
del self.REQUEST_DICT[key]
except __HOLE__:
raise DataValidationError('The key being unset is non-existent in the request dictionary.') | KeyError | dataset/ETHPy150Open abunsen/Paython/paython/lib/api.py/GetGateway.unset |
4,736 | def __init__(self, context):
self.context = context
self.conn = None
self.cursor = None
self.db_file = None
try:
self.persistence_config = self.context.config['persistence']
self.init_db()
except __HOLE__:
self.context.logger.warn("'per... | KeyError | dataset/ETHPy150Open beerfactory/hbmqtt/hbmqtt/plugins/persistence.py/SQLitePlugin.__init__ |
4,737 | def update_ticket(request, ticket_id, public=False):
if not (public or (request.user.is_authenticated() and request.user.is_active and (request.user.is_staff or helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))):
return HttpResponseRedirect('%s?next=%s' % (reverse('login'), request.path))
tick... | ImportError | dataset/ETHPy150Open rossp/django-helpdesk/helpdesk/views/staff.py/update_ticket |
4,738 | def ticket_list(request):
context = {}
user_queues = _get_user_queues(request.user)
# Prefilter the allowed tickets
base_tickets = Ticket.objects.filter(queue__in=user_queues)
# Query_params will hold a dictionary of parameters relating to
# a query, to be saved if needed:
query_params = {... | ValueError | dataset/ETHPy150Open rossp/django-helpdesk/helpdesk/views/staff.py/ticket_list |
4,739 | def run_report(request, report):
if Ticket.objects.all().count() == 0 or report not in ('queuemonth', 'usermonth', 'queuestatus', 'queuepriority', 'userstatus', 'userpriority', 'userqueue', 'daysuntilticketclosedbymonth'):
return HttpResponseRedirect(reverse("helpdesk_report_index"))
report_queryset = ... | ImportError | dataset/ETHPy150Open rossp/django-helpdesk/helpdesk/views/staff.py/run_report |
4,740 | def selectLink(self, displayPoint, view):
if not self.enabled():
return False
robotModel, _ = vis.findPickedObject(displayPoint, view)
try:
robotModel.model.getLinkNameForMesh
except __HOLE__:
return False
model = robotModel.model
... | AttributeError | dataset/ETHPy150Open RobotLocomotion/director/src/python/director/robotviewbehaviors.py/RobotLinkSelector.selectLink |
4,741 | def getObjectAsPointCloud(obj):
try:
obj = obj.model.polyDataObj
except __HOLE__:
pass
try:
obj.polyData
except AttributeError:
return None
if obj and obj.polyData.GetNumberOfPoints():# and (obj.polyData.GetNumberOfCells() == obj.polyData.GetNumberOfVerts()):
... | AttributeError | dataset/ETHPy150Open RobotLocomotion/director/src/python/director/robotviewbehaviors.py/getObjectAsPointCloud |
4,742 | def __contains__(self,n):
"""Return True if n is a node, False otherwise. Use the expression
'n in G'.
Examples
--------
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> 1 in G
True
"""
try:
... | TypeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.__contains__ |
4,743 | def add_node(self, n, attr_dict=None, **attr):
"""Add a single node n and update node attributes.
Parameters
----------
n : node
A node can be any hashable Python object except None.
attr_dict : dictionary, optional (default= no attributes)
Dictionary of ... | AttributeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.add_node |
4,744 | def add_nodes_from(self, nodes, **attr):
"""Add multiple nodes.
Parameters
----------
nodes : iterable container
A container of nodes (list, dict, set, etc.).
OR
A container of (node, attribute dict) tuples.
Node attributes are updated usi... | TypeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.add_nodes_from |
4,745 | def remove_node(self,n):
"""Remove node n.
Removes the node n and all adjacent edges.
Attempting to remove a non-existent node will raise an exception.
Parameters
----------
n : node
A node in the graph
Raises
-------
NetworkXError
... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.remove_node |
4,746 | def remove_nodes_from(self, nodes):
"""Remove multiple nodes.
Parameters
----------
nodes : iterable container
A container of nodes (list, dict, set, etc.). If a node
in the container is not in the graph it is silently
ignored.
See Also
... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.remove_nodes_from |
4,747 | def has_node(self, n):
"""Return True if the graph contains the node n.
Parameters
----------
n : node
Examples
--------
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2])
>>> G.has_node(0)
True
... | TypeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.has_node |
4,748 | def add_edge(self, u, v, attr_dict=None, **attr):
"""Add an edge between u and v.
The nodes u and v will be automatically added if they are
not already in the graph.
Edge attributes can be specified with keywords or by providing
a dictionary with key/value pairs. See examples ... | AttributeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.add_edge |
4,749 | def add_edges_from(self, ebunch, attr_dict=None, **attr):
"""Add all the edges in ebunch.
Parameters
----------
ebunch : container of edges
Each edge given in the container will be added to the
graph. The edges must be given as as 2-tuples (u,v) or
3-... | AttributeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.add_edges_from |
4,750 | def remove_edge(self, u, v):
"""Remove the edge between u and v.
Parameters
----------
u,v: nodes
Remove the edge between nodes u and v.
Raises
------
NetworkXError
If there is not an edge between u and v.
See Also
------... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.remove_edge |
4,751 | def has_edge(self, u, v):
"""Return True if the edge (u,v) is in the graph.
Parameters
----------
u,v : nodes
Nodes can be, for example, strings or numbers.
Nodes must be hashable (and not None) Python objects.
Returns
-------
edge_ind : ... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.has_edge |
4,752 | def neighbors(self, n):
"""Return a list of the nodes connected to the node n.
Parameters
----------
n : node
A node in the graph
Returns
-------
nlist : list
A list of nodes that are adjacent to n.
Raises
------
N... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.neighbors |
4,753 | def neighbors_iter(self, n):
"""Return an iterator over all neighbors of node n.
Examples
--------
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> [n for n in G.neighbors_iter(0)]
[1]
Notes
-----
... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.neighbors_iter |
4,754 | def get_edge_data(self, u, v, default=None):
"""Return the attribute dictionary associated with edge (u,v).
Parameters
----------
u,v : nodes
default: any Python object (default=None)
Value to return if the edge (u,v) is not found.
Returns
-------
... | KeyError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.get_edge_data |
4,755 | def nbunch_iter(self, nbunch=None):
"""Return an iterator of nodes contained in nbunch that are
also in the graph.
The nodes in nbunch are checked for membership in the graph
and if not are silently ignored.
Parameters
----------
nbunch : iterable container, opt... | TypeError | dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/graph.py/Graph.nbunch_iter |
4,756 | def process_formdata(self, valuelist):
if valuelist:
date_str = u' '.join(valuelist)
if date_str.strip():
for format in self.formats:
try:
timetuple = time.strptime(date_str, format)
self.data = datetime... | ValueError | dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/form/fields.py/TimeField.process_formdata |
4,757 | def process_data(self, value):
if value is None:
self.data = None
else:
try:
self.data = self.coerce(value)
except (ValueError, __HOLE__):
self.data = None | TypeError | dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/form/fields.py/Select2Field.process_data |
4,758 | def process_formdata(self, valuelist):
if valuelist:
if valuelist[0] == '__None':
self.data = None
else:
try:
self.data = self.coerce(valuelist[0])
except __HOLE__:
raise ValueError(self.gettext(u'Inv... | ValueError | dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/form/fields.py/Select2Field.process_formdata |
4,759 | def process_formdata(self, valuelist):
if valuelist:
value = valuelist[0]
# allow saving blank field as None
if not value:
self.data = None
return
try:
self.data = json.loads(valuelist[0])
except __HOLE... | ValueError | dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/form/fields.py/JSONField.process_formdata |
4,760 | def __new__(self, d):
try:
return unicode.__new__(self, d['category']['term'])
except __HOLE__:
return unicode.__new__(self, d) | TypeError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/NetflixAvailability.__new__ |
4,761 | def __init__(self, d):
cat = d['category']
super(NetflixAvailability, self).__init__(**cat)
try:
self.available_from = datetime.fromtimestamp(float(d['available_from']))
self.available = False
except KeyError:
self.available_from = None
try:
... | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/NetflixAvailability.__init__ |
4,762 | def __init__(self, d):
try:
self.links = dict((di['title'], NetflixLink(**di)) for di in d.pop('link'))
except __HOLE__:
pass
for k in d:
setattr(self, k, d[k])
super(FancyObject, self).__init__() | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/FancyObject.__init__ |
4,763 | def __init__(self, d):
title = d.pop('title')
self.title = title['regular']
self.title_short = title['short']
categories = d.pop('category')
self.categories = [NetflixCategory(**di) for di in get_me_a_list_dammit(categories)]
for label in 'estimated_arrival_date', 'shipp... | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/CatalogTitle.__init__ |
4,764 | @property
def netflix_id(self):
try:
return self.links[self.title].href
except __HOLE__:
return self.id | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/CatalogTitle.netflix_id |
4,765 | def __eq__(self, other):
try:
return self.netflix_id == other.netflix_id
except __HOLE__:
try:
return self.netflix_id == other.id
except AttributeError:
return False | AttributeError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/CatalogTitle.__eq__ |
4,766 | def __init__(self, d):
self.preferred_formats = []
try:
preferred_formats = d.pop('preferred_formats')
except __HOLE__:
preferred_formats = d.pop('preferred_format', [])
for pf in get_me_a_list_dammit(preferred_formats):
for category in get_me_... | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/NetflixUser.__init__ |
4,767 | def __init__(self, d):
try:
items = d.pop(self._items_name)
except __HOLE__:
raise NotImplemened("NetflixCollection subclasses must set _items_name")
except KeyError:
self.items = []
else:
if not isinstance(items, (list, tuple)):
... | AttributeError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/NetflixCollection.__init__ |
4,768 | def __contains__(self, item):
if isinstance(item, self.item_type):
return item in self.items
elif isinstance(item, basestring):
return item in [i.netflix_id for i in self]
try:
return item.netflix_id in self
except __HOLE__:
pass
re... | AttributeError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/NetflixCollection.__contains__ |
4,769 | def object_hook(self, d):
d = dict((str(k), v) for k, v in d.iteritems())
def isa(label):
return label in d and len(d) == 1
if 'catalog_titles' in d:
try:
catalog_titles = d['catalog_titles']['catalog_title']
if not isinstance(catalog_tit... | KeyError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/Netflix.object_hook |
4,770 | def analyze_error(self, exc):
error = exc.data
try:
error = json.loads(error)
code = int(error['status']['status_code'])
message = error['status']['message']
except (KeyError, __HOLE__):
code = exc.status
message = error
if code... | ValueError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/Netflix.analyze_error |
4,771 | @call_interval(0.25)
def request(self, url, token=None, verb='GET', filename=None, **args):
"""`url` may be relative with regard to Netflix. Verb is a
HTTP verb.
"""
if isinstance(url, NetflixObject) and not isinstance(url, basestring):
url = url.id
if not url.st... | AttributeError | dataset/ETHPy150Open ryszard/python-netflix/netflix/__init__.py/Netflix.request |
4,772 | def loadAll():
"""Loads all DroneD Services that adhere to the Interface Definition
of IDroneDService. The resulting dictionary will return in the form
of {"SERVICENAME": "MODULE", ...}
:Note technically this is a private method, because the server will
hide it from you.
@return... | TypeError | dataset/ETHPy150Open OrbitzWorldwide/droned/droned/services/__init__.py/loadAll |
4,773 | def process(self, key):
if len(self.table1) < key:
raise IndexError('Invalid key for first table!')
try:
_key = self.table2[key]
print_success('Here is the control statement '
'you requested: `{}` => `{}`'.format(key, _key))
retur... | IndexError | dataset/ETHPy150Open christabor/MoAL/MOAL/data_structures/linear/array/control_table.py/ControlTableNaive.process |
4,774 | def __init__(self, name):
try:
super(EasyTestSuite, self).__init__(
findTestCases(sys.modules[name]))
except __HOLE__:
pass | KeyError | dataset/ETHPy150Open circus-tent/circus/circus/tests/support.py/EasyTestSuite.__init__ |
4,775 | def has_gevent():
try:
import gevent # NOQA
return True
except __HOLE__:
return False | ImportError | dataset/ETHPy150Open circus-tent/circus/circus/tests/support.py/has_gevent |
4,776 | def has_circusweb():
try:
import circusweb # NOQA
return True
except __HOLE__:
return False | ImportError | dataset/ETHPy150Open circus-tent/circus/circus/tests/support.py/has_circusweb |
4,777 | def poll_for_callable(func, *args, **kwargs):
"""Replay to update the status during timeout seconds."""
timeout = 5
if 'timeout' in kwargs:
timeout = kwargs.pop('timeout')
start = time()
last_exception = None
while time() - start < timeout:
try:
func_args = []
... | AssertionError | dataset/ETHPy150Open circus-tent/circus/circus/tests/support.py/poll_for_callable |
4,778 | def _convert_definition(self, definition, ref=None):
"""
Converts any object to its troposphere equivalent, if applicable.
This function will recurse into lists and mappings to create
additional objects as necessary.
"""
if isinstance(definition, Mapping):
if ... | TypeError | dataset/ETHPy150Open cloudtools/troposphere/troposphere/template_generator.py/TemplateGenerator._convert_definition |
4,779 | def _create_instance(self, cls, args, ref=None):
"""
Returns an instance of `cls` with `args` passed as arguments.
Recursively inspects `args` to create nested objects and functions as
necessary.
`cls` will only be considered only if it's an object we track
(i.e.: trop... | TypeError | dataset/ETHPy150Open cloudtools/troposphere/troposphere/template_generator.py/TemplateGenerator._create_instance |
4,780 | def query_from_object_id(self, object_id):
""" Obtaining a query from resource id.
Query can be then used to identify a resource in resources or meters
API calls. ID is being built in the Resource initializer, or returned
by Datatable into UpdateRow functionality.
"""
tr... | ValueError | dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/api/ceilometer.py/CeilometerUsage.query_from_object_id |
4,781 | def finder(finder_cls):
"""
View decorator that takes care of everything needed to render a finder on
the rendered page.
"""
def decorator(view_func):
finder = finder_cls()
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
if request.is_ajax() and r... | AttributeError | dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/finder |
4,782 | def goto_url(self, obj):
"""Given an object, return its "Goto" url, or None."""
try:
col = self.columns_by_model[obj.__class__]
except __HOLE__:
return None
return col.goto_url(obj) | KeyError | dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/Finder.goto_url |
4,783 | def child_column_for_obj(self, obj):
"""Given an object, return name of its child column, or None."""
try:
col = self.columns_by_model[obj.__class__]
return self.child_columns[col.name].name
except __HOLE__:
return None | KeyError | dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/Finder.child_column_for_obj |
4,784 | def objects(self, column_name, parent=None):
"""
Given a column name, return the list of objects.
If a parent is given and there is a parent column, filter the list by
that parent.
"""
col = self._get_column_by_name(column_name)
ret = col.objects()
if pa... | IndexError | dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/Finder.objects |
4,785 | def _get_column_by_name(self, column_name):
try:
return self.columns_by_name[column_name]
except __HOLE__:
raise ValueError("Column %r does not exist." % column_name) | KeyError | dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/Finder._get_column_by_name |
4,786 | def setUp(self):
"""Run before each test method to initialize test environment."""
super(TestCase, self).setUp()
self.context = ironic_context.get_admin_context()
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
try:
test_timeout = int(test_timeout)
except ... | ValueError | dataset/ETHPy150Open openstack/ironic/ironic/tests/base.py/TestCase.setUp |
4,787 | def register(model, feed_attr='feed'):
"""
Gives the model class a feed for each object.
"""
try:
from functools import wraps
except __HOLE__:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback
from django.db.models import signals as model_signal... | ImportError | dataset/ETHPy150Open caseywstark/colab/colab/apps/object_feeds/__init__.py/register |
4,788 | def get_ips(init_host, compute_host, ssh_user):
runner = remote_runner.RemoteRunner(host=compute_host, user=ssh_user,
gateway=init_host)
cmd = ("ifconfig | awk -F \"[: ]+\" \'/inet addr:/ "
"{ if ($4 != \"127.0.0.1\") print $4 }\'")
out = runner.run(cmd)
... | ValueError | dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/node_ip.py/get_ips |
4,789 | def __init__(self, body = None, cself = None):
if cself != None:
for header_name in [x + '_header' for x in self.all_headers]:
try:
setattr(self, header_name, getattr(cself, header_name).getCopy())
except __HOLE__:
pass
... | AttributeError | dataset/ETHPy150Open sippy/b2bua/sippy/SdpBody.py/SdpBody.__init__ |
4,790 | def write_file(content, filename, mode='wt', encoding=None):
"""
Write ``content`` to disk at ``filename``. Files with appropriate extensions
are compressed with gzip or bz2 automatically. Any intermediate folders
not found on disk are automatically created.
"""
_make_dirs(filename)
_open = ... | TypeError | dataset/ETHPy150Open chartbeat-labs/textacy/textacy/fileio/write.py/write_file |
4,791 | def write_file_lines(lines, filename, mode='wt', encoding=None):
"""
Write the content in ``lines`` to disk at ``filename``, line by line. Files
with appropriate extensions are compressed with gzip or bz2 automatically.
Any intermediate folders not found on disk are automatically created.
"""
_m... | TypeError | dataset/ETHPy150Open chartbeat-labs/textacy/textacy/fileio/write.py/write_file_lines |
4,792 | def wrap_tmpl_func(render_str):
def render_tmpl(tmplsrc,
from_str=False,
to_str=False,
context=None,
tmplpath=None,
**kws):
if context is None:
context = {}
# Alias cmd.run to cmd.shell... | OSError | dataset/ETHPy150Open saltstack/salt/salt/utils/templates.py/wrap_tmpl_func |
4,793 | def _get_jinja_error_slug(tb_data):
'''
Return the line number where the template error was found
'''
try:
return [
x
for x in tb_data if x[2] in ('top-level template code',
'template')
][-1]
except __HOLE__:
pa... | IndexError | dataset/ETHPy150Open saltstack/salt/salt/utils/templates.py/_get_jinja_error_slug |
4,794 | def _get_jinja_error_message(tb_data):
'''
Return an understandable message from jinja error output
'''
try:
line = _get_jinja_error_slug(tb_data)
return u'{0}({1}):\n{3}'.format(*line)
except __HOLE__:
pass
return None | IndexError | dataset/ETHPy150Open saltstack/salt/salt/utils/templates.py/_get_jinja_error_message |
4,795 | def _get_jinja_error_line(tb_data):
'''
Return the line number where the template error was found
'''
try:
return _get_jinja_error_slug(tb_data)[1]
except __HOLE__:
pass
return None | IndexError | dataset/ETHPy150Open saltstack/salt/salt/utils/templates.py/_get_jinja_error_line |
4,796 | def handle(self, *args, **options):
MindmapWebSocketRouter = SockJSRouter(handlers.MindmapWebSocketHandler, '/ws')
app_kwargs = {}
if settings.ENVIRONMENT.IS_FOR_DEVELOPMENT:
app_kwargs['debug'] = True
app = web.Application(MindmapWebSocketRouter.urls, **app_kwargs)
... | KeyboardInterrupt | dataset/ETHPy150Open ierror/BeautifulMind.io/beautifulmind/mindmaptornado/management/commands/mindmaptornado_run.py/Command.handle |
4,797 | def is_valid_in_template(var, attr):
"""
Given a variable and one of its attributes, determine if the attribute is
accessible inside of a Django template and return True or False accordingly
"""
# Remove private variables or methods
if attr.startswith('_'):
return False
# Remove any ... | TypeError | dataset/ETHPy150Open calebsmith/django-template-debug/template_debug/utils.py/is_valid_in_template |
4,798 | def _post_data(self, context, traceback=None):
"""POST data to the the Exceptional API. If DEBUG is True then data is
sent to ``EXCEPTIONAL_DEBUG_URL`` if it has been defined. If TESTING is
true, error data is stored in the global ``flask.g.exceptional``
variable.
:param context... | HTTPError | dataset/ETHPy150Open jzempel/flask-exceptional/flask_exceptional.py/Exceptional._post_data |
4,799 | def load_databag(filename):
try:
if filename.endswith('.json'):
with open(filename, 'r') as f:
return json.load(f, object_pairs_hook=OrderedDict)
elif filename.endswith('.ini'):
return decode_flat_data(IniFile(filename).items(),
... | IOError | dataset/ETHPy150Open lektor/lektor-archive/lektor/databags.py/load_databag |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.