Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
4,900
def set_body_reader(self): chunked = False content_length = None for (name, value) in self.headers: if name == "CONTENT-LENGTH": content_length = value elif name == "TRANSFER-ENCODING": chunked = value.lower() == "chunked" elif ...
ValueError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/gunicorn/http/message.py/Message.set_body_reader
4,901
def parse_proxy_protocol(self, line): bits = line.split() if len(bits) != 6: raise InvalidProxyLine(line) # Extract data proto = bits[1] s_addr = bits[2] d_addr = bits[3] # Validation if proto not in ["TCP4", "TCP6"]: raise Inval...
ValueError
dataset/ETHPy150Open chalasr/Flask-P2P/venv/lib/python2.7/site-packages/gunicorn/http/message.py/Request.parse_proxy_protocol
4,902
def form_invalid(self, form): result = super(SingleObjectCreateView, self).form_invalid(form) try: messages.error( self.request, _('Error creating new %s.') % self.extra_context['object_name'] ) except __HOLE__: messages.error(...
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectCreateView.form_invalid
4,903
def form_valid(self, form): # This overrides the original Django form_valid method self.object = form.save(commit=False) if hasattr(self, 'get_instance_extra_data'): for key, value in self.get_instance_extra_data().items(): setattr(self.object, key, value) ...
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectCreateView.form_valid
4,904
def delete(self, request, *args, **kwargs): try: result = super(SingleObjectDeleteView, self).delete(request, *args, **kwargs) except Exception as exception: try: messages.error( self.request, _('Error deleting %s.') % self....
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectDeleteView.delete
4,905
def form_invalid(self, form): result = super(SingleObjectEditView, self).form_invalid(form) try: messages.error( self.request, _( 'Error saving %s details.' ) % self.extra_context['object_name'] ) except...
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectEditView.form_invalid
4,906
def form_valid(self, form): # This overrides the original Django form_valid method self.object = form.save(commit=False) if hasattr(self, 'get_instance_extra_data'): for key, value in self.get_instance_extra_data().items(): setattr(self.object, key, value) ...
KeyError
dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/common/generics.py/SingleObjectEditView.form_valid
4,907
def _kurtosis(a): '''wrapper for scipy.stats.kurtosis that returns nan instead of raising Error missing options ''' try: res = stats.kurtosis(a) except __HOLE__: res = np.nan return res
ValueError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/descriptivestats.py/_kurtosis
4,908
def _skew(a): '''wrapper for scipy.stats.skew that returns nan instead of raising Error missing options ''' try: res = stats.skew(a) except __HOLE__: res = np.nan return res
ValueError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/descriptivestats.py/_skew
4,909
def _is_dtype_like(self, col): """ Check whether self.dataset.[col][0] behaves like a string, numbern unknown. `numpy.lib._iotools._is_string_like` """ def string_like(): #TODO: not sure what the result is if the first item is some type of # missing value ...
ValueError
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/descriptivestats.py/Describe._is_dtype_like
4,910
def tuple_values_dict(currtuple, newtuple=None): """Return dictionary of attributes with their values :param currtuple: current Tuple :param newtuple: optional Tuple with new values :return: dictionary of attributes and values """ valdict = {} for attr in currtuple.__dict__: if attr...
TypeError
dataset/ETHPy150Open perseas/Pyrseas/pyrseas/relation/tuple.py/tuple_values_dict
4,911
def runtests(): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) # Compatibility with Django 1.7's stricter initialization if hasattr(django, 'setup'): django.setup() print(sys.path) try: from django.test.runner import DiscoverRunner runner_class ...
ImportError
dataset/ETHPy150Open carljm/django-secure/runtests.py/runtests
4,912
def clean(self): self.tfile.close() try: os.unlink(self.get_full_path()) except __HOLE__: pass
OSError
dataset/ETHPy150Open tooxie/shiva-server/shiva/resources/upload.py/UploadHandler.clean
4,913
def get_path(self): path = '' upload_path = app.config.get('UPLOAD_PATH') if not upload_path: raise NoUploadPathConfigError() _artist = app.config.get('UPLOAD_DEFAULT_ARTIST', '') _album = app.config.get('UPLOAD_DEFAULT_ALBUM', '') artist = slugify(self.mdm...
OSError
dataset/ETHPy150Open tooxie/shiva-server/shiva/resources/upload.py/UploadHandler.get_path
4,914
def parseExtensionArgs(self, args): """Set the state of this request to be that expressed in these PAPE arguments @param args: The PAPE arguments without a namespace @rtype: None @raises ValueError: When the max_auth_age is not parseable as an integer """ ...
ValueError
dataset/ETHPy150Open CollabQ/CollabQ/openid/extensions/pape.py/Request.parseExtensionArgs
4,915
def parseExtensionArgs(self, args, strict=False): """Parse the provider authentication policy arguments into the internal state of this object @param args: unqualified provider authentication policy arguments @param strict: Whether to raise an exception when bad data is ...
ValueError
dataset/ETHPy150Open CollabQ/CollabQ/openid/extensions/pape.py/Response.parseExtensionArgs
4,916
def execute(self, *args, **options): if len(args) != 1: raise CommandError("You must provide a file to import!") self.site = options["site"] if not isinstance(self.site, Site): try: self.site = Site.objects.get(domain=options["site"]) except _...
ObjectDoesNotExist
dataset/ETHPy150Open okfn/foundation/foundation/redirector/management/commands/import_redirect_csv.py/Command.execute
4,917
@access.public def getImageFeatures(self, params): try: import cv2 import numpy as np cv2_available = True except __HOLE__: cv2_available = False # Disabling opencv for now cv2_available = False if 'url' in params: ...
ImportError
dataset/ETHPy150Open memex-explorer/image_space/imagespace/server/imagefeatures_rest.py/ImageFeatures.getImageFeatures
4,918
def get_geo_from_ip(ip_addr): try: from geoip import geolite2 return geolite2.lookup(ip_addr) except __HOLE__: return except ValueError: return
ImportError
dataset/ETHPy150Open frappe/frappe/frappe/sessions.py/get_geo_from_ip
4,919
def supported(cls, stream=sys.stdout): """ A class method that returns True if the current platform supports coloring terminal output using this method. Returns False otherwise. """ if not stream.isatty(): return False # auto color only on TTYs try: ...
ImportError
dataset/ETHPy150Open twisted/twisted/twisted/trial/reporter.py/_AnsiColorizer.supported
4,920
def supported(cls, stream=sys.stdout): try: import win32console screenBuffer = win32console.GetStdHandle( win32console.STD_OUTPUT_HANDLE) except __HOLE__: return False import pywintypes try: screenBuffer.SetConsoleTextAttrib...
ImportError
dataset/ETHPy150Open twisted/twisted/twisted/trial/reporter.py/_Win32Colorizer.supported
4,921
@pytest.mark.hookwrapper def pytest_runtest_makereport(item, call): outcome = yield # Only run through this at the end of the test if call.when != 'call': return # Don't continue if this isn't a screenshot test if 'screenshot' not in item.fixturenames: return # Don't add scree...
AssertionError
dataset/ETHPy150Open bokeh/bokeh/tests/integration/integration_tests_plugin.py/pytest_runtest_makereport
4,922
def class_for_kind(kind): """Return base-class responsible for implementing kind. Necessary to recover the class responsible for implementing provided kind. Args: kind: Entity kind string. Returns: Class implementation for kind. Raises: KindError when there is no implementation for kind. "...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/class_for_kind
4,923
def __get__(self, model_instance, model_class): """Returns the value for this property on the given model instance. See http://docs.python.org/ref/descriptors.html for a description of the arguments to this class and what they mean.""" if model_instance is None: return self try: ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/Property.__get__
4,924
def _populate_internal_entity(self, _entity_class=datastore.Entity): """Populates self._entity, saving its state to the datastore. After this method is called, calling is_saved() will return True. Returns: Populated self._entity """ self._entity = self._populate_entity(_entity_class=_entity_...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/Model._populate_internal_entity
4,925
@classmethod def _load_entity_values(cls, entity): """Load dynamic properties from entity. Loads attributes which are not defined as part of the entity in to the model instance. Args: entity: Entity which contain values to search dyanmic properties for. """ entity_values = {} for p...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/Model._load_entity_values
4,926
def delete_async(models, **kwargs): """Asynchronous version of delete one or more Model instances. Identical to db.delete() except returns an asynchronous object. Call get_result() on the return value to block on the call. """ if isinstance(models, (basestring, Model, Key)): models = [models] else: ...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/delete_async
4,927
def get(self, **kwargs): """Get first result from this. Beware: get() ignores the LIMIT clause on GQL queries. Args: kwargs: Any keyword arguments accepted by datastore_query.QueryOptions(). Returns: First result from running the query if there are any, else None. """ results = se...
StopIteration
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/_BaseQuery.get
4,928
def validate(self, value): """Validate property. Returns: A valid value. Raises: BadValueError if property is not an instance of data_type. """ if value is not None and not isinstance(value, self.data_type): try: value = self.data_type(value) except __HOLE__, err: ...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/UnindexedProperty.validate
4,929
def validate(self, value): """Validate ByteString property. Returns: A valid value. Raises: BadValueError if property is not instance of 'ByteString'. """ if value is not None and not isinstance(value, ByteString): try: value = ByteString(value) except __HOLE__, err...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/ByteStringProperty.validate
4,930
def load_class(path): """ Load class from path. """ try: mod_name, klass_name = path.rsplit('.', 1) mod = import_module(mod_name) except AttributeError as e: raise ImproperlyConfigured('Error importing {0}: "{1}"'.format(mod_name, e)) try: klass = getattr(mod, k...
AttributeError
dataset/ETHPy150Open niwinz/django-jinja/django_jinja/utils.py/load_class
4,931
def load_bytecode(self, f): """Loads bytecode from a file or file like object.""" # make sure the magic header is correct magic = f.read(len(bc_magic)) if magic != bc_magic: self.reset() return # the source code of the file changed, we need to reload ...
ValueError
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/jinja2/bccache.py/Bucket.load_bytecode
4,932
def _get_default_cache_dir(self): def _unsafe_dir(): raise RuntimeError('Cannot determine safe temp directory. You ' 'need to explicitly provide one.') tmpdir = tempfile.gettempdir() # On windows the temporary directory is used specific unless ...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/jinja2/bccache.py/FileSystemBytecodeCache._get_default_cache_dir
4,933
def clear(self): # imported lazily here because google app-engine doesn't support # write access on the file system and the function does not exist # normally. from os import remove files = fnmatch.filter(listdir(self.directory), self.pattern % '*') for filename in files:...
OSError
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/jinja2/bccache.py/FileSystemBytecodeCache.clear
4,934
def check_ils_booking(gadget_url_base): """ Checks the session and returns when the lab is free (in UTC). If None is returned, it means that there is no ongoing session so they can use the lab. """ ils_student_id = extract_ils_id(request.args.get('ils_student_url')) ils_teacher_id = extract_ils_id(r...
ValueError
dataset/ETHPy150Open gateway4labs/labmanager/labmanager/views/opensocial.py/check_ils_booking
4,935
def test_config_from_envvar(self): env = os.environ try: os.environ = {} app = flask.Flask(__name__) try: app.config.from_envvar('FOO_SETTINGS') except __HOLE__, e: self.assert_("'FOO_SETTINGS' is not set" in str(e)) ...
RuntimeError
dataset/ETHPy150Open baseblack/ReproWeb/3rdParty/python/flask/testsuite/config.py/ConfigTestCase.test_config_from_envvar
4,936
def test_config_from_envvar_missing(self): env = os.environ try: os.environ = {'FOO_SETTINGS': 'missing.cfg'} try: app = flask.Flask(__name__) app.config.from_envvar('FOO_SETTINGS') except __HOLE__, e: msg = str(e) ...
IOError
dataset/ETHPy150Open baseblack/ReproWeb/3rdParty/python/flask/testsuite/config.py/ConfigTestCase.test_config_from_envvar_missing
4,937
def test_config_missing(self): app = flask.Flask(__name__) try: app.config.from_pyfile('missing.cfg') except __HOLE__, e: msg = str(e) self.assert_(msg.startswith('[Errno 2] Unable to load configuration ' 'file (No such ...
IOError
dataset/ETHPy150Open baseblack/ReproWeb/3rdParty/python/flask/testsuite/config.py/ConfigTestCase.test_config_missing
4,938
def test_explicit_instance_paths(self): here = os.path.abspath(os.path.dirname(__file__)) try: flask.Flask(__name__, instance_path='instance') except __HOLE__, e: self.assert_('must be absolute' in str(e)) else: self.fail('Expected value error') ...
ValueError
dataset/ETHPy150Open baseblack/ReproWeb/3rdParty/python/flask/testsuite/config.py/InstanceTestCase.test_explicit_instance_paths
4,939
def _get_impl(): """Delay import of rpc_backend until configuration is loaded.""" global _RPCIMPL if _RPCIMPL is None: try: _RPCIMPL = importutils.import_module(CONF.rpc_backend) except __HOLE__: # For backwards compatibility with older nova config. impl =...
ImportError
dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/openstack/common/rpc/__init__.py/_get_impl
4,940
@classmethod def __get_pp_ip(cls, addr_family, ip_string, which): try: packed = socket.inet_pton(addr_family, ip_string.decode('ascii')) return socket.inet_ntop(addr_family, packed) except (__HOLE__, socket.error): msg = 'Invalid proxy protocol {0} IP format'.form...
UnicodeDecodeError
dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocolV1.__get_pp_ip
4,941
@classmethod def __get_pp_port(cls, port_string, which): try: port_num = int(port_string) except __HOLE__: msg = 'Invalid proxy protocol {0} port format'.format(which) raise AssertionError(msg) assert port_num >= 0 and port_num <= 65535, \ 'Pro...
ValueError
dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocolV1.__get_pp_port
4,942
def handle(self, sock, addr): """Intercepts calls to :meth:`~slimta.edge.EdgeServer.handle`, reads the proxy protocol header, and then resumes the original call. """ try: src_addr, _ = self.process_pp_v1(sock, b'') except __HOLE__ as exc: log.proxyproto_i...
AssertionError
dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocolV1.handle
4,943
def handle(self, sock, addr): """Intercepts calls to :meth:`~slimta.edge.EdgeServer.handle`, reads the proxy protocol header, and then resumes the original call. """ try: src_addr, _ = self.process_pp_v2(sock, b'') except LocalConnection: log.proxyproto_l...
AssertionError
dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocolV2.handle
4,944
def handle(self, sock, addr): """Intercepts calls to :meth:`~slimta.edge.EdgeServer.handle`, reads the proxy protocol header, and then resumes the original call. """ try: initial = self.__read_pp_initial(sock) if initial.startswith(b'PROXY '): src...
AssertionError
dataset/ETHPy150Open slimta/python-slimta/slimta/util/proxyproto.py/ProxyProtocol.handle
4,945
def prompt_for_yn(prompt_str, default=None): if default == True: prompt = prompt_str + ' [Y/n]: ' elif default == False: prompt = prompt_str + ' [y/N]: ' else: prompt = prompt_str + ' [y/n]: ' while True: try: value = input(prompt) except __HOLE__: ...
KeyboardInterrupt
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/cli/__init__.py/prompt_for_yn
4,946
def access_token(self, token): """Return request for access token value""" try: return self.get_querystring(self.ACCESS_TOKEN_URL, auth=self.oauth_auth(token)) except __HOLE__ as err: # Evernote returns a 401 error when AuthCanceled...
HTTPError
dataset/ETHPy150Open omab/python-social-auth/social/backends/evernote.py/EvernoteOAuth.access_token
4,947
def remove_file(self, filename): """Remove a file, noop if file does not exist.""" # Unlike os.remove, if the file does not exist, # then this method does nothing. try: os.remove(filename) except __HOLE__: pass
OSError
dataset/ETHPy150Open boto/boto3/boto3/s3/transfer.py/OSUtils.remove_file
4,948
def __getattr__(self, attr): try: return self.__getitem__(attr) except __HOLE__: return super(EnhancedDictionary, self).__getattr__(attr)
KeyError
dataset/ETHPy150Open kivy/kivy/kivy/input/motionevent.py/EnhancedDictionary.__getattr__
4,949
def read_parameter_file(path, name): try: raw = misc.read_file(path, name + filename_extension) except __HOLE__: raw = "{}" cooked = ast.literal_eval(raw) return cooked
IOError
dataset/ETHPy150Open laforest/Octavo/Generator/Misc/parameters_misc.py/read_parameter_file
4,950
def parse_cmdline(entries): parameters = {} if len(entries) == 0: return parameters if entries[0] == "-f" and filename_extension in entries[1]: path, name = os.path.split(entries[1]) name = name.replace(filename_extension, '') parameters = read_parameter_file(path, name) ...
ValueError
dataset/ETHPy150Open laforest/Octavo/Generator/Misc/parameters_misc.py/parse_cmdline
4,951
def test_connection(self): class DocA(Document): structure = { "doc_a":{'foo':int}, } self.connection.register([DocA]) assertion = True try: DocA.connection except AttributeError: assertion = True assert asse...
AttributeError
dataset/ETHPy150Open namlook/mongokit/tests/test_api.py/ApiTestCase.test_connection
4,952
def test_rewind(self): class MyDoc(Document): structure = { 'foo':int, } self.connection.register([MyDoc]) for i in range(10): doc = self.col.MyDoc() doc['foo'] = i doc.save() cur = self.col.MyDoc.find() ...
StopIteration
dataset/ETHPy150Open namlook/mongokit/tests/test_api.py/ApiTestCase.test_rewind
4,953
def test_database_name_filled(self): failed = False @self.connection.register class MyDoc(Document): __database__ = 'mydoc' structure = { 'foo':int, } try: doc = self.connection.MyDoc() except __HOLE__, e: ...
AttributeError
dataset/ETHPy150Open namlook/mongokit/tests/test_api.py/ApiTestCase.test_database_name_filled
4,954
def test_unwrapped_cursor(self): self.assertEqual(self.col.count(), 0) doc_id = self.col.save({}, safe=True) self.assertEqual(self.col.count(), 1) try: self.col.find(_id=doc_id)[0] except __HOLE__: self.fail("Cursor.__getitem__ raised TypeError unexpect...
TypeError
dataset/ETHPy150Open namlook/mongokit/tests/test_api.py/ApiTestCase.test_unwrapped_cursor
4,955
def force_unicode(s): try: return unicode(s) except __HOLE__: return str(s)
NameError
dataset/ETHPy150Open ffunenga/pipgh/pipgh/tools.py/force_unicode
4,956
def __init__(self, node, level=0): self.level = level def is_str(s): try: return type(s) == unicode except __HOLE__: return type(s) == str _test = lambda i: (type(i[1]) == dict or (type(i[1]) != dict and ...
NameError
dataset/ETHPy150Open ffunenga/pipgh/pipgh/tools.py/ShowNode.__init__
4,957
def __enter__(self): try: os.mkdir(self.path) except __HOLE__ as e: if e.errno != 17: # File exists raise shutil.rmtree(self.path) os.mkdir(self.path) finally: os.chdir(self.path) return self
OSError
dataset/ETHPy150Open ffunenga/pipgh/pipgh/tools.py/TempDirContext.__enter__
4,958
def __init__(self, inner_node): """ Instantiated with a inner_node as an argument This node comes from the from the do_include function """ self.inner_node = inner_node # attempting to get the tmplate name # depends whether it is an IncludeNode or ConstantInclude...
AttributeError
dataset/ETHPy150Open haystack/eyebrowse-server/common/templatetags/jstemplate.py/JsTemplateBaseNode.__init__
4,959
def _limit_inf(expr, n): try: return Limit(expr, n, S.Infinity).doit(deep=False, sequence=False) except (__HOLE__, PoleError): return None
NotImplementedError
dataset/ETHPy150Open sympy/sympy/sympy/series/limitseq.py/_limit_inf
4,960
def merge(dict_1, dict_2, func=lambda x, y: x + y): """doc""" res = dict_1.copy() # "= dict(d1)" for lists of tuples for key, val in dict_2.iteritems(): # ".. in d2" for lists of tuple try: res[key] = func(res[key], val) except __HOLE__: res[key] = val return re...
KeyError
dataset/ETHPy150Open columbia/libtrack/libtrack/parser/src/telesphorus/helpers/dict_utils.py/merge
4,961
def isDBPort(host, port, db, timeout=10): if host in (RDFTURTLEFILE_HOSTNAME, RDFXMLFILE_HOSTNAME): return True # determine if postgres port t = 2 while t < timeout: try: conn = urllib.request.urlopen("http://{0}:{1}/{2}/status".format(host, port or '80', db)) ret...
HTTPError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticRdfDB.py/isDBPort
4,962
def __init__(self, modelXbrl, user, password, host, port, database, timeout): try: initRdflibNamespaces() except __HOLE__: raise XRDBException("xrdfDB:MissingRdflib", _("Rdflib is not installed or is not available in this build")) self.mod...
ImportError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticRdfDB.py/XbrlSemanticRdfDatabaseConnection.__init__
4,963
def execute(self, activity, graph=None, query=None): if graph is not None: headers = {'User-agent': 'Arelle/1.0', 'Accept': 'application/sparql-results+json', 'Content-Type': "text/turtle; charset='UTF-8'"} data = graph.serialize(form...
ValueError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticRdfDB.py/XbrlSemanticRdfDatabaseConnection.execute
4,964
def identifyPreexistingDocuments(self): self.existingDocumentUris = set() if not (self.isRdfTurtleFile or self.isRdfXmlFile): docFilters = [] for modelDocument in self.modelXbrl.urlDocs.values(): if modelDocument.type == Type.SCHEMA: docFilters...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticRdfDB.py/XbrlSemanticRdfDatabaseConnection.identifyPreexistingDocuments
4,965
@classmethod def _create_ip_ranges_on_notation(cls, instance): """Create IP-address ranges basing on 'notation' field of 'meta' field :param instance: NetworkGroup instance :type instance: models.NetworkGroup :return: None """ notation = instance.meta.get("notation")...
TypeError
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/extensions/network_manager/objects/network_group.py/NetworkGroup._create_ip_ranges_on_notation
4,966
def __call__(self, text, append_newline=1): if not self.print_it: return if append_newline: text = text + '\n' try: sys.stdout.write(unicode(text)) except __HOLE__: # Stdout might be connected to a pipe that has been closed # by now. The mo...
IOError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/DisplayEngine.__call__
4,967
def to_String_for_signature(obj, to_String_for_subst=to_String_for_subst, AttributeError=AttributeError): try: f = obj.for_signature except __HOLE__: return to_String_for_subst(obj) else: return f() # The SCons "semi-deep" copy. # # This makes separate c...
AttributeError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/to_String_for_signature
4,968
def WhereIs(file, path=None, pathext=None, reject=[]): if path is None: try: path = os.environ['PATH'] except __HOLE__: return None if is_String(path): path = path.split(os.pathsep) if pathext is None: try: ...
KeyError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/WhereIs
4,969
def WhereIs(file, path=None, pathext=None, reject=[]): if path is None: try: path = os.environ['PATH'] except KeyError: return None if is_String(path): path = path.split(os.pathsep) if pathext is None: pathext = ['.e...
ValueError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/WhereIs
4,970
def WhereIs(file, path=None, pathext=None, reject=[]): import stat if path is None: try: path = os.environ['PATH'] except __HOLE__: return None if is_String(path): path = path.split(os.pathsep) if not is_List(reject) and...
KeyError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/WhereIs
4,971
def popitem(self): try: key = self._keys[-1] except __HOLE__: raise KeyError('dictionary is empty') val = self[key] del self[key] return (key, val)
IndexError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/OrderedDict.popitem
4,972
def __call__(self, env, source, ext=None): if ext is None: try: ext = source[0].suffix except __HOLE__: ext = "" try: return self[ext] except KeyError: # Try to perform Environment substitution on the keys of ...
IndexError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/Selector.__call__
4,973
def unique(s): """Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all ...
TypeError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/unique
4,974
def write(self, arg): try: self.file.write(arg) self.file.flush() except __HOLE__: # Stdout might be connected to a pipe that has been closed # by now. The most likely reason for the pipe being closed # is that the user has press ctrl-c. It thi...
IOError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/Unbuffered.write
4,975
def silent_intern(x): """ Perform sys.intern() on the passed argument and return the result. If the input is ineligible (e.g. a unicode string) the original argument is returned and no exception is thrown. """ try: return sys.intern(x) except __HOLE__: return x # From Dinu...
TypeError
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py/silent_intern
4,976
def sync(self): '''Copy disk image to path, regenerate OVF descriptor''' self.copy_disk() self.ovf_descriptor = self.new_ovf_descriptor() ovf_xml = self.ovf_descriptor.generate_ovf_xml() try: os.makedirs(os.path.dirname(self.ovf_path)) except __HOLE__, e: ...
OSError
dataset/ETHPy150Open redhat-imaging/imagefactory/imagefactory_plugins/ovfcommon/ovfcommon.py/OVFPackage.sync
4,977
def get_jellyroll_items(parser, token): """ Load jellyroll ``Item`` objects into the context.In the simplest mode, the most recent N items will be returned. :: {# Fetch 10 most recent items #} {% get_jellyroll_items limit 10 as items %} Newer items will be first in...
KeyError
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/templatetags/jellyroll.py/get_jellyroll_items
4,978
def resolve_date(self, d, context): """Resolve start/end, handling literals""" try: d = template.resolve_variable(d, context) except template.VariableDoesNotExist: return None # Handle date objects if isinstance(d, (datetime.date, datetime.datetim...
ValueError
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/templatetags/jellyroll.py/GetJellyrollItemsNode.resolve_date
4,979
def delete(self): """Removes from disk atomically, can not then subsequently call read(), write() or addChildren() """ os.remove(self.getJobFileName()) #This is the atomic operation, if this file is not present the job is deleted. dirToRemove = self.jobDir while 1: he...
RuntimeError
dataset/ETHPy150Open benedictpaten/jobTree/src/job.py/Job.delete
4,980
def main(nick=None, user=None, dest=None): if nick is None: # pragma: no cover try: nick = sys.argv[1] except __HOLE__: print(__doc__) sys.exit(-1) dest = dest or os.getcwd() user = user or os.environ.get('USER', 'mynick') config = dict(nick=nick, use...
IndexError
dataset/ETHPy150Open gawel/irc3/irc3/template/__init__.py/main
4,981
def _setConfigParamsInPDU(self, pdu, kwargs): """Check for PDU's mandatory parameters and try to set remaining unset params (in kwargs) from the config default values """ for param in pdu.mandatoryParams: if param not in kwargs: try: ...
AttributeError
dataset/ETHPy150Open jookies/jasmin/jasmin/protocols/smpp/operations.py/SMPPOperationFactory._setConfigParamsInPDU
4,982
def SubmitSM(self, short_message, data_coding=0, **kwargs): """Depending on the short_message length, this method will return a classical SubmitSM or a serie of linked SubmitSMs (parted message) """ kwargs['short_message'] = short_message kwargs['data_coding'] = data_coding ...
NameError
dataset/ETHPy150Open jookies/jasmin/jasmin/protocols/smpp/operations.py/SMPPOperationFactory.SubmitSM
4,983
def _remove_file(filepath): if not filepath: return try: os.remove(filepath) except __HOLE__: pass
OSError
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/plugins/common/test_execcmd.py/_remove_file
4,984
def __getitem__(self, index): while 1: try: file = self.files[self.index] self.index = self.index + 1 except __HOLE__: self.index = 0 self.directory = self.stack.pop() self.files = os.listdir(self.directory) ...
IndexError
dataset/ETHPy150Open uwdata/termite-data-server/web2py/extras/build_web2py/setup_app.py/reglob.__getitem__
4,985
def send(self, data_to_send): """ Immediately sends the data passed in to :func:`service_endpoint_uri`. If the service request fails, the passed in items are pushed back to the :func:`queue`. Args: data_to_send (Array): an array of :class:`contracts.Envelope` objects to send to the ...
HTTPError
dataset/ETHPy150Open Microsoft/ApplicationInsights-Python/applicationinsights/channel/SenderBase.py/SenderBase.send
4,986
@background.setter def background(self, value): self._color = value self.refresh() # propagate changes to every clone if self.editor: for clone in self.editor.clones: try: clone.modes.get(self.__class__).background = value ...
KeyError
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/modes/line_highlighter.py/LineHighlighterMode.background
4,987
def convert_datestr(datestr): """Converts dates like `12/31/2010` into datetime objects.""" try: return dateutil.parser.parse(datestr) except (__HOLE__, ValueError, AttributeError): return None
TypeError
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/utils/time.py/convert_datestr
4,988
def patch_translation_field(self, db_field, field, **kwargs): if db_field.name in self.trans_opts.fields: if field.required: field.required = False field.blank = True self._orig_was_required['%s.%s' % (db_field.model._meta, db_field.name)] = True ...
AttributeError
dataset/ETHPy150Open deschler/django-modeltranslation/modeltranslation/admin.py/TranslationBaseModelAdmin.patch_translation_field
4,989
def __init__(self, search_query): if not isinstance(search_query, str): raise ValueError("Expected str for 1st parameter (search_query).") self.avail_files = OrderedDict() self.visible_files = None self.adj_tokens = {False: None, True: None} self.vf_iter = None ...
AttributeError
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/actions.py/YTActions.__init__
4,990
def __getChannelId(self): """ Obtain channel id for channel name, if present in ``self.search_params``. """ if not self.search_params.get("channelId"): return api_fixed_url = "https://www.googleapis.com/youtube/v3/channels?part=id&maxResults=1&fields=items%2Fid&" ...
IndexError
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/actions.py/YTActions.__getChannelId
4,991
def __searchParser(self, query): """ Parse `query` for advanced search options. Parameters ---------- query : str Search query to parse. Besides a search query, user can specify additional search parameters and YTFS specific options. Syntax: ...
KeyError
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/actions.py/YTActions.__searchParser
4,992
def updateResults(self, forward=None): """ Reload search results or load another "page". Parameters ---------- forward : bool or None, optional Whether move forwards or backwards (``True`` or ``False``). If ``None``, then first page is loaded. """ #...
KeyError
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/actions.py/YTActions.updateResults
4,993
def act(self): try: address = self.command[0] self.window.buffer.read(address) except __HOLE__: pass
IndexError
dataset/ETHPy150Open elmar-hinz/Python.Vii/vii/Interpreter.py/EditAction.act
4,994
def act(self): try: address = self.command[0] self.window.buffer.write(address) except __HOLE__: self.window.buffer.write()
IndexError
dataset/ETHPy150Open elmar-hinz/Python.Vii/vii/Interpreter.py/WriteAction.act
4,995
def get_class_from_string(path, default=None): """ Return the class specified by the string. IE: django.contrib.auth.models.User Will return the user class or cause an ImportError """ try: from importlib import import_module except __HOLE__: from django.utils.importlib impor...
ImportError
dataset/ETHPy150Open GetStream/stream-django/stream_django/utils.py/get_class_from_string
4,996
def tno_can_add(self, node, add_object): """ Returns whether a given object is droppable on the node. """ from mayavi.core.filter import Filter try: if issubclass(add_object, Filter) or \ issubclass(add_object, ModuleManager): return True ...
TypeError
dataset/ETHPy150Open enthought/mayavi/mayavi/core/source.py/Source.tno_can_add
4,997
def action(self): ''' Should only run once to cleanup stale lane uxd files. ''' if not is_windows() and self.opts.value.get('sock_dir'): sockdirpath = os.path.abspath(self.opts.value['sock_dir']) console.concise("Cleaning up uxd files in {0}\n".format(sockdirpath)...
OSError
dataset/ETHPy150Open saltstack/salt/salt/daemons/flo/core.py/SaltRaetCleanup.action
4,998
def _process_road_rxmsg(self, msg, sender): ''' Send to the right queue msg is the message body dict sender is the unique name of the remote estate that sent the message ''' try: s_estate, s_yard, s_share = msg['route']['src'] d_estate, d_yard, d_s...
ValueError
dataset/ETHPy150Open saltstack/salt/salt/daemons/flo/core.py/SaltRaetRouterMaster._process_road_rxmsg
4,999
def _process_lane_rxmsg(self, msg, sender): ''' Send uxd messages tot he right queue or forward them to the correct yard etc. msg is message body dict sender is unique name of remote that sent the message ''' try: s_estate, s_yard, s_share = msg['rou...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/daemons/flo/core.py/SaltRaetRouterMaster._process_lane_rxmsg