Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
5,300
def emit(self, record): """ Emit a record. Pickles the record and writes it to the socket in binary format. If there is an error with the socket, silently drop the packet. If there was a problem with the socket, re-establishes the socket. """ try: ...
SystemExit
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/SocketHandler.emit
5,301
def emit(self, record): """ Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. """ msg = self.format(record) """ We need to convert record level to lowercase, mayb...
KeyboardInterrupt
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/SysLogHandler.emit
5,302
def emit(self, record): """ Emit a record. Format the record and send it to the specified addressees. """ try: import smtplib try: from email.Utils import formatdate except: formatdate = self.date_time ...
SystemExit
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/SMTPHandler.emit
5,303
def __init__(self, appname, dllname=None, logtype="Application"): logging.Handler.__init__(self) try: import win32evtlogutil, win32evtlog self.appname = appname self._welu = win32evtlogutil if not dllname: dllname = os.path.split(self._welu...
ImportError
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/NTEventLogHandler.__init__
5,304
def emit(self, record): """ Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log. """ if self._welu: try: id = self.getMessageID(record) cat = self.getEventCategory(re...
KeyboardInterrupt
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/NTEventLogHandler.emit
5,305
def emit(self, record): """ Emit a record. Send the record to the Web server as an URL-encoded dictionary """ try: import httplib, urllib host = self.host h = httplib.HTTP(host) url = self.url data = urllib.urlencode(se...
SystemExit
dataset/ETHPy150Open babble/babble/include/jython/Lib/logging/handlers.py/HTTPHandler.emit
5,306
def handle_service_message(self): """Handles incoming service messages from supervisor socket""" try: serialized_request = self.remote_control_socket.recv_multipart(flags=zmq.NOBLOCK)[0] except zmq.ZMQError as e: if e.errno == zmq.EAGAIN: return i...
KeyError
dataset/ETHPy150Open oleiade/Elevator/elevator/backend/worker.py/Worker.handle_service_message
5,307
def test_iteration(self): nsm = message.NamespaceMap() uripat = 'http://example.com/foo%r' nsm.add(uripat%0) for n in range(1,23): self.failUnless(uripat%(n-1) in nsm) self.failUnless(nsm.isDefined(uripat%(n-1))) nsm.add(uripat%n) for (uri, a...
StopIteration
dataset/ETHPy150Open adieu/python-openid/openid/test/test_message.py/NamespaceMapTest.test_iteration
5,308
def Decode(self, encoded_data): """Decode the encoded data. Args: encoded_data: a byte string containing the encoded data. Returns: A tuple containing a byte string of the decoded data and the remaining encoded data. Raises: BackEndError: if the base32 stream cannot be decoded...
TypeError
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/encoding/base32_decoder.py/Base32Decoder.Decode
5,309
def get_indexes(self): #from hyperadmin.resources.indexes import Index from hyperadmin.resources.models.filters import FieldFilter, SearchFilter from django.db import models from django.contrib.admin.util import get_fields_from_path try: from django.contrib.admin.uti...
ImportError
dataset/ETHPy150Open zbyte64/django-hyperadmin/hyperadmin/resources/models/resources.py/BaseModelResource.get_indexes
5,310
def test_axes(): try: import matplotlib version = matplotlib.__version__.split("-")[0] version = version.split(".")[:2] if [int(_) for _ in version] < [0,99]: raise ImportError import pylab except __HOLE__: print("\nSkipping test (pylab not available o...
ImportError
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/tests/test_visualization.py/test_axes
5,311
def run(self): data = {'state': 'unknown'} try: proc = subprocess.Popen( ['sudo', '/opt/MegaRAID/MegaCli/MegaCli64', '-LDInfo', '-Lall', '-aALL'], stdout=subprocess.PIPE, close_fds=True) output = proc.communicate(...
OSError
dataset/ETHPy150Open serverdensity/sd-agent-plugins/MegaRAID/MegaRAID.py/MegaRAID.run
5,312
def load(self): try: context = self.fmt_module.load(open(self.configfile, 'r')) except __HOLE__, error: raise ValueError( 'loading configuration file: {} ({})'.format( error, self.configfile)) return context
IOError
dataset/ETHPy150Open intuition-io/insights/insights/contexts/file.py/FileContext.load
5,313
def buffer_to_value(self, obj, buffer, offset, default_endianness=DEFAULT_ENDIANNESS): """ Converts the bytes in ``buffer`` at ``offset`` to a native Python value. Returns that value and the number of bytes consumed to create it. :param obj: The parent :class:`.PebblePacket` of this fie...
ValueError
dataset/ETHPy150Open pebble/libpebble2/libpebble2/protocol/base/types.py/Field.buffer_to_value
5,314
def buffer_to_value(self, obj, buffer, offset, default_endianness=DEFAULT_ENDIANNESS): try: return uuid.UUID(bytes=buffer[offset:offset+16]), 16 except __HOLE__ as e: raise PacketDecodeError("{}: failed to decode UUID: {}".format(self.type, e))
ValueError
dataset/ETHPy150Open pebble/libpebble2/libpebble2/protocol/base/types.py/UUID.buffer_to_value
5,315
def prepare(self, obj, value): try: setattr(obj, self.determinant._name, self.type_map[type(value)]) except __HOLE__: if not self.accept_missing: raise if isinstance(self.length, Field): setattr(obj, self.length._name, len(value.serialise()))
KeyError
dataset/ETHPy150Open pebble/libpebble2/libpebble2/protocol/base/types.py/Union.prepare
5,316
def buffer_to_value(self, obj, buffer, offset, default_endianness=DEFAULT_ENDIANNESS): if isinstance(self.length, Field): length = getattr(obj, self.length._name) else: length = len(buffer) - offset k = getattr(obj, self.determinant._name) try: return ...
KeyError
dataset/ETHPy150Open pebble/libpebble2/libpebble2/protocol/base/types.py/Union.buffer_to_value
5,317
def split_and_deserialize(string): """Split and try to JSON deserialize a string. Gets a string with the KEY=VALUE format, split it (using '=' as the separator) and try to JSON deserialize the VALUE. :returns: A tuple of (key, value). """ try: key, value = string.split("=", 1) exce...
ValueError
dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/utils.py/split_and_deserialize
5,318
def common_params_for_list(args, fields, field_labels): """Generate 'params' dict that is common for every 'list' command. :param args: arguments from command line. :param fields: possible fields for sorting. :param field_labels: possible field labels for sorting. :returns: a dict with params to pa...
KeyError
dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/utils.py/common_params_for_list
5,319
def make_configdrive(path): """Make the config drive file. :param path: The directory containing the config drive files. :returns: A gzipped and base64 encoded configdrive string. """ # Make sure path it's readable if not os.access(path, os.R_OK): raise exc.CommandError(_('The director...
OSError
dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/utils.py/make_configdrive
5,320
def bool_argument_value(arg_name, bool_str, strict=True, default=False): """Returns the Boolean represented by bool_str. Returns the Boolean value for the argument named arg_name. The value is represented by the string bool_str. If the string is an invalid Boolean string: if strict is True, a CommandEr...
ValueError
dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/utils.py/bool_argument_value
5,321
def __new__(cls, name, bases, attrs): try: parents = [b for b in bases if issubclass(b, EntityForm)] except __HOLE__: # We are defining EntityForm itself parents = None sup = super(EntityFormMetaclass, cls) if not parents: # Then there's no business trying to use proxy fields. return sup.__new...
NameError
dataset/ETHPy150Open ithinksw/philo/philo/forms/entities.py/EntityFormMetaclass.__new__
5,322
def action_on_a_page_single_doc(page): docs = [row.doc for row in page] for doc in docs: doc["tiid"] = doc["_id"] try: doc["last_update_run"] except __HOLE__: doc["last_update_run"] = None print "try" try: print doc["tiid"] ...
KeyError
dataset/ETHPy150Open Impactstory/total-impact-core/extras/db_housekeeping/postgres_mirror.py/action_on_a_page_single_doc
5,323
def build_items_save_list(items): items_save_list = [] for item in items: item["tiid"] = item["_id"] try: item["last_update_run"] except __HOLE__: item["last_update_run"] = None items_save_list += [item] return items_save_list
KeyError
dataset/ETHPy150Open Impactstory/total-impact-core/extras/db_housekeeping/postgres_mirror.py/build_items_save_list
5,324
def __new__(cls, meth, callback=None): try: obj = meth.__self__ func = meth.__func__ except __HOLE__: raise TypeError("argument should be a bound method, not {}" .format(type(meth))) def _cb(arg): # The self-weakref tric...
AttributeError
dataset/ETHPy150Open django/django/django/dispatch/weakref_backports.py/WeakMethod.__new__
5,325
def gdb(fips_dir, proj_dir, cfg_name, target=None, target_args=None) : """debug a single target with gdb""" # prepare proj_name = util.get_project_name_from_dir(proj_dir) util.ensure_valid_project_dir(proj_dir) # load the config(s) configs = config.load(fips_dir, proj_dir, cfg_name) if con...
OSError
dataset/ETHPy150Open floooh/fips/verbs/gdb.py/gdb
5,326
def _run_tcp(self, listener, socket): """Start a raw TCP server in a new green thread.""" while True: try: new_sock, address = socket.accept() self._pool.spawn_n(listener, new_sock) except (SystemExit, __HOLE__): pass
KeyboardInterrupt
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/wsgi.py/Server._run_tcp
5,327
def get_user(request): """authorize user based on API key if it was passed, otherwise just use the request's user. :param request: :return: django.contrib.au th.User """ from tastypie.models import ApiKey if 'json' in request.META['CONTENT_TYPE']: try: req = json.loads(...
ValueError
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/utils.py/get_user
5,328
def to_python(self, value): value = super(BBoxField, self).to_python(value) if not value: return -180.0,-90.0,180.0,90.0 try: lx, ly, ux, uy = value.split(',') if self.localize: lx = float(sanitize_separators(lx)) ly = float(sa...
ValueError
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/utils.py/BBoxField.to_python
5,329
def get_object(self, *args, **kwargs): obj = super(OwnedObjectMixin, self).get_object(*args, **kwargs) try: if not obj.owner == self.request.user: raise Http404() except __HOLE__: pass return obj
AttributeError
dataset/ETHPy150Open matagus/django-planet/planet/views.py/OwnedObjectMixin.get_object
5,330
def _target(self): try: timer = Timer() if self.show_time else None with Spinner(label=self.label, timer=timer) as spinner: while not self.shutdown_event.is_set(): spinner.step() spinner.sleep() except __HOLE__: ...
KeyboardInterrupt
dataset/ETHPy150Open xolox/python-humanfriendly/humanfriendly/__init__.py/AutomaticSpinner._target
5,331
def __getitem__(self, pos): print('__getitem__:', pos) try: return self.items.__getitem__(pos) except __HOLE__ as e: print('ERROR:', e)
TypeError
dataset/ETHPy150Open fluentpython/example-code/attic/sequences/slice_test.py/SliceDemo.__getitem__
5,332
def build_activation(act=None): def compose(a, b): c = lambda z: b(a(z)) c.__theanets_name__ = '%s(%s)' % (b.__theanets_name__, a.__theanets_name__) return c if '+' in act: return functools.reduce( compose, (build_activation(a) for a in act...
KeyError
dataset/ETHPy150Open zomux/deepy/deepy/utils/activations.py/build_activation
5,333
def execute(self, response, autofixture): """Generates fixture objects from the given response and stores them in the application-specific cache. :param response: the recorded :class:`Response` :param autofixture: the active :class:`AutoFixture` """ if not has_request_co...
TypeError
dataset/ETHPy150Open janukobytsch/flask-autofixture/flask_autofixture/command.py/CreateFixtureCommand.execute
5,334
def get_test_module(app_name): ''' Import tests module ''' module_name = '.'.join([app_name, 'tests']) try: return import_module(module_name) except __HOLE__, exception: if exception.message == 'No module named tests': raise ImportError('No module named {0}'.format(module_nam...
ImportError
dataset/ETHPy150Open plus500s/django-test-tools/test_tools/test_runner.py/get_test_module
5,335
def load_custom_test_package(self, module, app_name): ''' Load custom test package from module and app ''' for importer, module_name, ispkg in pkgutil.iter_modules( [os.path.dirname(module.__file__)]): try: import_module('.'.join([app_name, 't...
ImportError
dataset/ETHPy150Open plus500s/django-test-tools/test_tools/test_runner.py/DiscoveryDjangoTestSuiteRunner.load_custom_test_package
5,336
def get_apps(self): try: return settings.PROJECT_APPS except __HOLE__: return settings.INSTALLED_APPS
AttributeError
dataset/ETHPy150Open plus500s/django-test-tools/test_tools/test_runner.py/DiscoveryDjangoTestSuiteRunner.get_apps
5,337
def parse_kwarg(string_): ''' Parses the string and looks for the following kwarg format: "{argument name}={argument value}" For example: "my_message=Hello world" Returns the kwarg name and value, or (None, None) if the regex was not matched. ''' try: return KWARG_REGEX.match(...
AttributeError
dataset/ETHPy150Open saltstack/salt/salt/utils/args.py/parse_kwarg
5,338
def register_adapters(): global adapters_registered if adapters_registered is True: return try: import pkg_resources packageDir = pkg_resources.resource_filename('pyamf', 'adapters') except: packageDir = os.path.dirname(__file__) for f in glob.glob(os.path.join(pac...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/adapters/__init__.py/register_adapters
5,339
def __str__(self): try: line = 'line %d: ' % (self.args[1].coord.line,) except (AttributeError, __HOLE__, IndexError): line = '' return '%s%s' % (line, self.args[0])
TypeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/CDefError.__str__
5,340
def _typeof(self, cdecl, consider_function_as_funcptr=False): # string -> ctype object try: result = self._parsed_types[cdecl] except __HOLE__: with self._lock: result = self._typeof_locked(cdecl) # btype, really_a_function_type = result ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/FFI._typeof
5,341
def gc(self, cdata, destructor): """Return a new cdata object that points to the same data. Later, when this new cdata object is garbage-collected, 'destructor(old_cdata_object)' will be called. """ try: gcp = self._backend.gcp except __HOLE__: pa...
AttributeError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/FFI.gc
5,342
def _get_cached_btype(self, type): assert self._lock.acquire(False) is False # call me with the lock! try: BType = self._cached_btypes[type] except __HOLE__: finishlist = [] BType = type.get_cached_btype(self, finishlist) for type in finish...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/FFI._get_cached_btype
5,343
def _apply_embedding_fix(self, kwds): # must include an argument like "-lpython2.7" for the compiler def ensure(key, value): lst = kwds.setdefault(key, []) if value not in lst: lst.append(value) # if '__pypy__' in sys.builtin_module_names: ...
ImportError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/FFI._apply_embedding_fix
5,344
def init_once(self, func, tag): # Read _init_once_cache[tag], which is either (False, lock) if # we're calling the function now in some thread, or (True, result). # Don't call setdefault() in most cases, to avoid allocating and # immediately freeing a lock; but still use setdefaut() to a...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/FFI.init_once
5,345
def _load_backend_lib(backend, name, flags): if name is None: if sys.platform != "win32": return backend.load_library(None, flags) name = "c" # Windows: load_library(None) fails, but this works # (backward compatibility hack only) try: if '.' not in n...
OSError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/_load_backend_lib
5,346
def _make_ffi_library(ffi, libname, flags): import os backend = ffi._backend backendlib = _load_backend_lib(backend, libname, flags) # def accessor_function(name): key = 'function ' + name tp, _ = ffi._parser._declarations[key] BType = ffi._get_cached_btype(tp) try: ...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/_make_ffi_library
5,347
def _builtin_function_type(func): # a hack to make at least ffi.typeof(builtin_function) work, # if the builtin function was obtained by 'vengine_cpy'. import sys try: module = sys.modules[func.__module__] ffi = module._cffi_original_ffi types_of_builtin_funcs = module._cffi_type...
KeyError
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/cffi/api.py/_builtin_function_type
5,348
def makePath(path): # Try creating a directory try: os.makedirs(path) except __HOLE__, err: if err.errno != 17: raise
OSError
dataset/ETHPy150Open skyostil/tracy/src/analyzer/Report.py/makePath
5,349
def _generateNode(self, output, node): dispatchTable = { Section: self._generateSection, Paragraph: self._generateParagraph, Image: self._generateImage, Table: self._generateTable, Link: self._generateLink, LinkTarget: self...
KeyError
dataset/ETHPy150Open skyostil/tracy/src/analyzer/Report.py/HtmlCompiler._generateNode
5,350
def read_file(filename): """Read a file into a string""" path = os.path.abspath(os.path.dirname(__file__)) filepath = os.path.join(path, filename) try: return open(filepath).read() except __HOLE__: return '' # Use the docstring of the __init__ file to be the description
IOError
dataset/ETHPy150Open antoinemartin/django-windows-tools/setup.py/read_file
5,351
def testWithRaise(self): counter = 0 try: counter += 1 with mock_contextmanager_generator(): counter += 10 raise RuntimeError counter += 100 # Not reached except __HOLE__: self.assertEqual(counter, 11) else: ...
RuntimeError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_with.py/NonLocalFlowControlTestCase.testWithRaise
5,352
def testExceptionInEnter(self): try: with self.Dummy() as a, self.EnterRaises(): self.fail('body of bad with executed') except __HOLE__: pass else: self.fail('RuntimeError not reraised') self.assertTrue(a.enter_called) self.asse...
RuntimeError
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_with.py/NestedWith.testExceptionInEnter
5,353
@staticmethod def parsetime(time_str): """ Try to parse any generalised time to standard format. For now used by Codechef """ try: dt = datetime.datetime.strptime(time_str, "%I:%M %p %d/%m/%y") return dt except __HOLE__: ...
ValueError
dataset/ETHPy150Open stopstalk/stopstalk-deployment/modules/sites/codechef.py/Profile.parsetime
5,354
@staticmethod def get_tags(problem_link): url = problem_link.split("/") url = url[2:] url.insert(1, "api/contests") if len(url) == 4: url.insert(2, "PRACTICE") url = "https://" + "/".join(url) response = get_request(url) if response == -1 or resp...
KeyError
dataset/ETHPy150Open stopstalk/stopstalk-deployment/modules/sites/codechef.py/Profile.get_tags
5,355
def parallelize_codechef(self, handle, page, last_retrieved): """ Helper function for retrieving codechef submissions parallely """ if self.retrieve_failed: return url = "https://www.codechef.com/recent/user?user_handle=" + \ handle + \ ...
IndexError
dataset/ETHPy150Open stopstalk/stopstalk-deployment/modules/sites/codechef.py/Profile.parallelize_codechef
5,356
def get_submissions(self, last_retrieved): if self.retrieve_failed: return -1 if self.handle: handle = self.handle else: return -1 user_url = "http://www.codechef.com/recent/user?user_handle=" + handle tmp = get_request(user_url, headers={"...
IndexError
dataset/ETHPy150Open stopstalk/stopstalk-deployment/modules/sites/codechef.py/Profile.get_submissions
5,357
@given(u'A working Radamsa installation') def step_impl(context): """Check for a working Radamsa installation.""" if context.radamsa_location is None: assert False, "The feature file requires Radamsa, but the path is " \ "undefined." try: subprocess.check_output([conte...
OSError
dataset/ETHPy150Open F-Secure/mittn/mittn/httpfuzzer/steps.py/step_impl
5,358
def args2body(self, parsed_args): params = {} if parsed_args.name: params['name'] = parsed_args.name if not isinstance(parsed_args.start, datetime.datetime): try: parsed_args.start = datetime.datetime.strptime( parsed_args.start, '%Y-%m...
ValueError
dataset/ETHPy150Open openstack/python-blazarclient/climateclient/v1/shell_commands/leases.py/CreateLease.args2body
5,359
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15): to_dir = os.path.abspath(to_dir) rep_modules = 'pkg_resources', 'setuptools' imported = set(sys.modules).intersection(rep_modules) try: import pkg_resources except __HOLE__: ...
ImportError
dataset/ETHPy150Open akamai-open/api-kickstart/examples/python/tools/ez_setup.py/use_setuptools
5,360
@classmethod def _get_val(cls, item, path): """ Return the answer in the given submitted form (item) to the question specified by path. Return empty tuple if no answer was given to the given question. """ if path: try: v = item['form'] ...
KeyError
dataset/ETHPy150Open dimagi/commcare-hq/custom/abt/reports/expressions.py/AbtSupervisorExpressionSpec._get_val
5,361
def get(self, request, repo, slug): condition = Q() for name in get_search_names(slug): condition |= Q(name__iexact=name) try: package = self.repository.packages.get(condition) except __HOLE__: if not self.repository.enable_auto_mirroring: ...
ObjectDoesNotExist
dataset/ETHPy150Open mvantellingen/localshop/localshop/apps/packages/views.py/SimpleDetail.get
5,362
def get(self, request, repo, name): try: package = self.repository.packages.get(name__iexact=name) except __HOLE__: package = None enqueue(fetch_package, self.repository.pk, name) return redirect(package)
ObjectDoesNotExist
dataset/ETHPy150Open mvantellingen/localshop/localshop/apps/packages/views.py/PackageRefreshView.get
5,363
def handle_register_or_upload(post_data, files, user, repository): """Process a `register` or `upload` comment issued via distutils. This method is called with the authenticated user. """ name = post_data.get('name') version = post_data.get('version') if settings.LOCALSHOP_VERSIONING_TYPE: ...
AttributeError
dataset/ETHPy150Open mvantellingen/localshop/localshop/apps/packages/views.py/handle_register_or_upload
5,364
def instance_to_dict(obj): """Recursively convert a class instance into a dict args: obj: a class instance returns: dict representation """ if isinstance(obj, (int, float, complex, bool, str)): return obj if isinstance(obj, dict): new = {} for k in...
AttributeError
dataset/ETHPy150Open polaris-gslb/polaris-gslb/polaris_health/util/__init__.py/instance_to_dict
5,365
def __init__(self, path, budget, device=None): """ Load YNAB budget from the specified path. Parameters ---------- path : str Path to the budget root, e.g. ~/Documents/YNAB for local budgets or ~/Dropbox/YNAB for cloud-synced budgets. budget : str...
IndexError
dataset/ETHPy150Open aldanor/pynab/ynab/ynab.py/YNAB.__init__
5,366
def make_syntax(): # note that the key is a tuple of the number of arguments, # and the name of the reference before the first space. # for example [refer year name] would be (2, u"refer") # and [absurd] would be (0, u"absurd") # the value is a function that accepts # entry, str, and then N addi...
IndexError
dataset/ETHPy150Open lethain/lifeflow/markdown/mdx_lifeflow.py/make_syntax
5,367
def process_dynamic(self, ref): # if tag has already been built, ignore if self.tags.has_key(ref): return None parts = ref.split(u" ") name = parts[0] args = parts[1:] length = len(args) format = u"[%s]: %s" % (ref, u"%s") try: func...
KeyError
dataset/ETHPy150Open lethain/lifeflow/markdown/mdx_lifeflow.py/LifeflowPreprocessor.process_dynamic
5,368
@if_connected def on_pre_save(self, view, agent): if view.is_scratch(): return p = view.name() if view.file_name(): try: p = utils.to_rel_path(view.file_name()) except __HOLE__: p = view.file_name() i = self.between_...
ValueError
dataset/ETHPy150Open Floobits/floobits-sublime/floo/listener.py/Listener.on_pre_save
5,369
@if_connected def on_post_save(self, view, agent): view_buf_id = view.buffer_id() def cleanup(): i = self.between_save_events[view_buf_id] i[0] -= 1 if view.is_scratch(): return i = self.between_save_events[view_buf_id] if agent.ignored_...
ValueError
dataset/ETHPy150Open Floobits/floobits-sublime/floo/listener.py/Listener.on_post_save
5,370
def copyfile(src, dest, symlink=True): if not os.path.exists(src): # Some bad symlink in the src logger.warn('Cannot find file %s (bad symlink)', src) return if os.path.exists(dest): logger.debug('File %s already exists', dest) return if not os.path.exists(os.path.dir...
NotImplementedError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/copyfile
5,371
def file_search_dirs(): here = os.path.dirname(os.path.abspath(__file__)) dirs = ['.', here, join(here, 'virtualenv_support')] if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv': # Probably some boot script; just in case virtualenv is installed... try: ...
ImportError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/file_search_dirs
5,372
def call_subprocess(cmd, show_stdout=True, filter_stdout=None, cwd=None, raise_on_returncode=True, extra_env=None, remove_from_env=None): cmd_parts = [] for part in cmd: if len(part) > 45: part = part[:20]+"..."+part[-20:] i...
UnicodeDecodeError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/call_subprocess
5,373
def path_locations(home_dir): """Return the path locations for the environment (where libraries are, where scripts go, etc)""" # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its # prefix arg is broken: http://bugs.python.org/issue3386 if is_win: # Windows has lots of problems wit...
NameError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/path_locations
5,374
def copy_required_modules(dst_prefix, symlink): import imp # If we are running under -p, we need to remove the current # directory from sys.path temporarily here, so that we # definitely get the modules from the site directory of # the interpreter we are running under, not the one # virtualenv.p...
ImportError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/copy_required_modules
5,375
def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True): """Install just the base environment, no distutils patches etc""" if sys.executable.startswith(bin_dir): print('Please use the *system* python to run this script') return if clear: rmtree(li...
OSError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/install_python
5,376
def fix_local_scheme(home_dir, symlink=True): """ Platforms that use the "posix_local" install scheme (like Ubuntu with Python 2.7) need to be given an additional "local" location, sigh. """ try: import sysconfig except __HOLE__: pass else: if sysconfig._get_default_s...
ImportError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/fix_local_scheme
5,377
def fixup_scripts(home_dir, bin_dir): if is_win: new_shebang_args = ( '%s /c' % os.path.normcase(os.environ.get('COMSPEC', 'cmd.exe')), '', '.exe') else: new_shebang_args = ('/usr/bin/env', sys.version[:3], '') # This is what we expect at the top of scripts: sheb...
UnicodeDecodeError
dataset/ETHPy150Open femmerling/backyard/virtualenv.py/fixup_scripts
5,378
def GetRawResponse(self, with_status=True): try: return self.GetStatus() + "\r\n" + str(self.ResponseHeaders) + \ "\n\n" + self.ResponseContents except __HOLE__: return self.GetStatus() + "\r\n" + str(self.ResponseHeaders) + \ "\n\n" + "[Bina...
UnicodeDecodeError
dataset/ETHPy150Open owtf/owtf/framework/http/transaction.py/HTTP_Transaction.GetRawResponse
5,379
def ImportProxyRequestResponse(self, request, response): self.IsInScope = request.in_scope self.URL = request.url self.InitData(request.body) self.Method = request.method try: self.Status = str(response.code) + " " + \ response_messages[int(r...
KeyError
dataset/ETHPy150Open owtf/owtf/framework/http/transaction.py/HTTP_Transaction.ImportProxyRequestResponse
5,380
def load_divs(f, specs, Ks): specs = np.asarray(strict_map(normalize_div_name, specs)) Ks = np.ravel(Ks) n_bags = next(itervalues(next(itervalues(f)))).shape[0] divs = np.empty((n_bags, n_bags, specs.size, Ks.size), dtype=np.float32) divs.fill(np.nan) for i, spec in enumerate(specs): ...
KeyError
dataset/ETHPy150Open dougalsutherland/py-sdm/sdm/tests/test_divs.py/load_divs
5,381
def setup_os_root(self, root): LOG.debug("Inspecting guest OS root filesystem %s", root) mounts = self.handle.inspect_get_mountpoints(root) if len(mounts) == 0: raise exception.NovaException( _("No mount points found in %(root)s of %(image)s") % {'roo...
RuntimeError
dataset/ETHPy150Open openstack/nova/nova/virt/disk/vfs/guestfs.py/VFSGuestFS.setup_os_root
5,382
def setup(self, mount=True): LOG.debug("Setting up appliance for %(image)s", {'image': self.image}) try: self.handle = tpool.Proxy( guestfs.GuestFS(python_return_dict=False, close_on_exit=False)) except __HOLE__ as e: ...
TypeError
dataset/ETHPy150Open openstack/nova/nova/virt/disk/vfs/guestfs.py/VFSGuestFS.setup
5,383
def teardown(self): LOG.debug("Tearing down appliance") try: try: if self.mount: self.handle.aug_close() except __HOLE__ as e: LOG.warning(_LW("Failed to close augeas %s"), e) try: self.handle.shutd...
RuntimeError
dataset/ETHPy150Open openstack/nova/nova/virt/disk/vfs/guestfs.py/VFSGuestFS.teardown
5,384
def has_file(self, path): LOG.debug("Has file path=%s", path) path = self._canonicalize_path(path) try: self.handle.stat(path) return True except __HOLE__: return False
RuntimeError
dataset/ETHPy150Open openstack/nova/nova/virt/disk/vfs/guestfs.py/VFSGuestFS.has_file
5,385
def _ExpandArchs(self, archs, sdkroot): """Expands variables references in ARCHS, and remove duplicates.""" variable_mapping = self._VariableMapping(sdkroot) expanded_archs = [] for arch in archs: if self.variable_pattern.match(arch): variable = arch try: variable_expansi...
KeyError
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/xcode_emulation.py/XcodeArchsDefault._ExpandArchs
5,386
def _pick_idp(self, query, end_point_index): """ If more than one idp and if none is selected, I have to do wayf or disco """ query_dict = {} if isinstance(query, six.string_types): query_dict = dict(parse_qs(query)) els...
KeyError
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/authn/saml.py/SAMLAuthnMethod._pick_idp
5,387
def get_user(self, user_id): """Return a User by their UserID. Raises KeyError if the User is not available. """ try: return self._user_dict[user_id] except __HOLE__: logger.warning('UserList returning unknown User for UserID {}' ...
KeyError
dataset/ETHPy150Open tdryer/hangups/hangups/user.py/UserList.get_user
5,388
@lib.api_call def transmit_block(self, array): try: self.bus.write_i2c_block_data(self.addr, self.reg, array) except __HOLE__ as err: self.logger.debug(err) return err
IOError
dataset/ETHPy150Open IEEERobotics/bot/bot/hardware/servo_cape.py/ServoCape.transmit_block
5,389
def test_03_Files_List_GetList_Iterate(self): drive = GoogleDrive(self.ga) flist = drive.ListFile({'q': "title = '%s' and trashed = false"%self.title, 'maxResults': 2}) files = [] while True: try: x = flist.GetList() self.assertTrue(len(x) <= 2) ...
StopIteration
dataset/ETHPy150Open googledrive/PyDrive/pydrive/test/test_filelist.py/GoogleDriveFileListTest.test_03_Files_List_GetList_Iterate
5,390
def DeleteOldFile(self, file_name): try: os.remove(file_name) except __HOLE__: pass
OSError
dataset/ETHPy150Open googledrive/PyDrive/pydrive/test/test_filelist.py/GoogleDriveFileListTest.DeleteOldFile
5,391
def split_to_jip_args(args): """Check the <args> and search for '--'. If found, everything after '--' is put into 'Jip_args'""" if args and "<args>" in args: try: i = args["<args>"].index("--") args["<args>"], args["<jip_args>"] = args["<args>"][:i], \ args["<...
ValueError
dataset/ETHPy150Open thasso/pyjip/jip/cli/jip_interpreter.py/split_to_jip_args
5,392
def add_git_segment(powerline): try: p = subprocess.Popen(['git', 'status', '--porcelain', '-b'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=git_subprocess_env()) except __HOLE__: # Popen will throw an OSError if git is not found...
OSError
dataset/ETHPy150Open milkbikis/powerline-shell/segments/git.py/add_git_segment
5,393
def test_issue_7754(self): old_cwd = os.getcwd() config_dir = os.path.join(integration.TMP, 'issue-7754') if not os.path.isdir(config_dir): os.makedirs(config_dir) os.chdir(config_dir) config_file_name = 'master' with salt.utils.fopen(self.get_config_file_pa...
AssertionError
dataset/ETHPy150Open saltstack/salt/tests/integration/shell/runner.py/RunTest.test_issue_7754
5,394
def coerce_key_types(doc, keys): """ Given a document and a list of keys such as ['rows', '123', 'edit'], return a list of keys, such as ['rows', 123, 'edit']. """ ret = [] active = doc for idx, key in enumerate(keys): # Coerce array lookups to integers. if isinstance(active,...
ValueError
dataset/ETHPy150Open core-api/python-client/coreapi/commandline.py/coerce_key_types
5,395
@click.command(help='Display the current document.\n\nOptionally display just the element at the given PATH.') @click.argument('path', nargs=-1) def show(path): doc = get_document() if doc is None: click.echo('No current document. Use `coreapi get` to fetch a document first.') sys.exit(1) i...
KeyError
dataset/ETHPy150Open core-api/python-client/coreapi/commandline.py/show
5,396
@click.command(help='Display description for link at given PATH.') @click.argument('path', nargs=-1) def describe(path): doc = get_document() if doc is None: click.echo('No current document. Use `coreapi get` to fetch a document first.') sys.exit(1) if not path: click.echo('Missing ...
KeyError
dataset/ETHPy150Open core-api/python-client/coreapi/commandline.py/describe
5,397
@staticmethod def last_mod(): try: last_mod = Post.objects\ .published()\ .order_by('-created')[0] return last_mod.created except __HOLE__: return None
IndexError
dataset/ETHPy150Open jamiecurle/django-omblog/omblog/ccsitemap.py/PostSiteMap.last_mod
5,398
def testCreate(self): # log.info("Schematic from indev") size = (64, 64, 64) temp = mktemp("testcreate.schematic") schematic = MCSchematic(shape=size, filename=temp, mats='Classic') level = self.indevLevel.level schematic.copyBlocksFrom(level, BoundingBox((0, 0, 0), (64...
ValueError
dataset/ETHPy150Open mcedit/pymclevel/test/schematic_test.py/TestSchematics.testCreate
5,399
def _get_raw_post_data(self): try: return self._raw_post_data except __HOLE__: self._raw_post_data = self._req.read() return self._raw_post_data
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/core/handlers/modpython.py/ModPythonRequest._get_raw_post_data