Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
1,800
def addInterface(self, iTag, iType, clsName, addr): """ Add an interface to the ROS environment inside the container. @param iTag: Tag which is used to identify the interface in subsequent requests. @type iTag: str @param iType...
TypeError
dataset/ETHPy150Open rapyuta/rce/rce-core/rce/core/wrapper.py/Container.addInterface
1,801
def removeInterface(self, iTag): """ Remove an interface from the ROS environment inside the container. @param iTag: Tag which is used to identify the interface which should be removed. @type iTag: str """ try: s...
KeyError
dataset/ETHPy150Open rapyuta/rce/rce-core/rce/core/wrapper.py/Container.removeInterface
1,802
def getInterface(self, iTag): """ Return the wrapped interface instance matching the given tag. @param iTag: Tag which is used to identify the interface which should be returned. @type iTag: str @return: Wrapped inte...
KeyError
dataset/ETHPy150Open rapyuta/rce/rce-core/rce/core/wrapper.py/Container.getInterface
1,803
def call(method, api_or_module, url, body='', headers=None, **params): """Simulates a round-trip call against the given API / URL""" api = API(api_or_module).http.server() response = StartResponseMock() headers = {} if headers is None else headers if not isinstance(body, str) and 'json' in headers.g...
TypeError
dataset/ETHPy150Open timothycrosley/hug/hug/test.py/call
1,804
def summary ( cvsfile, write_func, *args ): """Show the column names. """ fsnames = cvsfile.fieldnames data_dict = {} for f in fsnames: data_dict[f]=[] #print "\n".join(map( lambda x:":".join(map(str,x)) ,enumerate(fsnames)) ) for l in cvsfile: for f in fsnames: ...
ValueError
dataset/ETHPy150Open taoliu/taolib/Scripts/ce_histone_matrix.py/summary
1,805
def readPlistFromString(data): '''Read a plist data from a string. Return the root object.''' try: plistData = buffer(data) except __HOLE__, err: raise NSPropertyListSerializationException(err) dataObject, dummy_plistFormat, error = ( NSPropertyListSerialization. property...
TypeError
dataset/ETHPy150Open munki/munki/code/client/munkilib/FoundationPlist.py/readPlistFromString
1,806
def _priority_from_env(self, val): """Gets priority pairs from env.""" for part in val.split(':'): try: rule, priority = part.split('=') yield rule, int(priority) except __HOLE__: continue
ValueError
dataset/ETHPy150Open nvbn/thefuck/thefuck/conf.py/Settings._priority_from_env
1,807
def handle(self, addrport='', *args, **options): import django from google.appengine._internal.django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException from google.appengine._internal.django.core.handlers.wsgi import WSGIHandler if args: raise CommandEr...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/_internal/django/core/management/commands/runserver.py/Command.handle
1,808
def __init__(self, **config): _Graph.__init__(self, **config) self.add_defaults(NetGraph.defaults) if self.interface == "auto": try: self.interface = self.get_main_iface() except __HOLE__: logger.warning( "NetGraph - Aut...
RuntimeError
dataset/ETHPy150Open qtile/qtile/libqtile/widget/graph.py/NetGraph.__init__
1,809
def _getValues(self): try: with open(self.filename) as file: val = int(file.read()) rval = val - self.bytes self.bytes = val return rval except __HOLE__: return 0
IOError
dataset/ETHPy150Open qtile/qtile/libqtile/widget/graph.py/NetGraph._getValues
1,810
@staticmethod def get_main_iface(): def make_route(line): return dict(zip(['iface', 'dest'], line.split())) with open('/proc/net/route', 'r') as fp: lines = fp.readlines() routes = [make_route(line) for line in lines[1:]] try: return next( ...
KeyError
dataset/ETHPy150Open qtile/qtile/libqtile/widget/graph.py/NetGraph.get_main_iface
1,811
def _getActivity(self): try: # io_ticks is field number 9 with open(self.path) as f: io_ticks = int(f.read().split()[9]) except __HOLE__: return 0 activity = io_ticks - self._prev self._prev = io_ticks return activity
IOError
dataset/ETHPy150Open qtile/qtile/libqtile/widget/graph.py/HDDBusyGraph._getActivity
1,812
def my_import(name): try: imp = __import__(name) except __HOLE__ as err: raise JobError("Failed to import %s with error %s" % (name, err)) mods = name.split('.') if len(mods) > 1: for mod in mods[1:]: imp = getattr(imp, mod) return imp
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/jobs.py/my_import
1,813
def find_jobs(jobs_dir): try: return [f[:-3] for f in os.listdir(jobs_dir) if not f.startswith('_') and f.endswith(".py")] except __HOLE__: return []
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/jobs.py/find_jobs
1,814
def get_jobs(when=None, only_scheduled=False): """ Returns a dictionary mapping of job names together with their respective application class. """ # FIXME: HACK: make sure the project dir is on the path when executed as ./manage.py import sys try: cpath = os.path.dirname(os.path.real...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/jobs.py/get_jobs
1,815
def _resolve_device_type(self, device): """ Given a device, determines if it is a CloudServer, a CloudLoadBalancer, or an invalid device. """ try: from tests.unit import fakes server_types = (pyrax.CloudServer, fakes.FakeServer) lb_types = (Clo...
ImportError
dataset/ETHPy150Open rackspace/pyrax/pyrax/clouddns.py/CloudDNSManager._resolve_device_type
1,816
def update_ptr_record(self, device, record, domain_name, data=None, ttl=None, comment=None): """ Updates a PTR record with the supplied values. """ device_type = self._resolve_device_type(device) href, svc_name = self._get_ptr_details(device, device_type) try:...
AttributeError
dataset/ETHPy150Open rackspace/pyrax/pyrax/clouddns.py/CloudDNSManager.update_ptr_record
1,817
def next(self): """ Return the next available item. If there are no more items in the local 'results' list, check if there is a 'next_uri' value. If so, use that to get the next page of results from the API, and return the first item from that query. """ try: ...
IndexError
dataset/ETHPy150Open rackspace/pyrax/pyrax/clouddns.py/ResultsIterator.next
1,818
def delete_cache_file(cache_file): """ Deletes a cache file. Ignores some common, typically harmless errors. :param basestring cache_dir: Full path to a cache file to delete. """ try: os.unlink(cache_file) except (__HOLE__, OSError): pass
IOError
dataset/ETHPy150Open gtaylor/EVE-Market-Data-Uploader/emdu/utils.py/delete_cache_file
1,819
@permission_required("core.manage_shop") def manage_shipping(request): """Dispatches to the first shipping method or to the add shipping method form if there is no shipping method. """ try: shipping_method = ShippingMethod.objects.all()[0] except __HOLE__: url = reverse("lfs_manage_n...
IndexError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/manage_shipping
1,820
@permission_required("core.manage_shop") def shipping_methods(request, template_name="manage/shipping_methods/shipping_methods.html"): """Returns all shipping methods as html. This view is used as a part within the manage shipping view. """ try: current_id = int(request.path.split("/")[-1]) ...
ValueError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/shipping_methods
1,821
@permission_required("core.manage_shop") def add_shipping_price(request, shipping_method_id): """Adds given shipping price (via request body) to shipping method with give id. Returns JSON encoded data. """ try: price = float(request.POST.get("price", 0)) except __HOLE__: price =...
ValueError
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/add_shipping_price
1,822
@permission_required("core.manage_shop") def update_shipping_prices(request, shipping_method_id): """Saves/Deletes shipping prices with passed ids (via request body) dependent on given action (via request body). """ shipping_method = get_object_or_404(ShippingMethod, pk=shipping_method_id) action =...
ObjectDoesNotExist
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/update_shipping_prices
1,823
@permission_required("core.manage_shop") @require_POST def delete_shipping_method(request, shipping_method_id): """Deletes shipping method with passed shipping id. All customers, which have selected this shipping method are getting the default shipping method. """ try: shipping_method = Shi...
ObjectDoesNotExist
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/shipping_methods/views.py/delete_shipping_method
1,824
def iter_format_modules(lang): """ Does the heavy lifting of finding format modules. """ if check_for_language(lang): format_locations = ['django.conf.locale.%s'] if settings.FORMAT_MODULE_PATH: format_locations.append(settings.FORMAT_MODULE_PATH + '.%s') format_l...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/utils/formats.py/iter_format_modules
1,825
def get_format(format_type, lang=None, use_l10n=None): """ For a specific format type, returns the format for the current language (locale), defaults to the format in the settings. format_type is the name of the format, e.g. 'DATE_FORMAT' If use_l10n is provided and is not None, that will force the...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/utils/formats.py/get_format
1,826
def test_performance(self): with self.toggle_run_expected_output(): start_time = time.time() try: self.assert_expected_output() except __HOLE__: pass end_time = time.time() total_time = end_time - start_time ...
AssertionError
dataset/ETHPy150Open CenterForOpenScience/pydocx/tests/export/test_xml.py/DeeplyNestedTableTestCase.test_performance
1,827
def test_performance(self): with self.toggle_run_expected_output(): start_time = time.time() try: self.assert_expected_output() except __HOLE__: pass end_time = time.time() total_time = end_time - start_time ...
AssertionError
dataset/ETHPy150Open CenterForOpenScience/pydocx/tests/export/test_xml.py/LargeCellTestCase.test_performance
1,828
def get(self, request, slug, year, month): addon = self.get_addon(request, slug) check_stats_permission(request, addon) data = [] path = u'{id}/{year}/{month}/'.format( id=addon.id, year=year, month=month) try: files = storage.listdir(path) excep...
OSError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/stats/views.py/ArchiveListView.get
1,829
def get(self, request, slug, year, month, day, model_name): addon = self.get_addon(request, slug) check_stats_permission(request, addon) tm = '{id}/{year}/{month}/{year}_{month}_{day}_{model_name}.json' path = tm.format( id=addon.id, year=year, month=month, day=day, ...
OSError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/stats/views.py/ArchiveView.get
1,830
def test_fs_configuration(fs_config, hadoop_bin_conf): """Test FS configuration. Returns list of (confvar, error).""" TEST_FILE = '/tmp/.hue_config_test.%s' % (random.randint(0, 9999999999)) res = [ ] res.extend(validate_port(fs_config.NN_THRIFT_PORT)) res.extend(validate_port(fs_config.NN_HDFS_PORT)) if r...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py/test_fs_configuration
1,831
def create_home_dir(self, home_path=None): if home_path is None: home_path = self.get_home_dir() mode = int(HOME_DIR_PERMISSIONS.get(), 8) if not self.exists(home_path): user = self.user try: try: self.setuser(self.superuser) self.mkdir(home_path) sel...
IOError
dataset/ETHPy150Open cloudera/hue/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py/Hdfs.create_home_dir
1,832
@require_open def close(self): try: (stdout, stderr) = self.putter.communicate() except __HOLE__, ioe: logging.debug("Saw IOError writing %r" % self.path, exc_info=1) if ioe.errno == errno.EPIPE: stdout, stderr = self.putter.communicate() self.closed = True if stderr: ...
IOError
dataset/ETHPy150Open cloudera/hue/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py/FileUpload.close
1,833
def cd(self,*args, **kwargs): pyTerm = kwargs["pyTerm"] try: sequence = kwargs["sequence"][0] except __HOLE__: sequence = "" if sequence == "..": # upward currentPath = pyTerm.getPath().split("/")[::-1][1::] if currentPath[0] == '': pyTerm.setPath('/') else: pyTerm.setPath("/".join(curr...
IndexError
dataset/ETHPy150Open jeffersonmourak/pyTerm/plugins/pathNavigator.py/pathNavigator.cd
1,834
def mongoengine_validate_wrapper(old_clean, new_clean): """ A wrapper function to validate formdata against mongoengine-field validator and raise a proper django.forms ValidationError if there are any problems. """ def inner_validate(value): value = old_clean(value) try: ...
ValidationError
dataset/ETHPy150Open stephrdev/django-mongoforms/mongoforms/utils.py/mongoengine_validate_wrapper
1,835
def _preprocess_fields(form): for field in form.fields: name = form.fields[field].widget.__class__.__name__.lower() if not name.startswith("radio") and not name.startswith("checkbox"): try: form.fields[field].widget.attrs["class"] += " form-control" except __H...
KeyError
dataset/ETHPy150Open mgaitan/waliki/waliki/templatetags/bootstrap_tags.py/_preprocess_fields
1,836
@click.command(short_help="Transform coordinates.") @click.argument('INPUT', default='-', required=False) @click.option('--src-crs', '--src_crs', default='EPSG:4326', help="Source CRS.") @click.option('--dst-crs', '--dst_crs', default='EPSG:4326', help="Destination CRS.") @precision_opt @cli...
IOError
dataset/ETHPy150Open mapbox/rasterio/rasterio/rio/transform.py/transform
1,837
def mkdir_p(dirname): assert dirname is not None if dirname == '': return try: os.makedirs(dirname) except __HOLE__ as e: if e.errno != 17: raise e
OSError
dataset/ETHPy150Open ppwwyyxx/tensorpack/tensorpack/utils/fs.py/mkdir_p
1,838
@defer.inlineCallbacks def test_process_chain(self): x = yield process_chain([cb1, cb2, cb3], 'res', 'v1', 'v2') self.assertEqual(x, "(cb3 (cb2 (cb1 res v1 v2) v1 v2) v1 v2)") gotexc = False try: yield process_chain([cb1, cb_fail, cb3], 'res', 'v1', 'v2') except ...
TypeError
dataset/ETHPy150Open scrapy/scrapy/tests/test_utils_defer.py/DeferUtilsTest.test_process_chain
1,839
def extract_and_validate(email): try: stream_name, token = decode_email_address(email) except (__HOLE__, ValueError): raise ZulipEmailForwardError("Malformed email recipient " + email) if not valid_stream(stream_name, token): raise ZulipEmailForwardError("Bad stream token from email...
TypeError
dataset/ETHPy150Open zulip/zulip/zerver/lib/email_mirror.py/extract_and_validate
1,840
@defer.inlineCallbacks def run_as_leader(self): logger.info('Running as leader for service [{0}]. pid: [{1}]'.format(self.service_name, os.getpid())) try: notification_queue = yield self.cancellable(self.listener.listen(self.channels)) yield self.cancellable(self.process_in...
TypeError
dataset/ETHPy150Open foundit/Piped/contrib/database/piped_database/service.py/PostgresListenerService.run_as_leader
1,841
def __init__(self, arguments): """ Runs the command specified as an argument with the options specified """ self.config_file = arguments['--config'] self.config = configparser.ConfigParser() self.client_id = None self.client_secret = None self.access_token...
IOError
dataset/ETHPy150Open orcasgit/python-misfit/misfit/cli.py/MisfitCli.__init__
1,842
def read_config(self): """ Read credentials from the config file """ with open(self.config_file) as cfg: try: self.config.read_file(cfg) except __HOLE__: # Not python 3.X fallback self.config.readfp(cfg) self.client_id = self.config.get('m...
AttributeError
dataset/ETHPy150Open orcasgit/python-misfit/misfit/cli.py/MisfitCli.read_config
1,843
def main(argv): if len(argv) < 2: print "Usage: %s places.sqlite" % __program__ sys.exit(1) encoding = locale.getpreferredencoding() if encoding.upper() != "UTF-8": print "%s requires an UTF-8 capable console/terminal" % __program__ sys.exit(1) files_to_process = [] for input_glob in argv[1...
TypeError
dataset/ETHPy150Open google/grr/grr/parsers/firefox3_history.py/main
1,844
def __init__(self, host, port=22, username=None, password=None, key_filename=None, cwd=None, label=None, redirect_output=False, block=False): """ If username, password, and key_filename are None, the SSH will be use the default ssh key loaded into the system and will work if th...
ImportError
dataset/ETHPy150Open ucb-sts/sts/sts/entities/base.py/SSHEntity.__init__
1,845
@property def check_key_policy(self): """ Returns the the policy for missing host keys Default: accept all keys """ try: import paramiko except __HOLE__: raise RuntimeError('''Must install paramiko to use ssh: \n''' ''' $ sudo pip install paramiko ''') ...
ImportError
dataset/ETHPy150Open ucb-sts/sts/sts/entities/base.py/SSHEntity.check_key_policy
1,846
def dbid_to_obj(inp, objclass, raise_errors=True): """ Convert a #dbid to a valid object. Args: inp (str or int): A valid dbref. objclass (class): A valid django model to filter against. raise_errors (bool, optional): Whether to raise errors or return `None` on errors. ...
ValueError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/dbid_to_obj
1,847
def to_unicode(obj, encoding='utf-8', force_string=False): """ This decodes a suitable object to the unicode format. Args: obj (any): Object to decode to unicode. encoding (str, optional): The encoding type to use for the dedoding. force_string (bool, optional): Always c...
UnicodeDecodeError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/to_unicode
1,848
def validate_email_address(emailaddress): """ Checks if an email address is syntactically correct. Args: emailaddress (str): Email address to validate. Returns: is_valid (bool): If this is a valid email or not. Notes. (This snippet was adapted from http://commandli...
ValueError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/validate_email_address
1,849
def uses_database(name="sqlite3"): """ Checks if the game is currently using a given database. This is a shortcut to having to use the full backend name. Args: name (str): One of 'sqlite3', 'mysql', 'postgresql_psycopg2' or 'oracle'. Returns: uses (bool): If the given datab...
KeyError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/uses_database
1,850
def clean_object_caches(obj): """ Clean all object caches on the given object. Args: obj (Object instace): An object whose caches to clean. Notes: This is only the contents cache these days. """ global _TYPECLASSMODELS, _OBJECTMODELS if not _TYPECLASSMODELS: from e...
AttributeError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/clean_object_caches
1,851
def check_evennia_dependencies(): """ Checks the versions of Evennia's dependencies including making some checks for runtime libraries. Returns: result (bool): `False` if a show-stopping version mismatch is found. """ # check main dependencies from evennia.server.evenn...
ImportError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/check_evennia_dependencies
1,852
def has_parent(basepath, obj): """ Checks if `basepath` is somewhere in `obj`s parent tree. Args: basepath (str): Python dotpath to compare against obj path. obj (any): Object whose path is to be checked. Returns: has_parent (bool): If the check was successful or not. """ ...
AttributeError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/has_parent
1,853
def mod_import(module): """ A generic Python module loader. Args: module (str, module): This can be either a Python path (dot-notation like `evennia.objects.models`), an absolute path (e.g. `/home/eve/evennia/evennia/objects.models.py`) or an already imported mod...
ImportError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/mod_import
1,854
def fuzzy_import_from_module(path, variable, default=None, defaultpaths=None): """ Import a variable based on a fuzzy path. First the literal `path` will be tried, then all given `defaultpaths` will be prepended to see a match is found. Args: path (str): Full or partial python path. ...
ImportError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/fuzzy_import_from_module
1,855
def class_from_module(path, defaultpaths=None): """ Return a class from a module, given the module's path. This is primarily used to convert db_typeclass_path:s to classes. Args: path (str): Full Python dot-path to module. defaultpaths (iterable, optional): If a direc import from `path`...
AttributeError
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/class_from_module
1,856
def parse_command(self, com_arg, com_string): """Parse the values given in the command line.""" try: return tuple((int(item.strip()) for item in com_string.split(':'))) except __HOLE__: raise CommandError('You failed to provide "%s" with one or two ' ...
ValueError
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/reviews/management/commands/fill-database.py/Command.parse_command
1,857
def __digify_args(*args): """Covert all arguments to a number""" numbers = [] for arg in args: if isinstance(arg, MathString): if '.' in arg: numtype = float else: numtype = int try: ...
ValueError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/MathString.__digify_args
1,858
def __int__(self): try: return int(str(self)) except __HOLE__: return int(float(self))
ValueError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/MathString.__int__
1,859
def __long__(self): try: return long(str(self)) except __HOLE__: return long(float(self))
ValueError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/MathString.__long__
1,860
def setup(user=None, group=None, file_limit=None, core_dumps=None): """Set the processes user, group, and file limits""" if file_limit: try: resource.setrlimit(resource.RLIMIT_NOFILE, (file_limit, file_limit)) except ValueError, ex: log.error("Failed to set limit on open...
ValueError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/setup
1,861
def daemonize(pid_file, cwd="/"): """Background the current process""" log.debug("daemonizing process") # BROKEN: the pid file may have already been created by write_pid # however, I'm not even using nagcat in daemon mode right now so # I'll just leave this commented out for now... # Also, thi...
IOError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/daemonize
1,862
def write_pid(pid_file): """Write out the current PID""" try: pidfd = open(pid_file, 'w') except __HOLE__, ex: log.error("Failed to open PID file %s" % pid_file) log.error("Error: %s" % (ex,)) sys.exit(1) pidfd.write("%s\n" % os.getpid()) pidfd.close()
IOError
dataset/ETHPy150Open marineam/nagcat/python/nagcat/util.py/write_pid
1,863
def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) show_path = mobj.group('show_path') episode_path = mobj.group('episode_path') is_playlist = True if mobj.group('is_playlist') else False webpage = self._download_webpage(url, episode_path) # Extract the...
ValueError
dataset/ETHPy150Open yasoob/youtube-dl-GUI/youtube_dl/extractor/adultswim.py/AdultSwimIE._real_extract
1,864
def get_class_by_model_or_name(cls): collection_class = None if isinstance(cls, basestring): app_label, model_name = cls.split('.') try: collection_class=get_model(app_label, model_name) except __HOLE__: # This is a Django internal thing. If all the models are not...
ImportError
dataset/ETHPy150Open jumoconnect/openjumo/jumodjango/etc/cache.py/get_class_by_model_or_name
1,865
def get_lookup(channel): """ find the lookup class for the named channel. this is used internally """ try: lookup_label = settings.AJAX_LOOKUP_CHANNELS[channel] except (__HOLE__, AttributeError): raise ImproperlyConfigured("settings.AJAX_LOOKUP_CHANNELS not configured correctly for %r" % ch...
KeyError
dataset/ETHPy150Open caseywstark/colab/colab/apps/ajax_select/__init__.py/get_lookup
1,866
def register_argparse_afc(cmdargs): import argparse import sys import afcapplicationdirectory import afccrashlogdirectory import afcmediadirectory import afcroot import time import posixpath import pprint def printdir(afc, path, recurse): dirlist = [] rows = [] colmax = [0, 0, 0, 0] print "afc: ", pa...
OSError
dataset/ETHPy150Open mountainstorm/MobileDevice/afcmediadirectory.py/register_argparse_afc
1,867
def manage(module, **params): """Return a proxy for a DB-API module that automatically pools connections. Given a DB-API 2.0 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connect...
KeyError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/manage
1,868
def _close_connection(self, connection): self.logger.debug("Closing connection %r", connection) try: self._dialect.do_close(connection) except (SystemExit, __HOLE__): raise except: self.logger.error("Exception closing connection %r", ...
KeyboardInterrupt
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/Pool._close_connection
1,869
def connect(self): """Return a DBAPI connection from the pool. The connection is instrumented such that when its ``close()`` method is called, the connection will be returned to the pool. """ if not self._use_threadlocal: return _ConnectionFairy._checkout(se...
AttributeError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/Pool.connect
1,870
def _return_conn(self, record): """Given a _ConnectionRecord, return it to the :class:`.Pool`. This method is called when an instrumented DBAPI connection has its ``close()`` method called. """ if self._use_threadlocal: try: del self._threadconns.cur...
AttributeError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/Pool._return_conn
1,871
def dispose(self): """Dispose of this pool.""" for conn in self._all_conns: try: conn.close() except (SystemExit, __HOLE__): raise except: # pysqlite won't even let you close a conn from a thread # that ...
KeyboardInterrupt
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/SingletonThreadPool.dispose
1,872
def _do_get(self): try: c = self._conn.current() if c: return c except __HOLE__: pass c = self._create_connection() self._conn.current = weakref.ref(c) if len(self._all_conns) >= self.size: self._cleanup() se...
AttributeError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/SingletonThreadPool._do_get
1,873
def get_pool(self, *args, **kw): key = self._serialize(*args, **kw) try: return self.pools[key] except __HOLE__: self._create_pool_mutex.acquire() try: if key not in self.pools: kw.pop('sa_pool_key', None) ...
KeyError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/_DBProxy.get_pool
1,874
def dispose(self, *args, **kw): """Dispose the pool referenced by the given connect arguments.""" key = self._serialize(*args, **kw) try: del self.pools[key] except __HOLE__: pass
KeyError
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/pool.py/_DBProxy.dispose
1,875
def test_get_live_channels(self): # This is a tricky one, not sure how to properly test it.. test_channel_count = 10 live_channels = self.twitch.get_live_channels() error_count = 0 test_count = 0 for ch in live_channels: ret_json = requests.get(self.TWITCH_RES...
KeyError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestTwitchEngine.test_get_live_channels
1,876
def tearDown(self): try: os.remove(self.service.SUB_FILE) except __HOLE__: pass
OSError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestService.tearDown
1,877
def test_subscribe_one(self): try: os.remove(self.service.SUB_FILE) except __HOLE__: pass self.service.start() threading.Event().wait(.1) self.service.stop() self.service._twitch.set_exists_channel_list(['testch1', 'testch2']) fake_sender...
OSError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestService.test_subscribe_one
1,878
def test_subscribe_one_exists(self): try: os.remove(self.service.SUB_FILE) except __HOLE__: pass self.service.start() threading.Event().wait(.1) self.service.stop() self.service._twitch.set_exists_channel_list(['testch1', 'testch2']) fake_...
OSError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestService.test_subscribe_one_exists
1,879
def test_subscribe_multi(self): try: os.remove(self.service.SUB_FILE) except __HOLE__: pass self.service.start() threading.Event().wait(.1) self.service.stop() self.service._twitch.set_exists_channel_list(['testch1', 'testch2']) fake_sende...
OSError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestService.test_subscribe_multi
1,880
def test_list_users_no_user(self): # issue #10, list user hit exception while there is no user config['interface']['test'] = {'admin_id': 'test_admin'} try: os.remove(self.service.SUB_FILE) except __HOLE__: pass self.service.start() threading.Even...
OSError
dataset/ETHPy150Open KavenC/Linot/tests/services/test_twitch_notifier.py/TestService.test_list_users_no_user
1,881
def test_assert_no_diff_dict(self): dict1 = {'I love': 'you'} dict2 = {'I love': 'moo'} try: self.failIfDiff(dict1, dict2) except __HOLE__, e: self.failIfDiff(e.message, """\n--- First \n\n+++ Second \n\n@@ -1,1 +1,1 @@\n\n-'I love':'you'\n+'I love':'moo'\n""")
AssertionError
dataset/ETHPy150Open ericholscher/django-test-utils/test_project/test_app/tests/assertions_tests.py/TestAssertions.test_assert_no_diff_dict
1,882
def test_assert_no_diff_list(self): list1 = ['I love', 'you'] list2 = ['I love', 'to moo'] try: self.failIfDiff(list1, list2) except __HOLE__, e: self.failIfDiff(e.message, """\n--- First \n\n+++ Second \n\n@@ -1,2 +1,2 @@\n\n 'I love'\n-'you'\n+'to moo'\n""")
AssertionError
dataset/ETHPy150Open ericholscher/django-test-utils/test_project/test_app/tests/assertions_tests.py/TestAssertions.test_assert_no_diff_list
1,883
def _convert_float(self, number): try: return float(number) except __HOLE__: return None
ValueError
dataset/ETHPy150Open DenisCarriere/geocoder/geocoder/location.py/Location._convert_float
1,884
def emit(self, record): """ Emit a record. """ try: eventDict = { 'category': self.category, 'logLevel': record.levelname, 'logName': record.name, 'filename': record.pathname, ...
SystemExit
dataset/ETHPy150Open mochi/udplog/udplog/twisted.py/TwistedLogHandler.emit
1,885
def datagramReceived(self, datagram, addr): data = datagram.rstrip() try: category, event = udplog.unserialize(data) event['category'] = category except (__HOLE__, TypeError): log.err() return self.callback(event)
ValueError
dataset/ETHPy150Open mochi/udplog/udplog/twisted.py/UDPLogProtocol.datagramReceived
1,886
def unregister(self, consumer): try: self._consumers.remove(consumer) except __HOLE__: pass
KeyError
dataset/ETHPy150Open mochi/udplog/udplog/twisted.py/Dispatcher.unregister
1,887
def check_if_installed(self): try: find_module("locust") self.already_installed = True except __HOLE__: self.log.error("LocustIO is not installed, see http://docs.locust.io/en/latest/installation.html") return False return True
ImportError
dataset/ETHPy150Open Blazemeter/taurus/bzt/modules/locustio.py/LocustIO.check_if_installed
1,888
def protorpc_to_endpoints_error(self, status, body): """Convert a ProtoRPC error to the format expected by Google Endpoints. If the body does not contain an ProtoRPC message in state APPLICATION_ERROR the status and body will be returned unchanged. Args: status: HTTP status of the response from ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/endpoints/apiserving.py/_ApiServer.protorpc_to_endpoints_error
1,889
def emit(self, record): try: data = self.format(record) tag = ('%s.%s' % (self.tag, record.levelname.lower())).lstrip('.') self.fluent.send(data, tag, record.created) except (__HOLE__, SystemExit): raise except: self.handleError(record)
KeyboardInterrupt
dataset/ETHPy150Open yosisa/pyfluent/pyfluent/logging.py/SafeFluentHandler.emit
1,890
def optimize(self, optimizer=None, start=None, **kwargs): self._IN_OPTIMIZATION_ = True if self.mpi_comm==None: super(SSMRD, self).optimize(optimizer,start,**kwargs) elif self.mpi_comm.rank==0: super(SSMRD, self).optimize(optimizer,start,**kwargs) self.mpi_com...
ValueError
dataset/ETHPy150Open SheffieldML/GPy/GPy/models/ss_mrd.py/SSMRD.optimize
1,891
def _clear_static(self): try: shutil.rmtree(settings.STATIC_ROOT) except (OSError, __HOLE__): pass
IOError
dataset/ETHPy150Open sergei-maertens/django-systemjs/tests/tests/test_management.py/ClearStaticMixin._clear_static
1,892
def handle(self, *args, **options): try: username = args[0] except __HOLE__: raise CommandError(_("You must provide the username to publish the" " form to.")) # make sure user exists try: User.objects.get(username=u...
IndexError
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/logger/management/commands/restore_backup.py/Command.handle
1,893
def saveTrace(self, trace, traceFile, dataFileName = None, dataFileFormat = "rvct", frameMarkers = [], initFuncName = "init", uninitFuncName = "uninit", playFuncName = "play", ...
ValueError
dataset/ETHPy150Open skyostil/tracy/src/analyzer/plugins/core/CSourceFormat.py/CSourceExporterPlugin.saveTrace
1,894
def handle(self, *args, **options): try: do_adduser(args[0], args[1]) msg = 'Adding {user} to {group}\n'.format(user=args[0], group=args[1]) self.log.info(msg) self.stdout.write(msg) except __HOLE__: ...
IndexError
dataset/ETHPy150Open mozilla/addons-server/src/olympia/zadmin/management/commands/addusertogroup.py/Command.handle
1,895
def _preprocess_kwargs(self, initial_kwargs): """ Replace generic key related attribute with filters by object_id and content_type fields """ kwargs = initial_kwargs.copy() generic_key_related_kwargs = self._get_generic_key_related_kwargs(initial_kwargs) for key, value in generic_key_rel...
IndexError
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/core/managers.py/GenericKeyMixin._preprocess_kwargs
1,896
def save(data, name=None): if name is None: name = data.filename data = data.read() datafile = StringIO(data) if ext.resizer: try: images = ext.resizer.resize_image(datafile) except __HOLE__: # Not an image. return save_file(name, data) ...
IOError
dataset/ETHPy150Open FelixLoether/flask-image-upload-thing/flask_uploads/functions.py/save
1,897
def next(self): # check if all iterators exhausted if not any(self.it): raise StopIteration # yield all that correspond to target key and update result = [] targetkey = self.targetkey updated = 0 for x, y in enumerate(self.current): key,...
StopIteration
dataset/ETHPy150Open CGATOxford/cgat/scripts/diff_bam.py/multiway_groupby.next
1,898
def get_template_sources(template_name, template_dirs=None): if not hasattr(gsettings.threadlocal, "theme"): print "get_template_sources no threadlocal" return theme = gsettings.threadlocal.theme + "/" if not template_dirs: template_dirs = settings.TEMPLATE_DIRS for template_dir...
ValueError
dataset/ETHPy150Open amitu/gitology/src/gitology/d/themed_template_loader.py/get_template_sources
1,899
def load_template_source(template_name, template_dirs=None): tried = [] for filepath in get_template_sources(template_name, template_dirs): try: return (open(filepath).read().decode(settings.FILE_CHARSET), filepath) except __HOLE__: tried.append(filepath) if tried: ...
IOError
dataset/ETHPy150Open amitu/gitology/src/gitology/d/themed_template_loader.py/load_template_source