Unnamed: 0
int64
0
10k
function
stringlengths
79
138k
label
stringclasses
20 values
info
stringlengths
42
261
9,400
def medianFilter(self, kernel_size=5): """ **SUMMARY** Apply median filter on the data **PARAMETERS** * *kernel_size* - Size of the filter (should be odd int) - int **RETURNS** A LineScan object with the median filter applied to the values. **EXAMPLE...
ImportError
dataset/ETHPy150Open sightmachine/SimpleCV/SimpleCV/LineScan.py/LineScan.medianFilter
9,401
def detrend(self): """ **SUMMARY** Detren the data **PARAMETERS** **RETURNS** A LineScan object with detrened data. **EXAMPLE** >>> ls = img.getLineScan(x=10) >>> dt = ls.detrend() >>> plt.plot(ls) >>> plt.plot(dt) """...
ImportError
dataset/ETHPy150Open sightmachine/SimpleCV/SimpleCV/LineScan.py/LineScan.detrend
9,402
def linux_install_data_files(data_files): for item in data_files: path = os.path.join(sys.prefix, item[0]) print "{0}->{1}".format(item[1], path) try: os.makedirs(os.path.split(path)[0]) except __HOLE__, e: pass try: shutil.copy(item[1], pa...
OSError
dataset/ETHPy150Open legalosLOTR/mdb/setup.py/linux_install_data_files
9,403
@request_handler @defer.inlineCallbacks def _async_render_POST(self, request): requester = yield self.auth.get_user_by_req(request) # TODO: The checks here are a bit late. The content will have # already been uploaded to a tmp file at this point content_length = request.getHeader...
UnicodeDecodeError
dataset/ETHPy150Open matrix-org/synapse/synapse/rest/media/v1/upload_resource.py/UploadResource._async_render_POST
9,404
def main(): test = TestPermutation() test.test_permutation(permutations) try: test.test_permutation(permutations_alt) except __HOLE__: # Alternate solutions are only defined # in the solutions file pass
NameError
dataset/ETHPy150Open donnemartin/interactive-coding-challenges/arrays_strings/permutation/test_permutation_solution.py/main
9,405
def __getitem__(self, key): try: value = self.cache[key] except __HOLE__: f = StringIO(self.dict[key]) value = Unpickler(f).load() if self.writeback: self.cache[key] = value return value
KeyError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/shelve.py/Shelf.__getitem__
9,406
def __delitem__(self, key): del self.dict[key] try: del self.cache[key] except __HOLE__: pass
KeyError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/shelve.py/Shelf.__delitem__
9,407
def close(self): self.sync() try: self.dict.close() except __HOLE__: pass # Catch errors that may happen when close is called from __del__ # because CPython is in interpreter shutdown. try: self.dict = _ClosedDict() except (Name...
AttributeError
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/shelve.py/Shelf.close
9,408
def tearDown(self): # Undo the test.globs reassignment we made, so that the parent class # teardown doesn't destroy the ipython namespace if isinstance(self._dt_test.examples[0],IPExample): self._dt_test.globs = self._dt_test_globs_ori # Restore the behavior of the '_' k...
AttributeError
dataset/ETHPy150Open ipython/ipython-py3k/IPython/testing/plugin/ipdoctest.py/DocTestCase.tearDown
9,409
def test_multiple_rules(self): # Test that parse_limits() handles multiple rules correctly. try: l = limits.Limiter.parse_limits('(get, *, .*, 20, minute);' '(PUT, /foo*, /foo.*, 10, hour);' '(POST, /bar*...
ValueError
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_limits.py/ParseLimitsTest.test_multiple_rules
9,410
@property def freqstr(self): try: code = self.rule_code except __HOLE__: return repr(self) if self.n != 1: fstr = '%d%s' % (self.n, code) else: fstr = code return fstr
NotImplementedError
dataset/ETHPy150Open pydata/pandas/pandas/tseries/offsets.py/DateOffset.freqstr
9,411
@property def freqstr(self): try: code = self.rule_code except __HOLE__: return repr(self) if self.n != 1: fstr = '%d%s' % (self.n, code) else: fstr = code if self.offset: fstr += self._offset_str() return...
NotImplementedError
dataset/ETHPy150Open pydata/pandas/pandas/tseries/offsets.py/BusinessDay.freqstr
9,412
def _validate_time(self, t_input): from datetime import time as dt_time import time if isinstance(t_input, compat.string_types): try: t = time.strptime(t_input, '%H:%M') return dt_time(hour=t.tm_hour, minute=t.tm_min) except __HOLE__: ...
ValueError
dataset/ETHPy150Open pydata/pandas/pandas/tseries/offsets.py/BusinessHourMixin._validate_time
9,413
def get_calendar(self, weekmask, holidays, calendar): """Generate busdaycalendar""" if isinstance(calendar, np.busdaycalendar): if not holidays: holidays = tuple(calendar.holidays) elif not isinstance(holidays, tuple): holidays = tuple(holidays) ...
AttributeError
dataset/ETHPy150Open pydata/pandas/pandas/tseries/offsets.py/CustomBusinessDay.get_calendar
9,414
@internationalizeDocstring def base(self, irc, msg, args, frm, to, number): """<fromBase> [<toBase>] <number> Converts <number> from base <fromBase> to base <toBase>. If <toBase> is left out, it converts to decimal. """ if not number: number = str(to) ...
ValueError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Math/plugin.py/Math.base
9,415
@internationalizeDocstring def calc(self, irc, msg, args, text): """<math expression> Returns the value of the evaluated <math expression>. The syntax is Python syntax; the type of arithmetic is floating point. Floating point arithmetic is used in order to prevent a user from bein...
NameError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Math/plugin.py/Math.calc
9,416
@internationalizeDocstring def icalc(self, irc, msg, args, text): """<math expression> This is the same as the calc command except that it allows integer math, and can thus cause the bot to suck up CPU. Hence it requires the 'trusted' capability to use. """ if self....
NameError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Math/plugin.py/Math.icalc
9,417
def rpn(self, irc, msg, args): """<rpn math expression> Returns the value of an RPN expression. """ stack = [] for arg in args: try: x = complex(arg) if x == abs(x): x = abs(x) stack.append(x) ...
TypeError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Math/plugin.py/Math.rpn
9,418
@internationalizeDocstring def convert(self, irc, msg, args, number, unit1, unit2): """[<number>] <unit> to <other unit> Converts from <unit> to <other unit>. If number isn't given, it defaults to 1. For unit information, see 'units' command. """ try: digits = le...
IndexError
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Math/plugin.py/Math.convert
9,419
def all_projects(): if not REPODIR: return # Future: make this path parameterisable. excludes = set(['tempest', 'requirements']) for name in PROJECTS: name = name.strip() short_name = name.split('/')[-1] try: with open(os.path.join( REPODIR...
IOError
dataset/ETHPy150Open blue-yonder/pyscaffold/pyscaffold/contrib/pbr/pbr/tests/test_integration.py/all_projects
9,420
def emit(self, record): try: msg = self.format(record) if record.levelno >= self.levelno: self.write(msg) else: self.transient_write(msg) except (KeyboardInterrupt, __HOLE__): raise except: self.handleErr...
SystemExit
dataset/ETHPy150Open jart/fabulous/fabulous/logs.py/TransientStreamHandler.emit
9,421
def jsinclude(self, translator, node, *args, **kwargs): if len(node.args) != 1: raise TranslationError( "jsinclude function requires one argument", node.node) if ( isinstance(node.args[0], translator.ast.Const) and isinstance(node.args[0].valu...
IOError
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_proto.py/__Pyjamas__.jsinclude
9,422
def parse_decorators(self, node, funcname, current_class = None, is_method = False, bind_type = None): if node.decorators is None: return False, False, '%s' self.push_lookup() self.add_lookup('variable', '%s', '%s') code = '%s' staticmethod =...
KeyError
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_proto.py/Translator.parse_decorators
9,423
def func_args(self, node, current_klass, function_name, bind_type, args, stararg, dstararg): try: bind_type = BIND_TYPES_NUMERIC[bind_type] except __HOLE__: raise TranslationError("Unknown bind type: %s" % bind_type, node) _args = [] default_pos = len(args) - len(...
KeyError
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_proto.py/Translator.func_args
9,424
def _from(self, node, current_klass, root_level = False): if node.modname == '__pyjamas__': # special module to help make pyjamas modules loadable in # the python interpreter for name in node.names: ass_name = name[1] or name[0] try: ...
AttributeError
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_proto.py/Translator._from
9,425
def _callfunc_code(self, v, current_klass, is_statement=False, optlocal_var=False): self.ignore_debug = False method_name = None if isinstance(v.node, self.ast.Name): name_type, pyname, jsname, depth, is_local = self.lookup(v.node.name) if name_type == '__pyjamas__': ...
AttributeError
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_proto.py/Translator._callfunc_code
9,426
def zAxis(self, row, zStructuralNode, zAspectStructuralNodes, discriminatorsTable): if zStructuralNode is not None: label = zStructuralNode.header(lang=self.lang) choiceLabel = None effectiveStructuralNode = zStructuralNode if zStructuralNode.choiceStructuralNodes...
KeyError
dataset/ETHPy150Open Arelle/Arelle/arelle/ViewFileRenderedGrid.py/ViewRenderedGrid.zAxis
9,427
def __init__(self, element): # No call to super(), the type object will process that. self.name = testXMLAttribute(element, "name") try: self.content = eval(element[-1].tag.split("}")[-1])(element[-1]) except __HOLE__: self.content = None e...
IndexError
dataset/ETHPy150Open geopython/OWSLib/owslib/swe/common.py/NamedObject.__init__
9,428
def get_time(value, referenceTime, uom): try: value = parser.parse(value) except (AttributeError, __HOLE__): # Most likely an integer/float using a referenceTime try: if uom.lower() == "s": value = referenceTime + timedelta(seconds=float(value)) elif uom...
ValueError
dataset/ETHPy150Open geopython/OWSLib/owslib/swe/common.py/get_time
9,429
def __init__(self, element): super(Time, self).__init__(element) # Elements self.uom = get_uom(element.find(nspv("swe20:uom"))) try: self.constraint = AllowedTimes(element.find(nspv("swe20:constraint/swe20:AllowedTimes"))) # AllowedTimes, min=0, max=1 ...
ValueError
dataset/ETHPy150Open geopython/OWSLib/owslib/swe/common.py/Time.__init__
9,430
def __init__(self, element): super(TimeRange, self).__init__(element) # Elements self.uom = get_uom(element.find(nspv("swe20:uom"))) try: self.constraint = AllowedTimes(element.find(nspv("swe20:constraint/swe20:AllowedTimes"))) # AllowedTimes, min=0, max=1...
ValueError
dataset/ETHPy150Open geopython/OWSLib/owslib/swe/common.py/TimeRange.__init__
9,431
def action(self): ''' Read in a command and execute it, send the return back up to the main master process ''' self.lane_stack.value.serviceAll() while self.lane_stack.value.rxMsgs: msg, sender = self.lane_stack.value.rxMsgs.popleft() try: ...
IndexError
dataset/ETHPy150Open saltstack/salt/salt/daemons/flo/worker.py/SaltRaetWorkerRouter.action
9,432
def test_abstract_manager(self): # Accessing the manager on an abstract model should # raise an attribute error with an appropriate message. try: AbstractBase3.objects.all() self.fail('Should raise an AttributeError') except __HOLE__ as e: # This error...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_abstract_manager
9,433
def test_custom_abstract_manager(self): # Accessing the manager on an abstract model with an custom # manager should raise an attribute error with an appropriate # message. try: AbstractBase2.restricted.all() self.fail('Should raise an AttributeError') exc...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_custom_abstract_manager
9,434
def test_explicit_abstract_manager(self): # Accessing the manager on an abstract model with an explicit # manager should raise an attribute error with an appropriate # message. try: AbstractBase1.objects.all() self.fail('Should raise an AttributeError') ex...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_explicit_abstract_manager
9,435
def test_swappable_manager(self): try: # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. old_app_models = copy.deepcopy(cache.app_models) old_app_s...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_swappable_manager
9,436
def test_custom_swappable_manager(self): try: # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. old_app_models = copy.deepcopy(cache.app_models) ol...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_custom_swappable_manager
9,437
def test_explicit_swappable_manager(self): try: # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. old_app_models = copy.deepcopy(cache.app_models) ...
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/regressiontests/managers_regress/tests.py/ManagersRegressionTests.test_explicit_swappable_manager
9,438
def _final_version(parsed_version): try: return not parsed_version.is_prerelease except __HOLE__: # Older setuptools for part in parsed_version: if (part[:1] == '*') and (part not in _final_parts): return False return Tr...
AttributeError
dataset/ETHPy150Open faassen/graphql-wsgi/bootstrap-buildout.py/_final_version
9,439
def _get_results(self): try: return self._cached_results except __HOLE__: self._cached_results = simplejson.loads(self._results) return self._cached_results
AttributeError
dataset/ETHPy150Open mollyproject/mollyproject/molly/geolocation/models.py/Geocode._get_results
9,440
def __init__(self, external_file=None): """Initialize the error fixer. Args: external_file: If included, all output will be directed to this file instead of overwriting the files the errors are found in. """ errorhandler.ErrorHandler.__init__(self) self._file_name = None self._...
KeyError
dataset/ETHPy150Open google/closure-linter/closure_linter/error_fixer.py/ErrorFixer.__init__
9,441
def __eq__(self, other): """ :param other: an IP set :return: ``True`` if this IP set is equivalent to the ``other`` IP set, ``False`` otherwise. """ try: return self._cidrs == other._cidrs except __HOLE__: return NotImplemented
AttributeError
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/sets.py/IPSet.__eq__
9,442
def __ne__(self, other): """ :param other: an IP set :return: ``False`` if this IP set is equivalent to the ``other`` IP set, ``True`` otherwise. """ try: return self._cidrs != other._cidrs except __HOLE__: return NotImplemented
AttributeError
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/sets.py/IPSet.__ne__
9,443
def __enter__(self): self.lockfile = open(self.fname, 'w') while True: try: # Using non-blocking locks since green threads are not # patched to deal with blocking locking calls. # Also upon reading the MSDN docs for locking(), it seems ...
IOError
dataset/ETHPy150Open openstack/rack/rack/openstack/common/lockutils.py/_InterProcessLock.__enter__
9,444
def __exit__(self, exc_type, exc_val, exc_tb): try: self.unlock() self.lockfile.close() except __HOLE__: LOG.exception(_("Could not release the acquired lock `%s`"), self.fname)
IOError
dataset/ETHPy150Open openstack/rack/rack/openstack/common/lockutils.py/_InterProcessLock.__exit__
9,445
@contextlib.contextmanager def lock(name, lock_file_prefix=None, external=False, lock_path=None): """Context based lock This function yields a `threading.Semaphore` instance (if we don't use eventlet.monkey_patch(), else `semaphore.Semaphore`) unless external is True, in which case, it'll yield an Inte...
KeyError
dataset/ETHPy150Open openstack/rack/rack/openstack/common/lockutils.py/lock
9,446
def search(self, terms): torrents = [] url = self.search_uri % quote_plus(terms) try: f = urlopen(url) soup = BeautifulStoneSoup(f.read()) for item in soup.findAll('item'): torrents.append({ 'url': item.enclosure['url'], ...
HTTPError
dataset/ETHPy150Open correl/Transmission-XBMC/resources/lib/search.py/Kickass.search
9,447
def is_valid_mac(addr): """Check the syntax of a given mac address. The acceptable format is xx:xx:xx:xx:xx:xx """ addrs = addr.split(':') if len(addrs) != 6: return False for m in addrs: try: if int(m, 16) > 255: return False except __HOLE__:...
ValueError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/apps/saf/common/utils.py/is_valid_mac
9,448
def make_cidr(gw, mask): """Create network address in CIDR format. Return network address for a given gateway address and netmask. """ try: int_mask = (0xFFFFFFFF << (32 - int(mask))) & 0xFFFFFFFF gw_addr_int = struct.unpack('>L', socket.inet_aton(gw))[0] & int_mask return (sock...
TypeError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/apps/saf/common/utils.py/make_cidr
9,449
def find_agent_host_id(this_host): """Returns the neutron agent host id for RHEL-OSP6 HA setup.""" host_id = this_host try: for root, dirs, files in os.walk('/run/resource-agents'): for fi in files: if 'neutron-scale-' in fi: host_id = 'neutron-n-' + ...
IndexError
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/apps/saf/common/utils.py/find_agent_host_id
9,450
def introspect_module(module, module_doc, module_name=None, preliminary=False): """ Add API documentation information about the module C{module} to C{module_doc}. """ module_doc.specialize_to(ModuleDoc) # Record the module's docformat if hasattr(module, '__docformat__'): module_doc....
KeyboardInterrupt
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/introspect_module
9,451
def introspect_class(cls, class_doc, module_name=None): """ Add API documentation information about the class C{cls} to C{class_doc}. """ class_doc.specialize_to(ClassDoc) # Record the class's docstring. class_doc.docstring = get_docstring(cls) # Record the class's __all__ attribute (p...
KeyboardInterrupt
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/introspect_class
9,452
def get_docstring(value, module_name=None): """ Return the docstring for the given value; or C{None} if it does not have a docstring. @rtype: C{unicode} """ docstring = getattr(value, '__doc__', None) if docstring is None: return None elif isinstance(docstring, unicode): ...
KeyboardInterrupt
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/get_docstring
9,453
def _find_function_module(func): """ @return: The module that defines the given function. @rtype: C{module} @param func: The function whose module should be found. @type func: C{function} """ if hasattr(func, '__module__'): return func.__module__ try: module = inspect.get...
KeyboardInterrupt
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/_find_function_module
9,454
def get_value_from_name(name, globs=None): """ Given a name, return the corresponding value. @param globs: A namespace to check for the value, if there is no module containing the named value. Defaults to __builtin__. """ name = DottedName(name) # Import the topmost module/package...
ImportError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/get_value_from_name
9,455
def _lookup(module, name): val = module for i, identifier in enumerate(name): try: val = getattr(val, identifier) except __HOLE__: exc_msg = ('no variable named %s in %s' % (identifier, '.'.join(name[:1+i]))) raise ImportError(exc_msg) return va...
AttributeError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/_lookup
9,456
def _import(name, filename=None): """ Run the given callable in a 'sandboxed' environment. Currently, this includes saving and restoring the contents of sys and __builtins__; and suppressing stdin, stdout, and stderr. """ # Note that we just do a shallow copy of sys. In particular, # any ch...
KeyboardInterrupt
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/_import
9,457
def introspect_docstring_lineno(api_doc): """ Try to determine the line number on which the given item's docstring begins. Return the line number, or C{None} if the line number can't be determined. The line number of the first line in the file is 1. """ if api_doc.docstring_lineno is not U...
IOError
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/introspect_docstring_lineno
9,458
def inference(self, kern, X, Z, likelihood, Y, mean_function=None, Y_metadata=None, Lm=None, dL_dKmm=None, psi0=None, psi1=None, psi2=None): assert Y.shape[1]==1, "ep in 1D only (for now!)" Kmm = kern.K(Z) if psi1 is None: try: Kmn = kern.K(Z, X) except _...
TypeError
dataset/ETHPy150Open SheffieldML/GPy/GPy/inference/latent_function_inference/expectation_propagation.py/EPDTC.inference
9,459
def main(): try: si = None try: print "Trying to connect to VCENTER SERVER . . ." si = connect.Connect(inputs['vcenter_ip'], 443, inputs['vcenter_user'], inputs['vcenter_password']) except __HOLE__, e: pass atexit.register(Disconnect, si) ...
IOError
dataset/ETHPy150Open rreubenur/vmware-pyvmomi-examples/vm_power_ops.py/main
9,460
def test04(): class Bogus(object): pass m = get_mapper(dom1) try: cls = m[Bogus] assert False, "should have raised a KeyError" except __HOLE__, _: pass
KeyError
dataset/ETHPy150Open haxsaw/actuator/src/tests/utils_tests.py/test04
9,461
def get_item_len(self, data, **kwargs): """ Get the max_item_id parameter :param kwargs: :return: """ try: return self._max_item_id or kwargs["max_item_id"] except __HOLE__: return len(set([row["item"] for _, row in data.iterrows()]))
KeyError
dataset/ETHPy150Open grafos-ml/test.fm/src/testfm/okapi/connector.py/BaseOkapiModel.get_item_len
9,462
@click.command() @click.argument('identifier') @environment.pass_env def cli(env, identifier): """Edit firewall rules.""" mgr = SoftLayer.FirewallManager(env.client) firewall_type, firewall_id = firewall.parse_id(identifier) if firewall_type == 'vlan': orig_rules = mgr.get_dedicated_fwl_rules(...
ValueError
dataset/ETHPy150Open softlayer/softlayer-python/SoftLayer/CLI/firewall/edit.py/cli
9,463
def check_exists(fips_dir=None) : """test if git is in the path :returns: True if git is in the path """ try : subprocess.check_output(['git', '--version']) return True except (__HOLE__, subprocess.CalledProcessError) : return False #----------------------------------...
OSError
dataset/ETHPy150Open floooh/fips/mod/tools/git.py/check_exists
9,464
def main(): global endflag if len(sys.argv)<>3: usage() sys.exit() else: port1 = int(sys.argv[1]) port2 = int(sys.argv[2]) controlThreads = [] try: socketServer = socket.socket(socket.AF_INET,socket.SOCK_STREAM) socketServer.bind(('',port1)) socketServer.listen(20) socketClient = socket.socket(s...
KeyboardInterrupt
dataset/ETHPy150Open RicterZ/reprocks/server/reprocks_server.py/main
9,465
def find_first_remote_branch(remotes, branch_name): """Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError""" for remote in remotes: try: return remote.refs[branch_name] except __HOLE__: continue # END exception handling...
IndexError
dataset/ETHPy150Open gitpython-developers/GitPython/git/objects/submodule/util.py/find_first_remote_branch
9,466
@staticmethod def _start_key(expr): """Return start (if possible) else S.Infinity. adapted from Set._infimum_key """ try: start = expr.start except (NotImplementedError, AttributeError, __HOLE__): start = S.Infinity return star...
ValueError
dataset/ETHPy150Open sympy/sympy/sympy/series/sequences.py/SeqBase._start_key
9,467
def request(host, port, child_num, con_num, bytes): # spawn child_num children processes for cnum in range(child_num): pid = os.fork() if pid == 0: # child for i in range(con_num): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect...
OSError
dataset/ETHPy150Open rspivak/csdesign/client.py/request
9,468
def __init__(self, data_stream, minimum_shape, resample='nearest', **kwargs): self.minimum_shape = minimum_shape try: self.resample = getattr(Image, resample.upper()) except __HOLE__: raise ValueError("unknown resampling filter '{}'".format(resample)) ...
AttributeError
dataset/ETHPy150Open rizar/attention-lvcsr/libs/fuel/fuel/transformers/image.py/MinimumImageDimensions.__init__
9,469
def has_valid_birthday(self, value): """ This function would grab the birthdate from the ID card number and test whether it is a valid date. """ from datetime import datetime if len(value) == 15: # 1st generation ID card time_string = value[6:12] ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/localflavor/cn/forms.py/CNIDCardField.has_valid_birthday
9,470
def _word_tokenizer_re(self): """Compiles and returns a regular expression for word tokenization""" try: return self._re_word_tokenizer except __HOLE__: self._re_word_tokenizer = re.compile( self._word_tokenize_fmt % { '...
AttributeError
dataset/ETHPy150Open reefeed/wanish/wanish/tokenizers.py/PunktLanguageVars._word_tokenizer_re
9,471
def subscribe(self): """Subscribe self.handlers to signals.""" for sig, func in self.handlers.items(): try: self.set_handler(sig, func) except __HOLE__: pass
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/SignalHandler.subscribe
9,472
def unsubscribe(self): """Unsubscribe self.handlers from signals.""" for signum, handler in self._previous_handlers.items(): signame = self.signals[signum] if handler is None: self.bus.log("Restoring %s handler to SIG_DFL." % signame) ...
ValueError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/SignalHandler.unsubscribe
9,473
def set_handler(self, signal, listener=None): """Subscribe a handler for the given signal (number or name). If the optional 'listener' argument is provided, it will be subscribed as a listener for the given signal's channel. If the given signal name or number is not ava...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/SignalHandler.set_handler
9,474
def _set_umask(self, val): if val is not None: try: os.umask except __HOLE__: self.bus.log("umask function not available; ignoring umask.", level=30) val = None self._umask = val
AttributeError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/DropPrivileges._set_umask
9,475
def start(self): if self.finalized: self.bus.log('Already deamonized.') # forking has issues with threads: # http://www.opengroup.org/onlinepubs/000095399/functions/fork.html # "The general problem with making fork() work in a multi-threaded # world is what ...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/Daemonizer.start
9,476
def exit(self): try: os.remove(self.pidfile) self.bus.log('PID file removed: %r.' % self.pidfile) except (__HOLE__, SystemExit): raise except: pass
KeyboardInterrupt
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/PIDFile.exit
9,477
def run(self): """Reload the process if registered files have been modified.""" for filename in self.sysfiles() | self.files: if filename: if filename.endswith('.pyc'): filename = filename[:-1] oldtime = self.mtimes.get(fil...
OSError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/cherrypy/cherrypy/process/plugins.py/Autoreloader.run
9,478
def _iter_lines(proc, decode, linesize): try: from selectors import DefaultSelector, EVENT_READ except __HOLE__: # Pre Python 3.4 implementation from select import select def selector(): while True: rlist, _, _ = select([proc.stdout, proc.stderr], [], ...
ImportError
dataset/ETHPy150Open tomerfiliba/plumbum/plumbum/commands/processes.py/_iter_lines
9,479
def load_app(self, app_name, can_postpone=False): """ Loads the app with the provided fully qualified name, and returns the model module. """ self.handled[app_name] = None self.nesting_level += 1 app_module = import_module(app_name) try: models...
ImportError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/models/loading.py/AppCache.load_app
9,480
def get_models(self, app_mod=None, include_auto_created=False, include_deferred=False, only_installed=True): """ Given a module containing models, returns a list of the models. Otherwise returns a list of all installed models. By default, auto-creat...
KeyError
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/models/loading.py/AppCache.get_models
9,481
def _safe_remove(filepath): if not filepath: return try: os.remove(filepath) except __HOLE__: pass
OSError
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/plugins/common/test_userdatautils.py/_safe_remove
9,482
def build_pipewelder(conn, config): """ Return a Pipewelder object defined by *config*. """ try: pw = Pipewelder(conn, config['template']) except __HOLE__ as e: print(e) return 1 for d in config['dirs']: p = pw.add_pipeline(d) for k, v in config["values"]....
IOError
dataset/ETHPy150Open SimpleFinance/pipewelder/pipewelder/cli.py/build_pipewelder
9,483
def visit_Assign(self, node): """Looking for 'p1 = self.config.get("param1", "default1")' This is the canonical form of getting test case parameters in a test implementation. This ends up with an AST looking like: Assign(targets=[Name(id='p1', ctx=Store())], value=Call(...
AttributeError
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/QA/testinspector.py/TestmoduleVisitor.visit_Assign
9,484
def http_request(self, method, path, body=None, response_formatter=None, error_formatter=None, **params): try: # Check if it's ok to submit if not self._should_submit(): raise HttpBackoff("Too many timeouts. Won't try again for {1} seconds.".format(*self._backoff_status()...
TypeError
dataset/ETHPy150Open DataDog/dogapi/src/dogapi/http/base.py/BaseDatadog.http_request
9,485
def _get_memory(string, offset): try: return memoryview(string)[offset:] except __HOLE__: return buffer(string, offset)
TypeError
dataset/ETHPy150Open benoitc/flower/flower/net/sock.py/_get_memory
9,486
def read(self): if self.closing: return "" while True: try: retval = self.queue.popleft() if self.cr.balance < 0: self.cr.send(retval) if isinstance(retval, bomb): retval.raise_() ...
IndexError
dataset/ETHPy150Open benoitc/flower/flower/net/sock.py/SockConn.read
9,487
def __init__(self, addr, *args, **kwargs): fd = kwargs.get('fd') if fd is None: try: os.remove(addr) except __HOLE__: pass sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEA...
OSError
dataset/ETHPy150Open benoitc/flower/flower/net/sock.py/PipeSockListen.__init__
9,488
def interpfx(time,fx,time_pre): opens = np.zeros(len(time)) f = sp.interpolate.interp1d(time_pre, fx) for t in range(len(time)): try: opens[t] = f(time[t]) except __HOLE__: if time[t] < min(time_pre): opens[t] = f(min(time_pre)) elif t...
ValueError
dataset/ETHPy150Open srcole/fxml/scraper/format_fxdata.py/interpfx
9,489
def process_sd(self, dn, obj): sd_attr = "nTSecurityDescriptor" sd_val = obj[sd_attr] sd = ndr_unpack(security.descriptor, str(sd_val)) is_deleted = 'isDeleted' in obj and obj['isDeleted'][0].upper() == 'TRUE' if is_deleted: # we don't fix deleted objects ...
KeyError
dataset/ETHPy150Open byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/samba/dbchecker.py/dbcheck.process_sd
9,490
@util.use_cassette def test_delete(vcr_live_sleep): user = User() their_profile = user.quickmatch() message_info = their_profile.message('text') assert message_info.thread_id != None thread_id = user.outbox[0].id user.outbox[0].delete() vcr_live_sleep(2) user.outbox() try: as...
IndexError
dataset/ETHPy150Open IvanMalison/okcupyd/tests/messaging_test.py/test_delete
9,491
def Decompress(self, compressed_data): """Decompresses the compressed data. Args: compressed_data: a byte string containing the compressed data. Returns: A tuple containing a byte string of the uncompressed data and the remaining compressed data. Raises: BackEndError: if the B...
IOError
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/compression/bzip2_decompressor.py/BZIP2Decompressor.Decompress
9,492
def get_cost_fns(self, topic): """Returns a list of tuples containing weights and cost functions to use for weighing hosts """ if topic in self.cost_fns_cache: return self.cost_fns_cache[topic] cost_fns = [] for cost_fn_str in FLAGS.least_cost_scheduler_cost_f...
AttributeError
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/scheduler/least_cost.py/LeastCostScheduler.get_cost_fns
9,493
def get_summoner_by_id(id_): """ Gets a summoner by ID Args: id_ (int): the ID of the summoner Returns: Summoner: the summoner """ summoner = cassiopeia.core.requests.data_store.get(cassiopeia.type.core.summoner.Summoner, id_, "id") if summoner: return summoner ...
KeyError
dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/core/summonerapi.py/get_summoner_by_id
9,494
def get_summoner_by_name(name): """ Gets a summoner by name Args: name (str): the name of the summoner Returns: Summoner: the summoner """ summoner = cassiopeia.core.requests.data_store.get(cassiopeia.type.core.summoner.Summoner, name, "name") if summoner: return su...
KeyError
dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/core/summonerapi.py/get_summoner_by_name
9,495
def get_summoners_by_id(ids): """ Gets a bunch of summoners by ID Args: ids (list<int>): the IDs of the summoners Returns: list<Summoner>: the summoners """ summoners = cassiopeia.core.requests.data_store.get(cassiopeia.type.core.summoner.Summoner, ids, "id") # Find which ...
KeyError
dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/core/summonerapi.py/get_summoners_by_id
9,496
def get_summoners_by_name(names): """ Gets a bunch of summoners by name Args: names (list<str>): the names of the summoners Returns: list<Summoner>: the summoners """ summoners = cassiopeia.core.requests.data_store.get(cassiopeia.type.core.summoner.Summoner, names, "name") ...
KeyError
dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/core/summonerapi.py/get_summoners_by_name
9,497
def is_connection(graph, src, dest): try: return 'conn' in graph.edge[src][dest] except __HOLE__: return False
KeyError
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/depgraph.py/is_connection
9,498
def var_edge_iter(self, source, reverse=False): """Iterater over edges from the given source to the nearest basevars. """ # Adapted from the networkx bfs_edges function if reverse and isinstance(self, nx.DiGraph): neighbors = self.predecessors_iter else: ...
StopIteration
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/depgraph.py/DependencyGraph.var_edge_iter
9,499
def _dfs_connections(G, source, visited, reverse=False): """Produce connections in a depth-first-search starting at source.""" # Slightly modified version of the networkx function dfs_edges if reverse: neighbors = G.predecessors_iter else: neighbors = G.successors_iter stack = [] ...
StopIteration
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/depgraph.py/_dfs_connections