Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
7,000
def get_case_transactions(case_id, updated_xforms=None): """ This fetches all the transactions required to rebuild the case along with all the forms for those transactions. For any forms that have been updated it replaces the old form with the new one. :param case_id: ID of case to rebuild ...
KeyError
dataset/ETHPy150Open dimagi/commcare-hq/corehq/form_processor/backends/sql/processor.py/get_case_transactions
7,001
def match(self, v2): """Assert two values are equivalent. NOTE: If you don't care (or don't know) a given value, you can specify the string DONTCARE as the value. This will cause that item to be skipped. """ try: error = abs(float(self....
ValueError
dataset/ETHPy150Open openstack/ec2-api/ec2api/tests/unit/matchers.py/ValueMatches.match
7,002
def parse(self, lines): missing = [] packages = {} for line in lines: try: req = pkg_resources.parse_requirements(line.strip()).next() except ValueError: missing.append(line) continue except __HOLE__: ...
StopIteration
dataset/ETHPy150Open rocketDuck/folivora/folivora/utils/parsers.py/PipRequirementsParser.parse
7,003
def print_success_message(message): """Print a message indicating success in green color to STDOUT. :param message: the message to print :type message: :class:`str` """ try: import colorama print(colorama.Fore.GREEN + message + colorama.Fore.RESET) except __HOLE__: print...
ImportError
dataset/ETHPy150Open calvinschmdt/EasyTensorflow/setup.py/print_success_message
7,004
def print_failure_message(message): """Print a message indicating failure in red color to STDERR. :param message: the message to print :type message: :class:`str` """ try: import colorama print(colorama.Fore.RED + message + colorama.Fore.RESET, file=sys.stderr) exc...
ImportError
dataset/ETHPy150Open calvinschmdt/EasyTensorflow/setup.py/print_failure_message
7,005
def _load_tracker_uri_from_file(self): f = None try: f = open(self.tracker_file_name, 'r') uri = f.readline().strip() self._set_tracker_uri(uri) except __HOLE__, e: # Ignore non-existent file (happens first time an upload # is attempted...
IOError
dataset/ETHPy150Open radlab/sparrow/deploy/third_party/boto-2.1.1/boto/gs/resumable_upload_handler.py/ResumableUploadHandler._load_tracker_uri_from_file
7,006
def _save_tracker_uri_to_file(self): """ Saves URI to tracker file if one was passed to constructor. """ if not self.tracker_file_name: return f = None try: f = open(self.tracker_file_name, 'w') f.write(self.tracker_uri) except ...
IOError
dataset/ETHPy150Open radlab/sparrow/deploy/third_party/boto-2.1.1/boto/gs/resumable_upload_handler.py/ResumableUploadHandler._save_tracker_uri_to_file
7,007
def build_resource_for_web_client(hs): webclient_path = hs.get_config().web_client_location if not webclient_path: try: import syweb except __HOLE__: quit_with_error( "Could not find a webclient.\n\n" "Please either install the matrix-angul...
ImportError
dataset/ETHPy150Open matrix-org/synapse/synapse/app/homeserver.py/build_resource_for_web_client
7,008
def change_resource_limit(soft_file_no): try: soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE) if not soft_file_no: soft_file_no = hard resource.setrlimit(resource.RLIMIT_NOFILE, (soft_file_no, hard)) logger.info("Set file limit to: %d", soft_file_no) re...
ValueError
dataset/ETHPy150Open matrix-org/synapse/synapse/app/homeserver.py/change_resource_limit
7,009
def main(main_func, args=None, kwargs=None): if os.environ.get("RUN_MAIN") == "true": if args is None: args = () if kwargs is None: kwargs = {} thread.start_new_thread(main_func, args, kwargs) try: reloader_thread() except __HOLE__: ...
KeyboardInterrupt
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/autoreload.py/main
7,010
def _ensure_console_pid_dir_exists(): """Ensure that the console PID directory exists Checks that the directory for the console PID file exists and if not, creates it. :raises: ConsoleError if the directory doesn't exist and cannot be created """ dir = _get_console_pid_dir() if not os.pat...
OSError
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/console_utils.py/_ensure_console_pid_dir_exists
7,011
def _get_console_pid(node_uuid): """Get the terminal process id from pid file.""" pid_path = _get_console_pid_file(node_uuid) try: with open(pid_path, 'r') as f: pid_str = f.readline() return int(pid_str) except (IOError, __HOLE__): raise exception.NoConsolePid(p...
ValueError
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/console_utils.py/_get_console_pid
7,012
def _stop_console(node_uuid): """Close the serial console for a node Kills the console process and deletes the PID file. :param node_uuid: the UUID of the node :raises: NoConsolePid if no console PID was found :raises: ConsoleError if unable to stop the console process """ try: co...
OSError
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/console_utils.py/_stop_console
7,013
def start_shellinabox_console(node_uuid, port, console_cmd): """Open the serial console for a node. :param node_uuid: the uuid for the node. :param port: the terminal port for the node. :param console_cmd: the shell command that gets the console. :raises: ConsoleError if the directory for the PID f...
ValueError
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/console_utils.py/start_shellinabox_console
7,014
def clean(self, value): from in_states import STATES_NORMALIZED super(INStateField, self).clean(value) if value in EMPTY_VALUES: return u'' try: value = value.strip().lower() except __HOLE__: pass else: try: ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/localflavor/in_/forms.py/INStateField.clean
7,015
def _iterate_items(self): with self.mutex: for k in self: try: yield (k, self.data[k]) except __HOLE__: # pragma: no cover pass
KeyError
dataset/ETHPy150Open celery/kombu/kombu/utils/functional.py/LRUCache._iterate_items
7,016
def _iterate_values(self): with self.mutex: for k in self: try: yield self.data[k] except __HOLE__: # pragma: no cover pass
KeyError
dataset/ETHPy150Open celery/kombu/kombu/utils/functional.py/LRUCache._iterate_values
7,017
def memoize(maxsize=None, keyfun=None, Cache=LRUCache): def _memoize(fun): mutex = threading.Lock() cache = Cache(limit=maxsize) @wraps(fun) def _M(*args, **kwargs): if keyfun: key = keyfun(args, kwargs) else: key = args + (KE...
KeyError
dataset/ETHPy150Open celery/kombu/kombu/utils/functional.py/memoize
7,018
@lazy_import def pickle(): try: import cPickle as pickle except __HOLE__: import pickle return pickle
ImportError
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/pickle
7,019
@lazy_import def threading(): try: import threading except __HOLE__: threading = None return threading
ImportError
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/threading
7,020
@allow_from_sudo() def lock(self, num_retries=0): """Lock the application directory for exclusive write access. If the appdir is already locked by another process/thread then EskyLockedError is raised. There is no way to perform a blocking lock on an appdir. Locking is ach...
AttributeError
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/Esky.lock
7,021
@allow_from_sudo() def unlock(self): """Unlock the application directory for exclusive write access.""" if self.sudo_proxy is not None: return self.sudo_proxy.unlock() self._lock_count -= 1 if self._lock_count == 0: if threading: curthread = th...
AttributeError
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/Esky.unlock
7,022
@allow_from_sudo() def cleanup(self): """Perform cleanup tasks in the app directory. This includes removing older versions of the app and completing any failed update attempts. Such maintenance is not done automatically since it can take a non-negligible amount of time. If...
StopIteration
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/Esky.cleanup
7,023
def _version_manifest(self, vdir): """Get the bootstrap manifest for the given version directory. This is the set of files/directories that the given version expects to be in the main app directory. """ vsdir = self._get_versions_dir() mpath = os.path.join(vsdir, vdir, E...
IOError
dataset/ETHPy150Open cloudmatrix/esky/esky/__init__.py/Esky._version_manifest
7,024
def testAssertDictEqual(self): self.assertDictEqual({}, {}) c = {'x': 1} d = {} self.assertRaises(basetest.TestCase.failureException, self.assertDictEqual, c, d) d.update(c) self.assertDictEqual(c, d) d['x'] = 0 self.assertRaises(basetest.TestCase.failureExceptio...
AssertionError
dataset/ETHPy150Open google/google-apputils/tests/basetest_test.py/GoogleTestBaseUnitTest.testAssertDictEqual
7,025
def testAssertTotallyOrdered(self): # Valid. self.assertTotallyOrdered() self.assertTotallyOrdered([1]) self.assertTotallyOrdered([1], [2]) self.assertTotallyOrdered([1, 1, 1]) self.assertTotallyOrdered([(1, 1)], [(1, 2)], [(2, 1)]) if PY_VERSION_2: # In Python 3 comparing different ty...
AttributeError
dataset/ETHPy150Open google/google-apputils/tests/basetest_test.py/GoogleTestBaseUnitTest.testAssertTotallyOrdered
7,026
def get_from_location_by_extension(resource, location, extension, version=None): try: found_files = [os.path.join(location, f) for f in os.listdir(location)] except __HOLE__: return None try: return get_from_list_by_extension(resource, found_files, extension, version) except Reso...
OSError
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/resource_getters/standard.py/get_from_location_by_extension
7,027
def get_plugin_object(self): """For the selected plugin, returns a tuple of the module name to import and the class name to construct in order to get a Camera object.""" # Find the selected plugin plugin_id = self.cameras[self.camera_selection][0] # This should not fail,...
ImportError
dataset/ETHPy150Open ptomato/Beams/beams/CameraDialog.py/CameraDialog.get_plugin_object
7,028
def __init__(self, **traits): super(CameraDialog, self).__init__(**traits) # Load the plugins self.plugins = pkg_resources.get_entry_map('beams', 'camera_plugins') if 'dummy' not in self.plugins.keys(): raise IOError("Plugin directory isn't configured properly") # ...
ValueError
dataset/ETHPy150Open ptomato/Beams/beams/CameraDialog.py/CameraDialog.__init__
7,029
def _cameras_default(self): # Construct list store of plugins retval = [] for plugin in self.plugins.keys(): try: info = self.plugins[plugin].load().plugin_info except __HOLE__: # A required module was not found for that plugin, ignore it ...
ImportError
dataset/ETHPy150Open ptomato/Beams/beams/CameraDialog.py/CameraDialog._cameras_default
7,030
def select_fallback(self): """Select the dummy plugin as a fallback""" try: self._select_plugin_by_name('dummy') except __HOLE__: assert 0, 'Dummy plugin was not in list. Should not happen.'
ValueError
dataset/ETHPy150Open ptomato/Beams/beams/CameraDialog.py/CameraDialog.select_fallback
7,031
def readline(self, *args, **kwargs): try: row = list(self.data.next()) except __HOLE__: if self.verbose: print('') return '' else: self.processor(self.table, row) try: ...
StopIteration
dataset/ETHPy150Open philipsoutham/py-mysql2pgsql/mysql2pgsql/lib/postgres_db_writer.py/PostgresDbWriter.FileObjFaker.readline
7,032
def import_string(import_name, silent=False): """Imports an object based on a string. If *silent* is True the return value will be None if the import fails. Simplified version of the function with same name from `Werkzeug`_. :param import_name: The dotted name for the object to import. :pa...
ImportError
dataset/ETHPy150Open disqus/nydus/nydus/utils.py/import_string
7,033
def _git_version(): curdir = os.getcwd() filedir, _ = op.split(__file__) os.chdir(filedir) try: fnull = open(os.devnull, 'w') version = ('-git-' + subprocess.check_output( ['git', 'describe', '--abbrev=8', '--dirty', '--always', '--tags'], ...
OSError
dataset/ETHPy150Open kwikteam/phy/phy/utils/_misc.py/_git_version
7,034
def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'): """ Similar to smart_unicode, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects. """ if strings_only and isinsta...
UnicodeDecodeError
dataset/ETHPy150Open ericw/onelinr/onelinr.py/force_unicode
7,035
def __get__(self, obj, objtype=None): if obj is None: return self if not obj.data: return obj.default try: return getattr(obj, self.internal_name) except __HOLE__: setattr(obj, self.internal_name, self.func(obj)) return getattr(...
AttributeError
dataset/ETHPy150Open mahmoud/boltons/boltons/statsutils.py/_StatsProperty.__get__
7,036
def __call__(self, *args): try: return self.cache[args] except KeyError: value = self.func(*args) self.cache[args] = value return value except __HOLE__: # uncachable -- for instance, passing a list as an argument. # Better t...
TypeError
dataset/ETHPy150Open tanghaibao/jcvi/utils/cbook.py/memoized.__call__
7,037
def __getitem__(self, item): try: return dict.__getitem__(self, item) except __HOLE__: value = self[item] = type(self)() return value
KeyError
dataset/ETHPy150Open tanghaibao/jcvi/utils/cbook.py/AutoVivification.__getitem__
7,038
@post_only def vote(request): # The type of object we're voting on, can be 'submission' or 'comment' vote_object_type = request.POST.get('what', None) # The ID of that object as it's stored in the database, positive int vote_object_id = request.POST.get('what_id', None) # The value of the vote we'...
TypeError
dataset/ETHPy150Open Nikola-K/django_reddit/reddit/views.py/vote
7,039
def add_related_update(self, model, field, value): """ Adds (name, value) to an update query for an ancestor model. Updates are coalesced so that we only run one update query per ancestor. """ try: self.related_updates[model].append((field, None, value)) exce...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/models/sql/subqueries.py/UpdateQuery.add_related_update
7,040
def launch_tor(config, reactor, tor_binary=None, progress_updates=None, connection_creator=None, timeout=None, kill_on_stderr=True, stdout=None, stderr=None): """launches a new Tor process with the given config. There may...
RuntimeError
dataset/ETHPy150Open meejah/txtorcon/txtorcon/torconfig.py/launch_tor
7,041
def __getattr__(self, name): ''' FIXME can't we just move this to @property decorated methods instead? ''' # For stealth authentication, the .onion is per-client. So in # that case, we really have no choice here -- we can't have # "a" hostname. So we just barf; i...
IOError
dataset/ETHPy150Open meejah/txtorcon/txtorcon/torconfig.py/HiddenService.__getattr__
7,042
def bootstrap(self, arg=None): ''' This only takes args so it can be used as a callback. Don't pass an arg, it is ignored. ''' try: self.protocol.add_event_listener( 'CONF_CHANGED', self._conf_changed) except __HOLE__: # for Tor ver...
RuntimeError
dataset/ETHPy150Open meejah/txtorcon/txtorcon/torconfig.py/TorConfig.bootstrap
7,043
@jit.elidable def _lookup(self, sym, version): try: return self.bindings[sym] except __HOLE__: raise SchemeException("toplevel variable %s not found" % sym.variable_name())
KeyError
dataset/ETHPy150Open samth/pycket/pycket/env.py/ToplevelEnv._lookup
7,044
def add_client(self, client_name, redirect_uri): """Adds a client application to the database, with its client name and redirect URI. It returns the generated client_id and client_secret """ try: self.db.clients except __HOLE__: self.create_tables...
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.add_client
7,045
def get_client_credentials(self, client_id): """Gets the client credentials by the client application ID given.""" try: return self.db.clients(client_id) except __HOLE__: self.create_tables() return None
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.get_client_credentials
7,046
def valid_code(self, client_id, code): """Validates if a code is (still) a valid one. It takes two arguments: * The client application ID * The temporary code given by the application It returns True if the code is valid. Otherwise, False """ try: dat...
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.valid_code
7,047
def exists_code(self, code): """Checks if a given code exists on the database or not""" try: self.db.codes(self.db.codes.code_id == code).select().first() != None except __HOLE__: self.create_tables() return False
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.exists_code
7,048
def get_user_id(self, client_id, code): """Gets the user ID, given a client application ID and a temporary authentication code """ try: return self.db.codes(self.db.codes.code_id == code).select(self.db.codes.user_id).first() except __HOLE__: self.create_t...
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.get_user_id
7,049
def get_access_token(self, access_token): """Returns the token data, if the access token exists""" try: return self.db(self.db.tokens.access_token == access_token).select().first() except __HOLE__: self.create_tables() return None
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.get_access_token
7,050
def get_refresh_token(self, refresh_token): """Returns the token data, if the refresh token exists""" try: return self.db.tokens(self.db.tokens.refresh_token == refresh_token).select().first() # 'code' == 'refresh_token', right? [pid that is] except __HOLE__: self.c...
AttributeError
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.get_refresh_token
7,051
def invoke(self, args): if args.static: print(settings.bokehjsdir()) else: try: import IPython ipy_version = IPython.__version__ except __HOLE__: ipy_version = "Not installed" print("Python version : %s...
ImportError
dataset/ETHPy150Open bokeh/bokeh/bokeh/command/subcommands/info.py/Info.invoke
7,052
def render_paginate(request, template, objects, per_page, extra_context={}): """ Paginated list of objects. """ paginator = Paginator(objects, per_page) page = request.GET.get('page', 1) get_params = '&'.join(['%s=%s' % (k, request.GET[k]) for k in request.GET if k != ...
ValueError
dataset/ETHPy150Open aisayko/Django-tinymce-filebrowser/mce_filebrowser/utils.py/render_paginate
7,053
def get_connection(backend=None, fail_silently=False, **kwds): """Load an email backend and return an instance of it. If backend is None (default) settings.EMAIL_BACKEND is used. Both fail_silently and other keyword arguments are used in the constructor of the backend. """ path = backend or se...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/core/mail/__init__.py/get_connection
7,054
def _check_extra_specs(self, specs): if type(specs) is not dict: msg = _('Bad extra_specs provided') raise exc.HTTPBadRequest(explanation=msg) try: flavors.validate_extra_spec_keys(specs.keys()) except __HOLE__: msg = _("Fail to validate provided ...
TypeError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/flavorextraspecs.py/FlavorExtraSpecsController._check_extra_specs
7,055
def show(self, req, flavor_id, id): """Return a single extra spec item.""" context = req.environ['nova.context'] authorize(context, action='show') flavor = common.get_flavor(context, flavor_id) try: return {id: flavor.extra_specs[id]} except __HOLE__: ...
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/flavorextraspecs.py/FlavorExtraSpecsController.show
7,056
def delete(self, req, flavor_id, id): """Deletes an existing extra spec.""" context = req.environ['nova.context'] authorize(context, action='delete') flavor = common.get_flavor(context, flavor_id) try: del flavor.extra_specs[id] flavor.save() exce...
KeyError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/flavorextraspecs.py/FlavorExtraSpecsController.delete
7,057
def __call__(self, *args): try: return self.cache[args] except __HOLE__: result = self.func(*args) self.cache[args] = result return result
KeyError
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/common.py/memoize.__call__
7,058
def WriteOnDiff(filename): """Write to a file only if the new contents differ. Arguments: filename: name of the file to potentially write to. Returns: A file like object which will write to temporary file and only overwrite the target if it differs (on close). """ class Writer(object): """Wr...
OSError
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/common.py/WriteOnDiff
7,059
def EnsureDirExists(path): """Make sure the directory for |path| exists.""" try: os.makedirs(os.path.dirname(path)) except __HOLE__: pass
OSError
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/common.py/EnsureDirExists
7,060
def run(self): import os, sys try: import pyflakes.scripts.pyflakes as flakes except __HOLE__: print "Audit requires PyFlakes installed in your system.""" sys.exit(-1) warns = 0 # Define top-level directories dirs = ('flask', 'examples...
ImportError
dataset/ETHPy150Open tokuda109/flask-docs-ja/setup.py/run_audit.run
7,061
def topological_sort(G): """Return a generator of nodes in topologically sorted order. A topological sort is a nonunique permutation of the nodes such that an edge from u to v implies that u appears before v in the topological sort order. Parameters ---------- G : NetworkX digraph ...
KeyError
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/dag.py/topological_sort
7,062
def lexicographical_topological_sort(G, key=None): """Return a generator of nodes in lexicographically topologically sorted order. A topological sort is a nonunique permutation of the nodes such that an edge from u to v implies that u appears before v in the topological sort order. Parameters ...
KeyError
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/dag.py/lexicographical_topological_sort
7,063
def get_notification_language(user): """ Returns site-specific notification language for this user. Raises LanguageStoreNotAvailable if this site does not use translated notifications. """ if getattr(settings, "NOTIFICATION_LANGUAGE_MODULE", False): try: app_label, model_name...
ImportError
dataset/ETHPy150Open amarandon/smeuhsocial/apps/notification/models.py/get_notification_language
7,064
def __call__(self, cutpoint_function): if isgeneratorfunction(cutpoint_function): if PY3: from aspectlib.py3support import decorate_advising_generator_py3 return decorate_advising_generator_py3(self.advising_function, cutpoint_function, self.bind) else: ...
StopIteration
dataset/ETHPy150Open ionelmc/python-aspectlib/src/aspectlib/__init__.py/Aspect.__call__
7,065
def weave(target, aspects, **options): """ Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. ...
ImportError
dataset/ETHPy150Open ionelmc/python-aspectlib/src/aspectlib/__init__.py/weave
7,066
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options): """ Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original ...
AttributeError
dataset/ETHPy150Open ionelmc/python-aspectlib/src/aspectlib/__init__.py/patch_module
7,067
def deployment_table(deployments): """Returns a PrettyTable representation of the provided marathon deployments. :param deployments: deployments to render :type deployments: [dict] :rtype: PrettyTable """ def get_action(deployment): multiple_apps = len({action['app'] ...
KeyError
dataset/ETHPy150Open dcos/dcos-cli/cli/dcoscli/tables.py/deployment_table
7,068
def __del__(self): try: self._driver.destroy() except (AttributeError, __HOLE__): pass
TypeError
dataset/ETHPy150Open parente/pyttsx/pyttsx/driver.py/DriverProxy.__del__
7,069
def stop(self): ''' Called by the engine to stop the current utterance and clear the queue of commands. ''' # clear queue up to first end loop command while(True): try: mtd, args, name = self._queue[0] except __HOLE__: ...
IndexError
dataset/ETHPy150Open parente/pyttsx/pyttsx/driver.py/DriverProxy.stop
7,070
def iterate(self): ''' Called by the engine to iterate driver commands and notifications from within an external event loop. ''' try: self._iterator.next() except __HOLE__: pass
StopIteration
dataset/ETHPy150Open parente/pyttsx/pyttsx/driver.py/DriverProxy.iterate
7,071
def __getitem__(self, key): key = '_reserved_' + key if key in self._special_fields else key try: return getattr(self, key) except __HOLE__: raise KeyError(key)
AttributeError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/StrictDict.__getitem__
7,072
def get(self, key, default=None): try: return self[key] except __HOLE__: return default
KeyError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/StrictDict.get
7,073
def pop(self, key, default=None): v = self.get(key, default) try: delattr(self, key) except __HOLE__: pass return v
AttributeError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/StrictDict.pop
7,074
def __getattr__(self, attr): try: super(SemiStrictDict, self).__getattr__(attr) except __HOLE__: try: return self.__getattribute__('_extras')[attr] except KeyError as e: raise AttributeError(e)
AttributeError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/SemiStrictDict.__getattr__
7,075
def __setattr__(self, attr, value): try: super(SemiStrictDict, self).__setattr__(attr, value) except __HOLE__: try: self._extras[attr] = value except AttributeError: self._extras = {attr: value}
AttributeError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/SemiStrictDict.__setattr__
7,076
def __delattr__(self, attr): try: super(SemiStrictDict, self).__delattr__(attr) except AttributeError: try: del self._extras[attr] except __HOLE__ as e: raise AttributeError(e)
KeyError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/SemiStrictDict.__delattr__
7,077
def __iter__(self): try: extras_iter = iter(self.__getattribute__('_extras')) except __HOLE__: extras_iter = () return itertools.chain(super(SemiStrictDict, self).__iter__(), extras_iter)
AttributeError
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/base/datastructures.py/SemiStrictDict.__iter__
7,078
def _build_preprocessed_function(func, processors, args_defaults, varargs, varkw): """ Build a preprocessed function with the same signature as `func`. Uses `exec` internally ...
AttributeError
dataset/ETHPy150Open quantopian/zipline/zipline/utils/preprocess.py/_build_preprocessed_function
7,079
def send_private_file(path): path = os.path.join(frappe.local.conf.get('private_path', 'private'), path.strip("/")) filename = os.path.basename(path) if frappe.local.request.headers.get('X-Use-X-Accel-Redirect'): path = '/protected/' + path response = Response() response.headers[b'X-Accel-Redirect'] = frappe....
IOError
dataset/ETHPy150Open frappe/frappe/frappe/utils/response.py/send_private_file
7,080
def search_results_sorted(self, key, document_list, reverse=False): """ Sorting method of DMS search. Sorts documents making query of required data by itself from CouchDB. Appends documents that have no key to the end of the list in uncontrolled order. e.g. order they appear in ...
TypeError
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/core/search.py/DMSSearchManager.search_results_sorted
7,081
def parse_melody(fullMeasureNotes, fullMeasureChords): # Remove extraneous elements.x measure = copy.deepcopy(fullMeasureNotes) chords = copy.deepcopy(fullMeasureChords) measure.removeByNotOfClass([note.Note, note.Rest]) chords.removeByNotOfClass([chord.Chord]) # Information for the start of th...
IndexError
dataset/ETHPy150Open jisungk/deepjazz/grammar.py/parse_melody
7,082
def unparse_grammar(m1_grammar, m1_chords): m1_elements = stream.Voice() currOffset = 0.0 # for recalculate last chord. prevElement = None for ix, grammarElement in enumerate(m1_grammar.split(' ')): terms = grammarElement.split(',') currOffset += float(terms[1]) # works just fine ...
IndexError
dataset/ETHPy150Open jisungk/deepjazz/grammar.py/unparse_grammar
7,083
def handle(self, *args, **options): from django.conf import settings from django.utils import translation # Activate the current language, because it won't get activated later. try: translation.activate(settings.LANGUAGE_CODE) except __HOLE__: pass ...
AttributeError
dataset/ETHPy150Open lincolnloop/django-cpserver/django_cpserver/management/commands/runcpserver.py/Command.handle
7,084
def get_uid_gid(uid, gid=None): """Try to change UID and GID to the provided values. UID and GID are given as names like 'nobody' not integer. Src: http://mail.mems-exchange.org/durusmail/quixote-users/4940/1/ """ import pwd, grp uid, default_grp = pwd.getpwnam(uid)[2:4] if gid is None: ...
KeyError
dataset/ETHPy150Open lincolnloop/django-cpserver/django_cpserver/management/commands/runcpserver.py/get_uid_gid
7,085
def poll_process(pid): """ Poll for process with given pid up to 10 times waiting .25 seconds in between each poll. Returns False if the process no longer exists otherwise, True. """ for n in range(10): time.sleep(0.25) try: # poll the process state os.kill(p...
OSError
dataset/ETHPy150Open lincolnloop/django-cpserver/django_cpserver/management/commands/runcpserver.py/poll_process
7,086
def stop_server(pidfile): """ Stop process whose pid was written to supplied pidfile. First try SIGTERM and if it fails, SIGKILL. If process is still running, an exception is raised. """ if os.path.exists(pidfile): pid = int(open(pidfile).read()) try: os.kill(pid, signal...
OSError
dataset/ETHPy150Open lincolnloop/django-cpserver/django_cpserver/management/commands/runcpserver.py/stop_server
7,087
def start_server(options): """ Start CherryPy server """ if options['daemonize'] and options['server_user'] and options['server_group']: #ensure the that the daemon runs as specified user change_uid_gid(options['server_user'], options['server_group']) from cherrypy.wsgiserv...
KeyboardInterrupt
dataset/ETHPy150Open lincolnloop/django-cpserver/django_cpserver/management/commands/runcpserver.py/start_server
7,088
def execute(): for user in frappe.get_all("User"): username = user["name"] bookmarks = frappe.db.get_default("_bookmarks", username) if not bookmarks: continue if isinstance(bookmarks, basestring): bookmarks = json.loads(bookmarks) for opts in bookmarks: route = (opts.get("route") or "").strip("#...
ValueError
dataset/ETHPy150Open frappe/frappe/frappe/patches/v5_0/bookmarks_to_stars.py/execute
7,089
def find(self, obj, name=None, module=None, globs=None, extraglobs=None): """ Return a list of the DocTests that are defined by the given object's docstring, or by any of its contained objects' docstrings. The optional parameter `module` is the module that contains ...
TypeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/test/_doctest.py/DocTestFinder.find
7,090
def _get_test(self, obj, name, module, globs, source_lines): """ Return a DocTest for the given object, if it defines a docstring; otherwise, return None. """ # Extract the object's docstring. If it doesn't have one, # then return None (no test for this object). ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/test/_doctest.py/DocTestFinder._get_test
7,091
def __run(self, test, compileflags, out): """ Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. R...
KeyboardInterrupt
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/test/_doctest.py/DocTestRunner.__run
7,092
def start_program(name): program = Program(name) # Remove base logging handlers, this is read from the log files that are # set up after the start method logger = logging.getLogger('chalmers') logger.handlers = [] logger.handlers.append(logging.NullHandler()) try: program.start(daemo...
KeyboardInterrupt
dataset/ETHPy150Open Anaconda-Platform/chalmers/chalmers/utils/mutiplex_io_pool.py/start_program
7,093
def printer_loop(self): colors = ColorPicker() sleep_time = SLEEP_START try: while not self.finished: seen_data = False for name, fd in list(self.watched): data = fd.readline() while data: ...
IOError
dataset/ETHPy150Open Anaconda-Platform/chalmers/chalmers/utils/mutiplex_io_pool.py/MultiPlexIOPool.printer_loop
7,094
def handle(self, *args, **kwargs): self.docs_dir = os.path.join( settings.REPO_DIR, 'docs' ) self.target_path = os.path.join(self.docs_dir, 'filingforms.rst') group_dict = {} for form in all_filing_forms: try: group_dict[form...
KeyError
dataset/ETHPy150Open california-civic-data-coalition/django-calaccess-raw-data/example/toolbox/management/commands/createcalaccessrawformdocs.py/Command.handle
7,095
def _Interactive(self, opt, args): all = filter(lambda x: x.IsDirty(), self.GetProjects(args)) if not all: print >>sys.stderr,'no projects have uncommitted modifications' return out = _ProjectList(self.manifest.manifestProject.config) while True: out.header(' %s', 'project') ...
KeyboardInterrupt
dataset/ETHPy150Open android/tools_repo/subcmds/stage.py/Stage._Interactive
7,096
def get_file_size(file_obj): """ Analyze file-like object and attempt to determine its size. :param file_obj: file-like object. :retval The file's size or None if it cannot be determined. """ if hasattr(file_obj, 'seek') and hasattr(file_obj, 'tell'): try: curr = file_obj.te...
IOError
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/file_proxy.py/get_file_size
7,097
def copy_cover(self, file_id, new_file_id): try: data, metadata = self.load(file_id, 'cover') with open(self._get_filename(new_file_id, 'cover'), "w") as f: f.write(data) except __HOLE__: # Cover not existing pass
IOError
dataset/ETHPy150Open Net-ng/kansha/kansha/services/simpleassetsmanager/simpleassetsmanager.py/SimpleAssetsManager.copy_cover
7,098
def save(self, data, file_id=None, metadata={}, THUMB_SIZE=()): if file_id is None: file_id = unicode(uuid.uuid4()) with open(self._get_filename(file_id), "w") as f: f.write(data) # Store metadata with open(self._get_metadata_filename(file_id), "w") as f: ...
IOError
dataset/ETHPy150Open Net-ng/kansha/kansha/services/simpleassetsmanager/simpleassetsmanager.py/SimpleAssetsManager.save
7,099
def delete(self, file_id): files = [self._get_filename(file_id), self._get_filename(file_id, 'thumb'), self._get_filename(file_id, 'medium'), self._get_filename(file_id, 'cover'), self._get_filename(file_id, 'large'), self._get...
OSError
dataset/ETHPy150Open Net-ng/kansha/kansha/services/simpleassetsmanager/simpleassetsmanager.py/SimpleAssetsManager.delete