Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
800
def __call__(self, query, view): for arg_name, filter_field in self._filter_fields.items(): try: arg_value = flask.request.args[arg_name] except __HOLE__: continue try: query = query.filter(filter_field(view, arg_value)) ...
KeyError
dataset/ETHPy150Open 4Catalyzer/flask-resty/flask_resty/filtering.py/Filtering.__call__
801
def itercomplement(ta, tb, strict): # coerce rows to tuples to ensure hashable and comparable ita = (tuple(row) for row in iter(ta)) itb = (tuple(row) for row in iter(tb)) ahdr = tuple(next(ita)) next(itb) # ignore b fields yield ahdr try: a = next(ita) except StopIteration: ...
StopIteration
dataset/ETHPy150Open alimanfoo/petl/petl/transform/setops.py/itercomplement
802
def iterintersection(a, b): ita = iter(a) itb = iter(b) ahdr = next(ita) next(itb) # ignore b header yield tuple(ahdr) try: a = tuple(next(ita)) b = tuple(next(itb)) while True: if Comparable(a) < Comparable(b): a = tuple(next(ita)) ...
StopIteration
dataset/ETHPy150Open alimanfoo/petl/petl/transform/setops.py/iterintersection
803
def main(options, args): logger = log.get_logger("example2", options=options) if options.toolkit is None: logger.error("Please choose a GUI toolkit with -t option") # decide our toolkit, then import ginga_toolkit.use(options.toolkit) viewer = FitsViewer(logger) viewer.top.resize(700...
KeyboardInterrupt
dataset/ETHPy150Open ejeschke/ginga/ginga/examples/gw/shared_canvas.py/main
804
def _to_node(self, host): try: password = \ host['operatingSystem']['passwords'][0]['password'] except (__HOLE__, KeyError): password = None hourlyRecurringFee = host.get('billingItem', {}).get( 'hourlyRecurringFee', 0) recurringFee = ...
IndexError
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/softlayer.py/SoftLayerNodeDriver._to_node
805
def _matches(self, item): try: iter(item) return True except __HOLE__: return False
TypeError
dataset/ETHPy150Open drslump/pyshould/pyshould/matchers.py/IsIterable._matches
806
def _matches(self, item): # support passing a context manager result if isinstance(item, ContextManagerResult): # Python <2.7 may provide a non exception value if isinstance(item.exc_value, Exception): self.thrown = item.exc_value elif item.exc_type is...
TypeError
dataset/ETHPy150Open drslump/pyshould/pyshould/matchers.py/RaisesError._matches
807
def _matches(self, item): # support passing arguments by feeding a tuple instead of a callable if not callable(item) and getattr(item, '__getitem__', False): func = item[0] params = item[1:] else: func = item params = [] try: b...
TypeError
dataset/ETHPy150Open drslump/pyshould/pyshould/matchers.py/Changes._matches
808
def _matches(self, item): self.error = None try: result = self.callback(item) # Returning an expectation assumes it's correct (no failure raised) from .expectation import Expectation return isinstance(result, Expectation) or bool(result) except __H...
AssertionError
dataset/ETHPy150Open drslump/pyshould/pyshould/matchers.py/Callback._matches
809
def _matches(self, sequence): self.order_seq = None try: seq = list(sequence) if self.matcher_all.matches(seq): self.order_seq = [i for i in seq if self.matcher_any.matches([i])] return self.matcher_order.matches(self.order_seq) else: ...
TypeError
dataset/ETHPy150Open drslump/pyshould/pyshould/matchers.py/IsSequenceContainingEveryInOrderSparse._matches
810
def module_exists(module_name): try: __import__(module_name) except __HOLE__: return False else: return True
ImportError
dataset/ETHPy150Open rzeka/QLDS-Manager/qldsmanager/manager.py/module_exists
811
def is_checked_out(context): try: return context['object'].is_checked_out() except __HOLE__: # Might not have permissions return False
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/checkouts/links.py/is_checked_out
812
def is_not_checked_out(context): try: return not context['object'].is_checked_out() except __HOLE__: # Might not have permissions return True
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/checkouts/links.py/is_not_checked_out
813
@functions.CallOnce def SetupLogger(): """Configure logging for OpenHTF.""" record_logger = logging.getLogger(RECORD_LOGGER) record_logger.propagate = False record_logger.setLevel(logging.DEBUG) record_logger.addHandler(logging.StreamHandler(stream=sys.stdout)) logger = logging.getLogger(LOGGER_PREFIX) l...
IOError
dataset/ETHPy150Open google/openhtf/openhtf/util/logs.py/SetupLogger
814
def pick(self): # <3> try: return self._items.pop() except __HOLE__: raise LookupError('pick from empty BingoCage') # <4>
IndexError
dataset/ETHPy150Open fluentpython/example-code/05-1class-func/bingocall.py/BingoCage.pick
815
def autocomplete(): """Command and option completion for the main option parser (and options) and its subcommands (and options). Enable by sourcing one of the completion shell scripts (bash or zsh). """ # Don't complete if user hasn't sourced bash_completion file. if 'PIP_AUTO_COMPLETE' not in ...
IndexError
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/__init__.py/autocomplete
816
def _open_usb_handle(**kwargs): """Open a UsbHandle subclass, based on configuration. If configuration 'remote_usb' is set, use it to connect to remote usb, otherwise attempt to connect locally.'remote_usb' is set to usb type, EtherSync or other. Example of Cambrionix unit in config: remote_usb: ethersync...
KeyError
dataset/ETHPy150Open google/openhtf/openhtf/plugs/usb/__init__.py/_open_usb_handle
817
def __getitem__(self, index): """Support slices.""" try: return deque.__getitem__(self, index) except __HOLE__: return type(self)(islice(self, index.start, index.stop, index.step))
TypeError
dataset/ETHPy150Open klen/graphite-beacon/graphite_beacon/alerts.py/sliceable_deque.__getitem__
818
def __call__(self, value): try: super(URLValidator, self).__call__(value) except __HOLE__ as e: # Trivial case failed. Try for possible IDN domain if value: value = force_text(value) scheme, netloc, path, query, fragment = urlsplit(valu...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/validators.py/URLValidator.__call__
819
def validate_integer(value): try: int(value) except (__HOLE__, TypeError): raise ValidationError('')
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/validators.py/validate_integer
820
def __call__(self, value): try: super(EmailValidator, self).__call__(value) except __HOLE__ as e: # Trivial case failed. Try for possible IDN domain-part if value and '@' in value: parts = value.split('@') try: parts...
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/validators.py/EmailValidator.__call__
821
def validate_ipv46_address(value): try: validate_ipv4_address(value) except __HOLE__: try: validate_ipv6_address(value) except ValidationError: raise ValidationError(_('Enter a valid IPv4 or IPv6 address.'), code='invalid')
ValidationError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/validators.py/validate_ipv46_address
822
def ip_address_validators(protocol, unpack_ipv4): """ Depending on the given parameters returns the appropriate validators for the GenericIPAddressField. This code is here, because it is exactly the same for the model and the form field. """ if protocol != 'both' and unpack_ipv4: raise ...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/core/validators.py/ip_address_validators
823
def _normalize_unicode(self, s): if not isinstance(s, unicode): temp = s # this is to help with debugging try: s = unicode(temp, self.fs_encoding) except __HOLE__: # Not all filesystems support encoding input that # we throw. W...
UnicodeDecodeError
dataset/ETHPy150Open memsql/memsql-loader/memsql_loader/vendor/glob2/impl.py/Globber._normalize_unicode
824
def _load_module(path): """Code to load create user module. Copied off django-browserid.""" i = path.rfind('.') module, attr = path[:i], path[i + 1:] try: mod = import_module(module) except ImportError: raise ImproperlyConfigured('Error importing CAN_LOGIN_AS' ...
ValueError
dataset/ETHPy150Open stochastic-technologies/django-loginas/loginas/views.py/_load_module
825
def SetRenderWindow(self,w): """ SetRenderWindow(w: vtkRenderWindow) Set a new render window to QVTKViewWidget and initialize the interactor as well """ if w == self.mRenWin: return if self.mRenWin: if self.mRenWin.GetMapp...
TypeError
dataset/ETHPy150Open VisTrails/VisTrails/contrib/titan/vtkviewcell.py/QVTKViewWidget.SetRenderWindow
826
def import_module(self, name): try: modname = 'kivy.modules.{0}'.format(name) module = __import__(name=modname) module = sys.modules[modname] except __HOLE__: try: module = __import__(name=name) module = sys.modules[name] ...
ImportError
dataset/ETHPy150Open kivy/kivy/kivy/modules/__init__.py/ModuleBase.import_module
827
def _configure_module(self, name): if 'module' not in self.mods[name]: try: self.import_module(name) except __HOLE__: return # convert configuration like: # -m mjpegserver:port=8080,fps=8 # and pass it in context.config token ...
ImportError
dataset/ETHPy150Open kivy/kivy/kivy/modules/__init__.py/ModuleBase._configure_module
828
def hashret(self): if self.nh == 58 and isinstance(self.payload, _ICMPv6): if self.payload.type < 128: return self.payload.payload.hashret() elif (self.payload.type in [133,134,135,136,144,145]): return struct.pack("B", self.nh)+self.payload.hashret() ...
IndexError
dataset/ETHPy150Open phaethon/scapy/scapy/layers/inet6.py/IPv6.hashret
829
def handle(self, request, data): try: rules = json.loads(data["rules"]) new_mapping = api.keystone.mapping_create( request, data["id"], rules=rules) messages.success(request, _("Mapping created succe...
TypeError
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/identity/mappings/forms.py/CreateMappingForm.handle
830
def handle(self, request, data): try: rules = json.loads(data["rules"]) api.keystone.mapping_update( request, data['id'], rules=rules) messages.success(request, _("Mapping updated successfully.")) ...
ValueError
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/identity/mappings/forms.py/UpdateMappingForm.handle
831
def __init__(self, to, on_delete=None, related_name=None, related_query_name=None, limit_choices_to=None, parent_link=False, to_field=None, db_constraint=True, **kwargs): try: to._meta.model_name except __HOLE__: assert isinstance(to, six.string_...
AttributeError
dataset/ETHPy150Open django/django/django/db/models/fields/related.py/ForeignKey.__init__
832
def __init__(self, to, related_name=None, related_query_name=None, limit_choices_to=None, symmetrical=None, through=None, through_fields=None, db_constraint=True, db_table=None, swappable=True, **kwargs): try: to._meta except __HOLE__: ...
AttributeError
dataset/ETHPy150Open django/django/django/db/models/fields/related.py/ManyToManyField.__init__
833
def in_debug(self, state): try: return state.protocol.properties.debug except __HOLE__: return False
AttributeError
dataset/ETHPy150Open Evgenus/protocyt/protocyt/classes.py/Compound.in_debug
834
def setCopyableState(self, state): self.__dict__.update(state) self._activationListeners = [] try: dataFile = file(self.getFileName(), "rb") data = dataFile.read() dataFile.close() except __HOLE__: recent = 0 else: newse...
IOError
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/spread/publish.py/RemotePublished.setCopyableState
835
def get_database(dialect): """ Returns requested database package with modules that provide additional functionality. :param string dialect: (required). Database dialect name. """ aliases = { ('mysql',): 'mysql', ('sqlite',): 'sqlite', ('pgsql', 'postgres', 'postgresql'): 'p...
ImportError
dataset/ETHPy150Open maxtepkeev/architect/architect/databases/utilities.py/get_database
836
def clean(self): super(FirstFieldRequiredFormSet, self).clean() count = 0 for form in self.forms: try: if form.cleaned_data and not form.cleaned_data.get('DELETE', False): count += 1 break except __HOLE__: ...
AttributeError
dataset/ETHPy150Open scieloorg/scielo-manager/scielomanager/journalmanager/forms.py/FirstFieldRequiredFormSet.clean
837
def main(config): # load ContextCreators from config file, run their input functions, and pass the result into the initialization function # init() all context creators specified by the user with their arguments # import them according to their fully-specified class names in the config file # it's up to...
KeyError
dataset/ETHPy150Open qe-team/marmot/examples/word_level_quality_estimation/wmt_word_level_experiment.py/main
838
def load_backend(backend_name): """ Return a database backend's "base" module given a fully qualified database backend name, or raise an error if it doesn't exist. """ # This backend was renamed in Django 1.9. if backend_name == 'django.db.backends.postgresql_psycopg2': backend_name = 'd...
ImportError
dataset/ETHPy150Open django/django/django/db/utils.py/load_backend
839
def ensure_defaults(self, alias): """ Puts the defaults into the settings dictionary for a given connection where no settings is provided. """ try: conn = self.databases[alias] except __HOLE__: raise ConnectionDoesNotExist("The connection %s doesn'...
KeyError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionHandler.ensure_defaults
840
def prepare_test_settings(self, alias): """ Makes sure the test settings are available in the 'TEST' sub-dictionary. """ try: conn = self.databases[alias] except __HOLE__: raise ConnectionDoesNotExist("The connection %s doesn't exist" % alias) tes...
KeyError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionHandler.prepare_test_settings
841
def close_all(self): for alias in self: try: connection = getattr(self._connections, alias) except __HOLE__: continue connection.close()
AttributeError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionHandler.close_all
842
def _router_func(action): def _route_db(self, model, **hints): chosen_db = None for router in self.routers: try: method = getattr(router, action) except __HOLE__: # If the router doesn't have a method, skip to the ne...
AttributeError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionRouter._router_func
843
def allow_relation(self, obj1, obj2, **hints): for router in self.routers: try: method = router.allow_relation except __HOLE__: # If the router doesn't have a method, skip to the next one. pass else: allow = meth...
AttributeError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionRouter.allow_relation
844
def allow_migrate(self, db, app_label, **hints): for router in self.routers: try: method = router.allow_migrate except __HOLE__: # If the router doesn't have a method, skip to the next one. continue allow = method(db, app_label...
AttributeError
dataset/ETHPy150Open django/django/django/db/utils.py/ConnectionRouter.allow_migrate
845
def diff(self, revisions, include_files=[], exclude_patterns=[], extra_args=[]): """ Performs a diff across all modified files in a Plastic workspace Parent diffs are not supported (the second value in the tuple). """ # TODO: use 'files' changenum = None ...
ValueError
dataset/ETHPy150Open reviewboard/rbtools/rbtools/clients/plastic.py/PlasticClient.diff
846
def __init__(self, reactor, proc, name, fileno, forceReadHack=False): """ Initialize, specifying a Process instance to connect to. """ abstract.FileDescriptor.__init__(self, reactor) fdesc.setNonBlocking(fileno) self.proc = proc self.name = name self.fd = ...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/process.py/ProcessWriter.__init__
847
def reapProcess(self): """ Try to reap a process (without blocking) via waitpid. This is called when sigchild is caught or a Process object loses its "connection" (stdout is closed) This ought to result in reaping all zombie processes, since it will be called twice as often as i...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/process.py/_BaseProcess.reapProcess
848
def signalProcess(self, signalID): """ Send the given signal C{signalID} to the process. It'll translate a few signals ('HUP', 'STOP', 'INT', 'KILL', 'TERM') from a string representation to its int value, otherwise it'll pass directly the value provided @type signalID: C...
OSError
dataset/ETHPy150Open twisted/twisted/twisted/internet/process.py/_BaseProcess.signalProcess
849
def _fallbackFDImplementation(self): """ Fallback implementation where either the resource module can inform us about the upper bound of how many FDs to expect, or where we just guess a constant maximum if there is no resource module. All possible file descriptors from 0 to that...
ImportError
dataset/ETHPy150Open twisted/twisted/twisted/internet/process.py/_FDDetector._fallbackFDImplementation
850
def blitz(expr,local_dict=None, global_dict=None,check_size=1,verbose=0,**kw): # this could call inline, but making a copy of the # code here is more efficient for several reasons. global function_catalog # this grabs the local variables from the *previous* call # frame -- that is the locals from t...
ValueError
dataset/ETHPy150Open scipy/scipy/scipy/weave/blitz_tools.py/blitz
851
def get_absolute_url(self): """ Return the URL of the parent object, if it has one. This method mainly exists to support cache mechanisms (e.g. refreshing a Varnish cache), and assist in debugging. """ if not self.parent_id or not self.parent_type_id: return None ...
AttributeError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/models/db.py/Placeholder.get_absolute_url
852
def get_absolute_url(self): """ Return the URL of the parent object, if it has one. This method mainly exists to refreshing cache mechanisms. """ # Allows quick debugging, and cache refreshes. parent = self.parent try: return parent.get_absolute_url() ...
AttributeError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/models/db.py/ContentItem.get_absolute_url
853
def move_to_placeholder(self, placeholder, sort_order=None): """ .. versionadded: 1.0.2 Move this content item to a new placeholder. The object is saved afterwards. """ # Transfer parent self.placeholder = placeholder self.parent_type = placeholder.parent_type ...
AttributeError
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/models/db.py/ContentItem.move_to_placeholder
854
def error(self, obj, name, value): """Returns a descriptive error string.""" # pylint: disable=E1101 right = left = '=' if self.exclude_high is True: right = '' if self.exclude_low is True: left = '' if self.low is None and self.high is None: ...
AttributeError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/datatypes/int.py/Int.error
855
def read(self): # TODO: check the lengths? try: key_length = self.read_int() except struct.error: return None try: key = self._read() assert self.file.read(1) == b'\t' val_length = self.read_int() val = self._read()...
StopIteration
dataset/ETHPy150Open dougalsutherland/py-sdm/sdm/typedbytes_utils.py/TypedbytesSequenceFileStreamingInput.read
856
def _file_is_seekable(f): try: f.tell() except __HOLE__ as e: if e.errno == errno.ESPIPE and e.strerror == 'Illegal seek': return False raise except AttributeError: return False else: return True
IOError
dataset/ETHPy150Open dougalsutherland/py-sdm/sdm/typedbytes_utils.py/_file_is_seekable
857
def database_dex_analyze_view(self, request, database_id): import json import random from dbaas_laas.provider import LaaSProvider from util import get_credentials_for from util.laas import get_group_name from dbaas_credentials.models import CredentialType import o...
KeyError
dataset/ETHPy150Open globocom/database-as-a-service/dbaas/logical/admin/database.py/DatabaseAdmin.database_dex_analyze_view
858
def __init__(self, host=None, port=None, **kwargs): """Initialize a connection to the network socket. Kwargs: host - optionally override the default network host (default is local machine) port - optionally override the default network port (default is 50001) log_mod...
OSError
dataset/ETHPy150Open openxc/openxc-python/openxc/sources/network.py/NetworkDataSource.__init__
859
def test_get_flattened_index(self): self.assertEqual(slice(4,5,None), get_flattened_index(4, (10,))) self.assertEqual(slice(9,10,None), get_flattened_index(-1, (10,))) self.assertEqual(slice(90,100,1), get_flattened_index(-1, (10,10))) try: self.assertEqual(0, get_flattened_i...
IndexError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_array_helpers.py/TestcaseArrayHelpers.test_get_flattened_index
860
def tree_entries_from_data(data): """Reads the binary representation of a tree and returns tuples of Tree items :param data: data block with tree data (as bytes) :return: list(tuple(binsha, mode, tree_relative_path), ...)""" ord_zero = ord('0') space_ord = ord(' ') len_data = len(data) i = 0...
UnicodeDecodeError
dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/fun.py/tree_entries_from_data
861
def _find_by_name(tree_data, name, is_dir, start_at): """return data entry matching the given name and tree mode or None. Before the item is returned, the respective data item is set None in the tree_data list to mark it done""" try: item = tree_data[start_at] if item and item[2] == ...
IndexError
dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/fun.py/_find_by_name
862
def spawn(df, d, limit): enum = df.get_enum() rnd = random(enum) rndmask = (rnd<limit).nonzero()[0] for e in rndmask: l = df.get_edge_length(e) if l<d: continue try: df.split_edge(e) except __HOLE__: pass
ValueError
dataset/ETHPy150Open inconvergent/differential-line/modules/growth.py/spawn
863
def spawn_curl(df, limit, prob_spawn=1.0): enum = df.get_enum() ind_curv = {} tot_curv = 0 max_curv = -100000 for e in xrange(enum): try: t = df.get_edge_curvature(e) ind_curv[e] = t tot_curv += t max_curv = max(max_curv, t) except ValueError: pass ne = len(ind_curv)...
ValueError
dataset/ETHPy150Open inconvergent/differential-line/modules/growth.py/spawn_curl
864
def spawn_short(df, short, long): enum = df.get_enum() for e in xrange(enum): l = df.get_edge_length(e) if l>long: try: df.split_edge(e, minimum_length=short) except __HOLE__: pass
ValueError
dataset/ETHPy150Open inconvergent/differential-line/modules/growth.py/spawn_short
865
def collapse(df, d, limit): enum = df.get_enum() rnd = random(enum) rndmask = (rnd<limit).nonzero()[0] for e in rndmask: l = df.get_edge_length(e) if l<d: try: df.collapse_edge(e) except __HOLE__: pass
ValueError
dataset/ETHPy150Open inconvergent/differential-line/modules/growth.py/collapse
866
@register.filter def blockers(user): """Returns list of people blocking user.""" try: return Relationship.objects.get_blockers_for_user(user) except __HOLE__: return []
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/blockers
867
@register.filter def friends(user): """Returns people user is following sans people blocking user.""" try: return Relationship.objects.get_friends_for_user(user) except __HOLE__: return []
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/friends
868
@register.filter def followers(user): """Returns people following user.""" try: return Relationship.objects.get_followers_for_user(user) except __HOLE__: pass
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/followers
869
@register.filter def fans(user): """Returns people following user but user isn't following.""" try: return Relationship.objects.get_fans_for_user(user) except __HOLE__: pass # Comparing two users.
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/fans
870
@register.filter def follows(from_user, to_user): """Returns ``True`` if the first user follows the second, ``False`` otherwise. Example: {% if user|follows:person %}{% endif %}""" try: relationship = Relationship.objects.get_relationship(from_user, to_user) if relationship and not relationship...
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/follows
871
@register.filter def get_relationship(from_user, to_user): """Get relationship between two users.""" try: return Relationship.objects.get_relationship(from_user, to_user) except __HOLE__: return None # get_relationship templatetag.
AttributeError
dataset/ETHPy150Open nathanborror/django-basic-apps/basic/relationships/templatetags/relationships.py/get_relationship
872
def encode_7bit(self, encoder=None): """.. versionadded:: 0.3.12 Forces the message into 7-bit encoding such that it can be sent to SMTP servers that do not support the ``8BITMIME`` extension. If the ``encoder`` function is not given, this function is relatively cheap and will ...
UnicodeDecodeError
dataset/ETHPy150Open slimta/python-slimta/slimta/envelope.py/Envelope.encode_7bit
873
def _childParser_mucUser(self, element): """ Parse the MUC user extension element. """ for child in element.elements(): if child.uri != NS_MUC_USER: continue elif child.name == 'status': try: value = int(child.g...
TypeError
dataset/ETHPy150Open ralphm/wokkel/wokkel/muc.py/UserPresence._childParser_mucUser
874
def remove(self, name): """ Remove a column of data. Args: name (str) : name of the column to remove Returns: None .. note:: If the column name does not exist, a warning is issued. """ try: self.column_names.remove(name)...
ValueError
dataset/ETHPy150Open bokeh/bokeh/bokeh/models/sources.py/ColumnDataSource.remove
875
def __init__(self, server, pid): self._pid = pid self.server = IDroneModelServer(server) self._created = time.time() #don't set self._process try: try: #re-constructing, can cause problems with this if IKittNullProcess.providedBy(self.process.process):...
AttributeError
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/models/app.py/AppProcess.__init__
876
def __init__(self, server, app, label): try: if not IDroneModelServer.providedBy(server): e = '%s is not a L{IDroneModelServer} provider' % str(server) raise AssertionError(e) if not IDroneModelApp.providedBy(app): e = '%s is not a L{IDrone...
AssertionError
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/models/app.py/AppInstance.__init__
877
@classmethod def setupClass(cls): global pydot try: import pydot import dot_parser except __HOLE__: raise SkipTest('pydot not available.')
ImportError
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/drawing/tests/test_pydot.py/TestPydot.setupClass
878
def _check_aug_version(self): """ Checks that we have recent enough version of libaugeas. If augeas version is recent enough, it will support case insensitive regexp matching""" self.aug.set("/test/path/testing/arg", "aRgUMeNT") try: matches = self.aug.match( ...
RuntimeError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot-apache/certbot_apache/configurator.py/ApacheConfigurator._check_aug_version
879
def _copy_create_ssl_vhost_skeleton(self, avail_fp, ssl_fp): """Copies over existing Vhost with IfModule mod_ssl.c> skeleton. :param str avail_fp: Pointer to the original available non-ssl vhost :param str ssl_fp: Full path where the new ssl_vhost will reside. A new file is created on ...
IOError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot-apache/certbot_apache/configurator.py/ApacheConfigurator._copy_create_ssl_vhost_skeleton
880
def enhance(self, domain, enhancement, options=None): """Enhance configuration. :param str domain: domain to enhance :param str enhancement: enhancement type defined in :const:`~certbot.constants.ENHANCEMENTS` :param options: options for the enhancement See :cons...
KeyError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot-apache/certbot_apache/configurator.py/ApacheConfigurator.enhance
881
def is_site_enabled(self, avail_fp): """Checks to see if the given site is enabled. .. todo:: fix hardcoded sites-enabled, check os.path.samefile :param str avail_fp: Complete file path of available site :returns: Success :rtype: bool """ enabled_dir = os.pat...
OSError
dataset/ETHPy150Open letsencrypt/letsencrypt/certbot-apache/certbot_apache/configurator.py/ApacheConfigurator.is_site_enabled
882
@classmethod def register_self(cls, **kwargs): registry = get_module_registry() def resolve_type(t): if type(t) == tuple: return registry.get_descriptor_by_name(*t).module elif type(t) == type: return t else: assert ...
AttributeError
dataset/ETHPy150Open VisTrails/VisTrails/contrib/vtksnl/inspectors.py/vtkBaseInspector.register_self
883
def compute(self): vtk_object = None if self.has_input("SetInputConnection0"): ic = self.get_input("SetInputConnection0") port_object = ic.vtkInstance ix = port_object.GetIndex() producer = port_object.GetProducer() try: vtk_obj...
AttributeError
dataset/ETHPy150Open VisTrails/VisTrails/contrib/vtksnl/inspectors.py/vtkDataSetInspector.compute
884
def compute(self): vtk_object = None if self.has_input("SetInputConnection0"): ic = self.get_input("SetInputConnection0") port_object = ic.vtkInstance ix = port_object.GetIndex() producer = port_object.GetProducer() try: vtk_obj...
AttributeError
dataset/ETHPy150Open VisTrails/VisTrails/contrib/vtksnl/inspectors.py/vtkPolyDataInspector.compute
885
@treeio_login_required def settings_view(request, response_format='html'): "Settings view" user = request.user.profile # default permissions try: conf = ModuleSetting.get_for_module( 'treeio.core', 'default_permissions', user=user)[0] default_permissions = conf.value exc...
IndexError
dataset/ETHPy150Open treeio/treeio/treeio/account/views.py/settings_view
886
def if_file_get_content(value): """ if value is the path to a local file, read the content and return it otherwise just return value """ file_path = path.abspath(value) if path.isfile(file_path): try: f = open(file_path, 'rU') except __HOLE__: pass...
IOError
dataset/ETHPy150Open cloudControl/cctrl/cctrl/addonoptionhelpers.py/if_file_get_content
887
def main(): """! This function drives command line tool 'mbedhtrun' which is using DefaultTestSelector @details 1. Create DefaultTestSelector object and pass command line parameters 2. Call default test execution function run() to start test instrumentation """ freeze_support() result =...
KeyboardInterrupt
dataset/ETHPy150Open ARMmbed/htrun/mbed_host_tests/mbedhtrun.py/main
888
def post(self): # Extract useful information from POST request and store it as a dictionary data structure self.message = dict(self.request.arguments) # Extract value of url, action and state request parameters from request body # Request parameters values by default is [] self.u...
IOError
dataset/ETHPy150Open owtf/owtf/framework/interface/api_handlers.py/PlugnhackHandler.post
889
def clean(self): cleaned_data = super(AbstractSinglePreferenceForm, self).clean() try: self.instance.name, self.instance.section = cleaned_data['name'], cleaned_data['section'] except __HOLE__: # changelist form pass try: self.instance.preference ...
KeyError
dataset/ETHPy150Open EliotBerriot/django-dynamic-preferences/dynamic_preferences/forms.py/AbstractSinglePreferenceForm.clean
890
def clean(self): cleaned_data = super(AbstractSinglePreferenceForm, self).clean() try: self.instance.name, self.instance.section = cleaned_data['name'], cleaned_data['section'] except __HOLE__: # changelist form pass i = cleaned_data.get('instance') if i: ...
KeyError
dataset/ETHPy150Open EliotBerriot/django-dynamic-preferences/dynamic_preferences/forms.py/SinglePerInstancePreferenceForm.clean
891
def _pshell(cmd, cwd=None): ''' Execute the desired powershell command and ensure that it returns data in json format and load that into python ''' if 'convertto-json' not in cmd.lower(): cmd = ' '.join([cmd, '| ConvertTo-Json']) log.debug('PSGET: {0}'.format(cmd)) ret = __salt__['cm...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/modules/win_psget.py/_pshell
892
def getKeyPassphrase(self, keyId, prompt, errorMessage = None): if errorMessage: print errorMessage keyDesc = "conary:pgp:%s" % keyId try: import keyutils # We only initialize keyring if keyutils is not None keyring = keyutils.KEY_SPEC_SESSION_KEYR...
ImportError
dataset/ETHPy150Open sassoftware/conary/conary/callbacks.py/KeyCacheCallback.getKeyPassphrase
893
def __getattr__(self, k): try: return getattr(settings, k) except __HOLE__: if k in self.defaults: return self.defaults[k] raise ImproperlyConfigured("django-secure requires %s setting." % k)
AttributeError
dataset/ETHPy150Open carljm/django-secure/djangosecure/conf.py/Configuration.__getattr__
894
def read_long_description(readme_file): """ Read package long description from README file """ try: import pypandoc except (__HOLE__, OSError) as e: print('No pypandoc or pandoc: %s' % (e,)) if is_py3: fh = open(readme_file, encoding='utf-8') else: fh ...
ImportError
dataset/ETHPy150Open walkr/oi/setup.py/read_long_description
895
def test_double_start(handler, framework): try: txaio.start_logging() except __HOLE__: assert False, "shouldn't get exception"
RuntimeError
dataset/ETHPy150Open crossbario/txaio/test/test_logging.py/test_double_start
896
def test_invalid_level(framework): try: txaio.start_logging(level='foo') assert False, "should get exception" except __HOLE__ as e: assert 'Invalid log level' in str(e)
RuntimeError
dataset/ETHPy150Open crossbario/txaio/test/test_logging.py/test_invalid_level
897
def generate(env): """Add Builders and construction variables for Ghostscript to an Environment.""" global GhostscriptAction # The following try-except block enables us to use the Tool # in standalone mode (without the accompanying pdf.py), # whenever we need an explicit call of gs via the Gs() ...
ImportError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/gs.py/generate
898
def handle(self, **options): connection = connections[options['database']] try: connection.client.runshell() except __HOLE__: # Note that we're assuming OSError means that the client program # isn't installed. There's a possibility OSError would be raised ...
OSError
dataset/ETHPy150Open django/django/django/core/management/commands/dbshell.py/Command.handle
899
def getTestCaseNames(self, testCaseClass): """Override to select with selector, unless config.getTestCaseNamesCompat is True """ if self.config.getTestCaseNamesCompat: return unittest.TestLoader.getTestCaseNames(self, testCaseClass) def wanted(attr, cls=testCaseClass, sel=self.selector): ...
TypeError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/testing/nosepatch.py/getTestCaseNames